Skip to content

[SourceKit/CodeFormat] Fix multi-line array literal elements not indenting relative to their first line. #32582

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

Merged

Conversation

nathawes
Copy link
Contributor

Previously each item in an array literal wasn't considered to be an indent context, so we under-indented their continuation lines as in the example below:

doStuffWithList([
    firstItem
    .map {$0}       // This line should be indented further.
    .append(\.foo),   // And so should this one.
    secondItem
    .filter {$0 > 5}
])

After this change, each item is an indent context so we get the below:

doStuffWithList([
    firstItem
        .map {$0}
        .append(\.foo),
    secondItem
        .filter {$0 > 5}
])

Resolves rdar://problem/64834040

…nting relative to their first line.

doStuffWithList([
    firstItem
    .map { $0 }       // This line should be indented further.
    .append(\.foo),   // And so should this one.
    secondItem
])

Resolves rdar://problem/64834040
@nathawes nathawes requested a review from benlangmuir June 27, 2020 04:19
@nathawes
Copy link
Contributor Author

@swift-ci please test

@nathawes
Copy link
Contributor Author

@swift-ci please test

@nathawes nathawes merged commit ff99d65 into swiftlang:master Jun 29, 2020
@nathawes nathawes deleted the array-literal-sub-expr-indentation-fix branch June 29, 2020 22:12
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

Successfully merging this pull request may close these issues.

2 participants