Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Indentation for SwiftUI modifiers is incorrect #152

Open
joeldrotleff opened this issue Aug 11, 2023 · 1 comment
Open

Indentation for SwiftUI modifiers is incorrect #152

joeldrotleff opened this issue Aug 11, 2023 · 1 comment

Comments

@joeldrotleff
Copy link

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.

@keith
Copy link
Owner

keith commented Aug 11, 2023

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!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants