You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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?)
The text was updated successfully, but these errors were encountered:
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
andLine *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?)
The text was updated successfully, but these errors were encountered: