Skip to content

Question: Is it possible to have control over comments while having them in extras? #2186

Closed Answered by ahlinc
MichaHoffmann asked this question in Q&A
Discussion options

You must be logged in to vote

You could, for example, move the open/close curly braces inside the body definition.

It's not possible cause the body may be empty and dangling curles in the body would look weird instead of absent body node.

Technically for parser the situation is correct because the body node isn't started right after the open curly and that means there are no tokens that belong to the body.

@MichaHoffmann I've opened a PR tree-sitter-grammars/tree-sitter-hcl#31 that demonstrates how to cheat Tree-sitter parser with a fake token.

Screenshot

Replies: 2 comments 3 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
3 replies
@MichaHoffmann
Comment options

@MichaHoffmann
Comment options

@ahlinc
Comment options

Answer selected by MichaHoffmann
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
3 participants
Converted from issue

This discussion was converted from issue #2181 on April 08, 2023 04:13.