Open hochata opened 1 year ago
I agree :) but not sure how to approach this yet. We don't get much information from the tree-sitter-heex grammar as a directive ( embedded expressions ) might look like this:
(directive [1, 2] - [1, 19]
(partial_expression_value [1, 5] - [1, 16]))
....
(directive [3, 2] - [3, 11]
(ending_expression_value [3, 4] - [3, 8]))
where the directive neither encloses or reveals the content.
Another option would be to overlay elixir syntax on top of the heex syntax, but currently elixir-ts-mode requires heex-ts-mode, so then we fall into the circular dependency.
Unfortunately with the MELPA commit requirements we have to have 2 separate packages for these two modes, but we can combine elixir and heex-mode on emacs master ( only for emacs 30 ) and we can then overlay, but it will be at least a year from now, so will be nice to have an interim solution.
The option I am hoping for is to enhance the tree-sitter-heex grammar with enough information to apply some faces.
The option I am hoping for is to enhance the tree-sitter-heex grammar with enough information to apply some faces.
I think that is a good idea. To move all the common code (like queries and indentation rules) from elixir-ts-mode
and heex-ts-mode
into a common elixit-ts-base
file so there are no cyclic depedencies.
Could we do something like injecting the elixir grammar into the enclosed regions? From what I know injecting grammars into ranges is pretty common in the tree-sitter world, and last I checked it is supported in Emacs' tree-sitter (treesit) implementation as well.
We can probably do something like this here. Neovim is able to take advantage of these injections.scm
files, and I'm hopeful we can reproduce this (to the best of treesit's current capabilities) inside Emacs.
https://github.com/phoenixframework/tree-sitter-heex/blob/main/queries/injections.scm
I pull request would be welcome, I won't be able to work on this in the near future.
I'll try my hand at it then!
Hi!
Currently, code in
<%= "embedded expressions" >
gets the default face. It would be nice to have Elixir syntax highlight in those blocks.