swift.vim
swift.vim copied to clipboard
Indentation for SwiftUI modifiers is incorrect
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.
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!