Skip to content

[SourceKit/CodeFormat] Column-align enum element decls and the items in their parameter lists. #30891

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
merged 1 commit into from
Apr 13, 2020

Conversation

nathawes
Copy link
Contributor

@nathawes nathawes commented Apr 8, 2020

I missed this in the initial indentation rework. It wasn't handling them at all so we ended up with multi-line enum case decls like the below:

enum Foo {
    case first,
    second
    case third(a: Int,
    b: Int),
    fourth(a: Int,
    b: Int
}

which is a regression compared to the slightly better 5.2 behavior:

enum Foo {
  case first,
  second
  case third(a: Int,
    b: Int),
  fourth(a: Int,
    b: Int)
}

New behavior is:

enum Foo {
  case first,
       second
  case third(a: Int,
             b: Int),
       fourth(a: Int,
              b: Int)
}

Resolves rdar://problem/61461022

…in their parameter lists.

Resolves rdar://problem/61461022
@nathawes nathawes requested a review from benlangmuir April 8, 2020 18:32
@nathawes
Copy link
Contributor Author

nathawes commented Apr 8, 2020

@swift-ci please test

y: Int,
z: Int),
second(
x: Int,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

3 columns?

Copy link
Contributor Author

@nathawes nathawes Apr 8, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

12 total. Lines that aren't column aligned themselves round down to the nearest tab-width. Not sure that's the best behavior, but it's not new.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see, thanks.

@nathawes nathawes merged commit 6f50aa4 into swiftlang:master Apr 13, 2020
@nathawes nathawes deleted the indent-enum-case-decl branch April 13, 2020 19:08
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