Skip to content

[SourceKit/Indentation] Fix over-indent after function decl with no param list or body. #32513

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

Indentation after an incompletion function declaration with no parameter list or body always indents the next line relative to it, incorrectly.

E.g:

struct Foo {
  bar
    } // this gets indented relative to 'bar'

struct Foo {
  bar
    func foo() {} // this gets indented relative to 'bar'
} 

This is particularly bad because we treat a placeholder in a struct/class body as if it were an incompletion function declaration, and when completing on a struct/class keyword in Xcode you get the snippet below with such a placeholder and the incorrect indentation:

struct <#name#> {
  <#fields#>
    }

Resolves rdar://problem/64618791

@nathawes nathawes requested a review from benlangmuir June 23, 2020 20:35
@nathawes
Copy link
Contributor Author

@swift-ci please test

@nathawes nathawes merged commit 603ca95 into swiftlang:master Jun 24, 2020
@nathawes nathawes deleted the fix-indentation-after-incomplete-func-decl branch June 24, 2020 20:48
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