While I do agree with the points raised in #547, I'm not a fan of the approach that was ultimately chosen. Preserving user-authored line breaks inside lambdas violates the deterministic premise this formatter was arguably built upon. The most appealing principle for me was that any equivalent input syntax tree would always result in the same formatted output (barring any additional newlines in function bodies). This is not the case anymore, as developers may influence the formatting result in lambdas, which aren't only used for DSLs.
Could this have been approached differently? How about wrapping the outer lambda body to a new line if it contains a nested lambda on the very same line? To be clear, I'm not suggesting that "preserve user-authored line breaks" should be completely removed or replaced - I just don't think it should have been made the default.
While I do agree with the points raised in #547, I'm not a fan of the approach that was ultimately chosen. Preserving user-authored line breaks inside lambdas violates the deterministic premise this formatter was arguably built upon. The most appealing principle for me was that any equivalent input syntax tree would always result in the same formatted output (barring any additional newlines in function bodies). This is not the case anymore, as developers may influence the formatting result in lambdas, which aren't only used for DSLs.
Could this have been approached differently? How about wrapping the outer lambda body to a new line if it contains a nested lambda on the very same line? To be clear, I'm not suggesting that "preserve user-authored line breaks" should be completely removed or replaced - I just don't think it should have been made the default.