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

SwiftUI modifier inside conditional compilation block indents incorrectly #806

Open
pdil opened this issue Sep 12, 2024 · 1 comment
Open

Comments

@pdil
Copy link

pdil commented Sep 12, 2024

When running swift-format I'm encountering the following issue where the SwiftUI modifier (.textInputAutocapitalization, located inside the #if !os(macOS) block) is un-indented instead of being left alone.

Linting on the same code returns warning: [Indentation] unindent by 4 spaces.

Here is my .swift-format file:

{
    "version": 1,
    "indentation": {
        "spaces": 4
    },
    "indentConditionalCompilationBlocks": false,
    "lineBreakBetweenDeclarationAttributes": false,
    "lineLength": 200,
    "multiElementCollectionTrailingCommas": false,
    "respectsExistingLineBreaks": true,
    "rules": {
        "NoAccessLevelOnExtensionDeclaration": false,
        "UseWhereClausesInForLoops": true
    }
}

The command I am running is swift format -irp . with Xcode 16 (16A242).

@ahoppen
Copy link
Member

ahoppen commented Sep 12, 2024

Synced to Apple’s issue tracker as rdar://135851313

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