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
Two parsers priority indent on the same file #6124
Comments
Ping @gbprod, maybe you could bring some context to this issue. Did you look into indenting already? Did you have some issues? Thanks! |
Having multiple parsers for the same file is not supported. If you have multiple languages, you need to either define a "base language" with injections, or have an "extended" language that inherits from the base language (without injections), as in |
Would need to fix indent to accept the smallest range, instead of the smallest root tree I don't know how to do that though :). PR Welcome |
Oh I see, thanks! @clason can I define injections for indents? The upstream plugin is already configured for highlights for example. Thanks for your help! EDIT: I didn't understand injections,
Without this, twig indenting works! How can I apply my indent rules when twig is inside a html block? |
Hi! |
Describe the bug
I'm working on a twig indent based on https://github.com/gbprod/tree-sitter-twig. Here's the diff: gbprod/tree-sitter-twig@main...thomas-hiron:tree-sitter-twig:indent
Unfortunately, html indent and twig indent are not working together.
I'm testing a simple twig file:
This is the produced AST:
The
indents.scm
file:If I uninstall tree-sitter-html, the indentation works as expected (twig is indented):
But with tree-sitter-html and twig, here's the output:
Is there a way to order the parsers with a priorioty? I would like twig to indent after html. Looks like it's the other way around.
I also tried to inherits from html indents but I got the impression that inherits isn't meant for this purpose.
To Reproduce
queries/*.scm
into$XDG_CONFIG_HOME/nvim/queries/
or any nvim runtime path.:TSInstall html twig_indent
Expected behavior
Output should be:
Output of
:checkhealth nvim-treesitter
Output of
nvim --version
Additional context
No response
The text was updated successfully, but these errors were encountered: