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

Move comments to the syntax following them #32

Closed
Lucus16 opened this issue Jul 29, 2019 · 0 comments · Fixed by #117
Closed

Move comments to the syntax following them #32

Lucus16 opened this issue Jul 29, 2019 · 0 comments · Fixed by #117
Milestone

Comments

@Lucus16
Copy link
Contributor

Lucus16 commented Jul 29, 2019

Currently, all comments are parsed after tokens, but comments generally apply to the token that follows it, with the exception of trailing comments on the same line. Many formatting cases based on reordering expressions can't be done properly until comments are attached to the tokens they apply to. I tried parsing comments before the tokens, but this cannot be done efficiently and elegantly.

The best way forward is to make a pass over the entire syntax tree and moving comments from after their intial token to before the next token. This pass can simultaneously move some comments into better positions where they don't interrupt formatting flow.

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 a pull request may close this issue.

2 participants