Extending injections for first and third party syntax extensions?


Before tree-sitter I had this feature request which is now sort of technically possible to implement.

But is there a way for us to extend the injections for the core syntaxes as well as the third party syntaxes?

To give an example, please consider this:

<div x-data="javascript">

In Neovim you can just extend the html injections, and add your own on the top it. Of course that editor is very customisable, and requires each user getting their hands dirty, changing the queries in the tree-sitter-html folder manually.

Here is an example for, how one can add that injection support that works across the board.

;; extends

; AlpineJS attributes
  (attribute_name) @_attr
    (#lua-match? @_attr "^x%-%l")
    (attribute_value) @injection.content)
  (#set! injection.language "javascript"))

Correct me if I am wrong, but reading the documentations, I don’t think this is currently possibly? there is no way for us to tell Nova, the injection.scm written in Queries/ folder for this extension, is for html syntax or any other languages.

So in summary, basically what I ideally want to be able to do is the following in the AlpineJS extension which is a "completion extension "and NOT a “syntax extension”:

  1. write a injection.scm into my Queries/ folder
  2. Somehow tell Nova, “extend the injections for the html files with the injection.scm (or any other syntaxes)”