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

Can swiftformat align && operators in multi-line Equatable implementations like Xcode format? #1633

Open
topkim993 opened this issue Feb 23, 2024 · 0 comments

Comments

@topkim993
Copy link

topkim993 commented Feb 23, 2024

Background
Xcode format automatically aligns && operators in multi-line Equatable implementations for better readability:

xcode format

struct Test: Equatable {
    let a: String
    let b: String
    let c: String
    let d: String

    public static func == (lhs: Test, rhs: Test) -> Bool {
        lhs.a == rhs.a &&
        lhs.b == rhs.b &&
        lhs.c == rhs.c
    }
}

However, using swiftformat --indent doesn't apply this alignment

swiftformat --indent

struct Test: Equatable {
    let a: String
    let b: String
    let c: String
    let d: String

    public static func == (lhs: Test, rhs: Test) -> Bool {
        lhs.a == rhs.a &&
            lhs.b == rhs.b &&
            lhs.c == rhs.c
    }
}

Question

Is there a way to configure swiftformat to align && operators in a way that matches Xcode format? If not, are there recommended workarounds or is this a potential feature for future updates?

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

1 participant