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
The current grammar does not distinguish between line comment and block comments. Supporting this would make it more convenient for editors to see in what type of comment they are in, and then make formatting decisions without examining the code themselves.
FWIW, the Java grammar (which has the same comment syntax as C and C++), does this already. Something similar could easily be done here (there's already a skeleton for it). See also tree-sitter/tree-sitter-java#92
The text was updated successfully, but these errors were encountered:
There is a strong convention across lots of parsers to use one comment node for all kinds of comments. Use cases that need to distinguish between comment types can use queries and #match? predicates.
You're right thattree-sitter-java does things differently, but it's the exception, and I'm honestly pretty surprised that that change got landed. (A later proposal to distinguish JavaDoc comments was closed under the “use queries instead” rationale.)
I think it's worth having a philosophical discussion about. I'd be just as happy to have different line_comment and block_comment types for all languages, but I'd much rather have a uniform pattern across all parsers.
The current grammar does not distinguish between line comment and block comments. Supporting this would make it more convenient for editors to see in what type of comment they are in, and then make formatting decisions without examining the code themselves.
FWIW, the Java grammar (which has the same comment syntax as C and C++), does this already. Something similar could easily be done here (there's already a skeleton for it). See also tree-sitter/tree-sitter-java#92
The text was updated successfully, but these errors were encountered: