nicklockwood / SwiftFormat

A command-line tool and Xcode Extension for formatting Swift code
MIT License
7.9k stars 640 forks source link

"--xcodeindentation true" doesn't work as expected #1080

Closed psiwork closed 2 years ago

psiwork commented 2 years ago

This is the result of swiftformat . --xcodeindentation true, v. 0.48.18

    private func actualContent(_ proxy: GeometryProxy) -> some View {
        HStack(spacing: 0) {
            if requiresScrolling {
                scrollingContent
            } else {
                nonScrollingContent
            }
        }
        .frame(maxWidth: proxy.size.width,
               alignment: requiresScrolling ? .leading : alignment)
            .fadeGradient(self.gradient, length: spacing)
            .layoutPriority(1)
    }

The last two modifiers (fadeGradient & layoutPriority) are indented, but there is no reason for that. Xcode's default formatting don't do these indents:

    private func actualContent(_ proxy: GeometryProxy) -> some View {
        HStack(spacing: 0) {
            if requiresScrolling {
                scrollingContent
            } else {
                nonScrollingContent
            }
        }
        .frame(maxWidth: proxy.size.width,
               alignment: requiresScrolling ? .leading : alignment)
        .fadeGradient(self.gradient, length: spacing)
        .layoutPriority(1)
    }
nicklockwood commented 2 years ago

@psiwork fixed in 0.49.0