-
Notifications
You must be signed in to change notification settings - Fork 231
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
Align line ending comments across multiple lines. #817
Comments
My gut feeling (without thinking too hard) is that this would require some nontrivial changes to our core algorithm since we make a single linear pass over the token stream. We don't really have a way to look ahead at all the possible line comments to figure out what the spacing would need to be for alignment of later lines, and we don't really have a way to "rewind" either. Right now the pretty printer is a We'd need to be careful about performance if we did too much lookahead/rewinding, but I think there's some potential there. |
ps - clang-format does this sorta alignment, which is part of why it seems like it might make sense to support. |
Synced to Apple’s issue tracker as rdar://136604806 |
Given code like:
It would be nice if
swift-format
made all the trailing line comments align. i.e. - the one short line should get extra spaces before the comment so all the//
aligned. i.e. -It would also apply to things like:
and
The text was updated successfully, but these errors were encountered: