-
-
Notifications
You must be signed in to change notification settings - Fork 35
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
Milestone
Comments
1 task
Merged
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
The text was updated successfully, but these errors were encountered: