-
-
Notifications
You must be signed in to change notification settings - Fork 2.6k
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
Add rust injections for c, c++, html, js, py #1526
Conversation
((macro_invocation | ||
macro: (scoped_identifier | ||
name: (identifier) @_python (#eq? @_python "python")) | ||
(token_tree) @injection.content) | ||
(#set! injection.language "python") | ||
(#set! injection.include-children)) | ||
|
||
((macro_invocation | ||
macro: (identifier) @_python (#eq? @_python "python") | ||
(token_tree) @injection.content) | ||
(#set! injection.language "python") | ||
(#set! injection.include-children)) |
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.
Not sure how can I simplify this so I leave it like this for now.
One is inline_python::python!
and one is python!
. I think this is probably applicable for others.
I'm not totally sure what's happening here with the injections within
I would expect that the contents of I think what's happening here is that some of the rules from the rust grammar are excluding nodes from the token tree that are important to be parsed for python's sake. For example, it looks like the @archseer do you have thoughts about the behavior here? |
I find most of these a bit niche and not sure if we want these in by default. i.e. https://github.com/search?l=Rust&q=inline_python&type=Code is barely used |
Maybe have them commented out by default? But I doubt anyone using it wants to dig into the highlight to enable support for it. Will enabling it slows down the tree-sitter highlighting? |
The injections for python in rust may work better with the new I haven't tried it out though. |
@the-mikedavis Do you think I should continue to work on this or just close it given that these are rarely used? |
IMO it's more work than it's worth to make these queries look good but I'm biased since I haven't used Rust in a cross-language way like this before :P |
I only used it a couple of times only and I don't need it anymore so I guess I am just going to close this. Or maybe we can add it commented out. |
cc @the-mikedavis
Example