all messages for Emacs-related lists mirrored at yhetil.org
 help / color / mirror / code / Atom feed
From: Wilhelm Hugo Kirschbaum <wilhelm@floatpays.co.za>
To: Yuan Fu <casouri@gmail.com>
Cc: emacs-devel@gnu.org
Subject: Re: Tree-sitter, using treesit-range-rules for embedded languages
Date: Tue, 22 Nov 2022 21:52:45 +0200	[thread overview]
Message-ID: <93179658.VN8fuaoyE4@melissa.local> (raw)
In-Reply-To: <158606F8-9A2E-4630-A441-2BEAA07EB137@gmail.com>

On Tuesday, 22 November 2022 21:28:48 SAST Yuan Fu wrote:
> > On Nov 22, 2022, at 9:24 AM, Wilhelm <wkirschbaum@gmail.com> wrote:
> > 
> > Is there perhaps an example using treesit-range-rules? To following
> > attempt to set treesit-range-settings does not seem to have the desired
> > effect.
> > 
> > (defvar heex--treesit-range-rules
> > 
> >  (treesit-range-rules
> >  
> >   :embed 'elixir
> >   :host 'heex
> >   
> >   '((directive (partial_expression_value) @cap)
> >   
> >     (directive (expression_value) @cap)
> >     (expression (expression_value) @cap))))
> > 
> > (setq-local treesit-range-settings heex--treesit-range-rules)
> > 
> > The following error also pops up when modifying the buffer when removing
> > buffer content:
> > 
> > Error during redisplay: (jit-lock-function 1) signaled
> > (treesit-range-invalid "RANGE is either overlapping, out-of-order or
> > out-of-range" ((11 . 20)))
> > 
> > The full attempt is here:
> > https://github.com/wkirschbaum/elixir-mode/blob/main/heex-mode.el
> Thanks Wilhelm. It would be nice if you can provide some example source file
> of heex for me to experiment with. I tried to find some on the internet but
> didn’t get very far :-)
> 
> Yuan

Thanks for having a look as I was not sure if this was meant to be used yet. 

A heex file can be as simple as this: 

#sample.html.heex
<div>
  <%= Enum.map([1, 2], &(&1 + 1)) %>
</div>

and the directive <%= (partial_expression_value) %> should then be elixir., 
not heex.

When checking with (treesit-language-at (point))  for the embed it still show.

Wilhelm





  reply	other threads:[~2022-11-22 19:52 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-11-22 17:24 Tree-sitter, using treesit-range-rules for embedded languages Wilhelm
2022-11-22 19:28 ` Yuan Fu
2022-11-22 19:52   ` Wilhelm Hugo Kirschbaum [this message]
2022-11-22 20:39     ` Yuan Fu
2022-11-23  7:12       ` Wilhelm Kirschbaum

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=93179658.VN8fuaoyE4@melissa.local \
    --to=wilhelm@floatpays.co.za \
    --cc=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this external index

	https://git.savannah.gnu.org/cgit/emacs.git
	https://git.savannah.gnu.org/cgit/emacs/org-mode.git

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.