Unsupported inline `<script>` tag syntax highlighting in HEEx files

I didn’t really want to put this as a question, so apologies if you think it should indeed be there, but I was trying to write an inline script tag in a heex file and the syntax highlighting is not supported, at least for TreeSitter in Neovim, Zed, and Nova.

Now I’m not sure why, I would have imagined since they are correctly highlighted in VSCode and Sublime Text, but I guess the above editors are using the same syntax grammar. Anyone know where I could report this, or even better, where could I suggest a fix?

It’s very minor, but it’s bothering me more than it should and have also been wondering if there’s a better way to add inline JavaScript, maybe from the view module or controller?



I think there are issues with LiveView and inline JavaScript in general because it won’t execute as expected during re renders.

I believe Phoenix Hooks JavaScript interoperability — Phoenix LiveView v0.20.1 are the canonical answer to this sort of thing.

I’ve noticed this too, in VSCode HEEx syntax highlighting. That’s where I would direct a bug ticket (or, the analogous syntax highlighter extension for your environment).

While this is true for most uses of JS script tags in LiveView, I can imagine there are valid usecases, and don’t see why the syntax highlighter shouldn’t support coloring correctly, so IMO a bug.

You folks likely want to report a bug/submit a PR here: GitHub - phoenixframework/tree-sitter-heex: HEEx grammer for Tree-sitter

3 Likes