Skip to content

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

Closed
@ottijp

Description

@ottijp

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions