-
Notifications
You must be signed in to change notification settings - Fork 15
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
Support for inline <script> tags #37
Comments
I like this idea! I can work on a PR adding JS injections to https://github.com/phoenixframework/tree-sitter-heex/blob/main/queries/injections.scm. Depending on what text editor you use you may need to port those queries to the format your text editor understands. For example, nvim-treesitter uses a different set of captures to handle language injection. |
Update on this: I believe we need to introduce a new node type for |
We could support script (and maybe style too?) elements as separate nodes like tree-sitter-html: https://github.com/tree-sitter/tree-sitter-html/blob/d742025fa2d8e6100f134a6ea990443aa1f074b3/grammar.js#L64-L68. It looks like we have some parsing errors currently where |
I started working on this last night, see #38. I'm currently struggling to get the contents of a Looking at @the-mikedavis If you have any ideas, I'd love to hear them! |
For posterity, it appears that we do need to implement an external scanner to write a node that captures all text until hitting |
Hello. Could I ask about the status of this? |
I believe Connor's last comment is still up-to-date. To fix this properly we would probably need to add a scanner like tree-sitter-html's and follow what it's doing for parsing |
This is the closest I could get for nvim-treesitter.
However, it disables the elixir injections. I'm not sure why since the query seems to match the exact nodes. |
See: phoenixframework#37 This commit doesn't fix the grammar but add syntax highlight support for JavaScript and CSS code inside of <script> and <style> tags.
I got it working by adding the File:
This only adds syntax highlight support. |
Would be nice to have support for inline script tags (please disregard the gibberish JS)
The text was updated successfully, but these errors were encountered: