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

Guard let in blocks is merged into the same line #494

Closed
pronebird opened this issue Mar 23, 2023 · 3 comments
Closed

Guard let in blocks is merged into the same line #494

pronebird opened this issue Mar 23, 2023 · 3 comments

Comments

@pronebird
Copy link

Swift-format does not add newline before guard statement in closures which is incredibly weird:

myObject.didFinish = { [weak self] in guard let self = self else { return }

    self.didFinish?(self)
}
@stackotter
Copy link
Contributor

Feel free to test out my fix and see if it works for you :) After my fix, your snippet gets formatted like so:

myObject.didFinish = { [weak self] in
    guard let self = self else { return }

    self.didFinish?(self)
}

allevato added a commit that referenced this issue Apr 11, 2023
Fix pretty printing of multi-statement closures (issue #494)
@stackotter
Copy link
Contributor

@allevato could you please close this issue? It's resolved now

@allevato
Copy link
Member

Fixed by #498.

allevato added a commit to allevato/swift-format that referenced this issue Jun 29, 2023
Fix pretty printing of multi-statement closures (issue swiftlang#494)
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

3 participants