Open loic-sharma opened 2 weeks ago
I spent a little time looking into this. Aesthetically, I really like the proposed style. A call chain following a split delimited expression like a function call or collection literal has always looked pretty wonky and simply not indenting the chain at all so that it lines up with the closing )
or ]
in the target seems like a nice fix.
I would still want to test it on a larger corpus and see if it looks weird in some contexts.
However, I haven't been able to actually implement it yet. :( It's running into, I think, the same limitation in the new formatter's IR that is getting in the way of #1465 and #1466. I have some thoughts on how to make the formatter able to handle these cases but so far I haven't been able to get anything working.
I'll try to think about it more.
We should consider whether method call chains should be indented if the target is a split delimited expression:
Also, we should consider whether method call chains on single-line constructor expressions should be indented:
Prior art
SwiftUI indents method call chains on single-line expressions but does not indent method call chains on split delimited expressions (example).