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

From: Juri Linkov <[email-masked]>
Date: Fri, 18 Apr 2025 19:52:54 +0300

>> 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.
>
> Thanks for this. I kind of forgot about it, sorry about that. It would be
> great if that is possible, but I don't know how that would work though?

Ok, now I added elixir embedding in heex, as well as
elixir->heex->elixir that e.g. highlights '@entries' in:

  def unordered_list(assigns) do
    ~H"""
    <ul>
      <li :for={entry <- @entries}>{render_slot(@inner_block, entry)}</li>
    </ul>
    """
  end

that works well.