Subject: Re: bug#76788: treesit-thing-settings for elixir-ts-mode

From: Juri Linkov <[email-masked]>
Date: Thu, 10 Apr 2025 19:35:03 +0300

close 76788 31.0.50
thanks

On Mon, Mar 10 2025, Wilhelm Kirschbaum wrote:

> I will have a look at this early this week. The forward-sexp was added very
> early, so there is perhaps a better way now.

Indeed, there is a better way now, so I adapted it.

BTW, I was a surprise that only elixir can embed heex,
but not vice versa.  So I tried to embed elixir in heex
using injections.scm queries from tree-sitter-heex repo:

#+begin_src emacs-lisp
(define-derived-mode heex-ts-mode html-mode "HEEx"
  ...
  (setq-local treesit-range-settings
              (treesit-range-rules
               :embed 'elixir
               :host 'heex
               '((directive [(partial_expression_value)
                             (ending_expression_value)]
                            @cap))

               :embed 'elixir
               :host 'heex
               :local t
               '((directive (expression_value) @cap)
                 (expression (expression_value) @cap))))
#+end_src

together with combined treesit-font-lock-settings/feature-list.
And these ranges work nicely only separately, but not when combined.
So need to investigate more.  Maybe will create a new report.