-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
Exclude only named children without injection.include-children #3129
Conversation
If you want a node from the tree to be queryable, it should be named: that's the point of named nodes. I think you should restructure the grammar to expose the nodes you want to capture in queries. I can't test this at the moment but I suspect this breaks injections for some templating languages or maybe Rust macros? I'll give it a look when I have a chance |
That's my point. I expose Also notice how not excluding unnamed nodes is strictly more expressive. In a tree-sitter grammar an unnamed node can always be turned into a named one with
I'm gonna have a look myself too. If that's the case and the queries can't easily be changed to work with the new behavior: how do you feel about adding a |
It seems you're right. Many languages rely on excluding unnamed nodes for injecting the |
A separate property like include-unnamed sounds like a good addition to me 👍 |
574fac3
to
d32deb1
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks good, thanks for working on it 👍
…-editor#3129) * Exclude only named children without injection.include-children * Add injection.include-unnamed-children parameter
This fixes problems arising in #3108.
The markdown parser needs to exclude children for language injection, but only named ones. This is different from the behavior in tree-sitter-highlight, but to me it seems more sensible.
To give a technical example: Otherwise there is almost no way to write something like
where
$._content
and the parentheses should be included and$.excluded
excluded. This is because there will always be'('
and')'
nodes as a child ofrule
.