swift.vim icon indicating copy to clipboard operation
swift.vim copied to clipboard

Indentation for SwiftUI modifiers is incorrect

Open joeldrotleff opened this issue 2 years ago • 1 comments

Here is the default Xcode-generated indentation for some SwiftUI code:

NavigationStack {
    CoolView()
        .padding(10)
}
.padding(12)

Note that the first ".padding" example is indented while the second is not. So this seems like a tricky case.

Using swift.vim auto-indent I get:

NavigationStack {
    CoolView()
    .padding(10)
}
.padding(12)

So the second ".padding" is correctly not indented, but the first should be indented.

joeldrotleff avatar Aug 11 '23 21:08 joeldrotleff

ah yes. i'm not sure exactly what heuristic would always work but seems like )\n\s+\. should always be previous line + X. PRs welcome!

keith avatar Aug 11 '23 22:08 keith