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

Attach nearby comments to AST elements #16

Open
nilium opened this issue Sep 29, 2018 · 0 comments
Open

Attach nearby comments to AST elements #16

nilium opened this issue Sep 29, 2018 · 0 comments
Labels
enhancement New feature or request hacktoberfest Hacktoberfest issues

Comments

@nilium
Copy link
Owner

nilium commented Sep 29, 2018

To support tooling that retains comments, like a format tool (such as gofmt), AST nodes should have comments attached to them. How they'll be attached is another question -- possilby with Before []*Comment and Line *Comment fields? That way commends preceding a node are bundled up in before, along with an end-of-line comment.

Reformatting would want to preserve at least one line break between comment blocks, but comment tokens should already retain their line number to make that easier.

This one needs some thinking to determine how to support it, since initial codf design supports comment tokens but does not preserve them in the AST. (Maybe tools shouldn't use the parser?)

@nilium nilium added the enhancement New feature or request label Sep 29, 2018
@nilium nilium added the hacktoberfest Hacktoberfest issues label Oct 6, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request hacktoberfest Hacktoberfest issues
Projects
Status: No status
Development

No branches or pull requests

1 participant