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

The indentation difference between Xcode and this plugin in SwiftUI #155

Closed
ottijp opened this issue Feb 5, 2025 · 2 comments
Closed

The indentation difference between Xcode and this plugin in SwiftUI #155

ottijp opened this issue Feb 5, 2025 · 2 comments

Comments

@ottijp
Copy link
Contributor

ottijp commented Feb 5, 2025

I noticed a discrepancy in indentation behavior between Xcode and this plugin when working with SwiftUI code. Specifically, this plugin introduces extra indentation in certain cases, as shown in the following example.

This plugin:

Button(action: {
           print("clicked")
           isShowingSheet2 = true
       }) {
           Text("click me")
    }
    .buttonStyle(.bordered)
}
.padding(12)
.frame(width: 200, height: 400)
.sheet(isPresented: Binding(get: { isShowingSheet2 },
                            set: { v in isShowingSheet2 = v }
                            ) {
                                                 Text("sheet2")
}
)

Xcode (Playground):

Button(action: {
    print("clicked")
    isShowingSheet2 = true
}) {
    Text("click me")
}
.buttonStyle(.bordered)
}
.padding(12)
.frame(width: 200, height: 400)
.sheet(isPresented: Binding(get: { isShowingSheet2 },
                            set: { v in isShowingSheet2 = v }
                           ) {
    Text("sheet2")
}
)

I haven't looked into it deeply yet, but I feel like this might be an issue with how closures inside parentheses are handled.

Does this plugin aim to match Xcode's indentation style as a policy?
If so, I will try creating a PR to address this issue.

@keith
Copy link
Owner

keith commented Feb 5, 2025

looks to me like Xcode's is more correct for sure. so we should try to mirror it in this case at least.

@ottijp
Copy link
Contributor Author

ottijp commented Feb 8, 2025

I'm working on this issue.

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