helix-mods/runtime/queries/heex/injections.scm
Michael Davis 4836bb38d3 add tree-sitter-heex
HEEx is a templating engine on top of Elixir's EEx templating
language specific to HTML that is included in Phoenix.LiveView
(though I think the plan is to eventually include it in base
Phoenix). It's a superset of EEx with some additional features
like components and slots.

The injections don't work perfectly because the Elixir grammar is
newline sensitive (the _terminator rule). See
https://github.com/elixir-lang/tree-sitter-elixir/issues/24
for more information.
2022-04-13 14:28:51 +09:00

22 lines
908 B
Scheme

; https://github.com/connorlay/tree-sitter-heex/blob/592e22292a367312c35e13de7fdb888f029981d6/queries/injections.scm
; directives are standalone tags like '<%= @x %>'
;
; partial_expression_values are elixir code that is part of an expression that
; spans multiple directive nodes, so they must be combined. For example:
; <%= if true do %>
; <p>hello, tree-sitter!</p>
; <% end %>
((directive (partial_expression_value) @injection.content)
(#set! injection.language "elixir")
(#set! injection.include-children)
(#set! injection.combined))
; Regular expression_values do not need to be combined
((directive (expression_value) @injection.content)
(#set! injection.language "elixir"))
; expressions live within HTML tags, and do not need to be combined
; <link href={ Routes.static_path(..) } />
((expression (expression_value) @injection.content)
(#set! injection.language "elixir"))