I'm working on migrating the regression tests and tweaking the new formatting heuristics as I go based on the results I see in those real-world examples.
In a method chain, if the target can be block formatted, we prefer to split in the target and not at the ".". So:
But for cascades, I think the cascade operation is "looser" and generally looks better to put it on its own line and leave the target unsplit when possible. So this change flips priority and prefers:
[target, block]
..doStuff();
In larger more realistic examples, I think it looks better. In general, I think it's almost always better to move cascades onto their own lines. In fact, both the short and tall styles already have a rule that any cascade with more than one section will always unconditionally split every section even if they would otherwise fit. So I think this change is consistent with that.
I'm working on migrating the regression tests and tweaking the new formatting heuristics as I go based on the results I see in those real-world examples.
In a method chain, if the target can be block formatted, we prefer to split in the target and not at the ".". So:
Prior to this PR, it had the same priority for single-section cascades:
But for cascades, I think the cascade operation is "looser" and generally looks better to put it on its own line and leave the target unsplit when possible. So this change flips priority and prefers:
In larger more realistic examples, I think it looks better. In general, I think it's almost always better to move cascades onto their own lines. In fact, both the short and tall styles already have a rule that any cascade with more than one section will always unconditionally split every section even if they would otherwise fit. So I think this change is consistent with that.