emacs-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Disable tree-sitter font-locking for smaller ranges


From: Trey Peacock
Subject: Re: Disable tree-sitter font-locking for smaller ranges
Date: Tue, 18 Oct 2022 01:23:09 +0000

"Yuan Fu" <casouri@gmail.com> writes:

> Actually, thinking more of it, it working relies on the exact order of which 
> these rules are applied:
> 1. Outer template_string
> 2. Outer template_substitution
> 3. Inner template_string
> 4. Inner template_substitution
>

If it's useful, I believe the reason why the queries you were using
didn't work was because you were using the alternation which only allows
for selecting a single option. This should work, regardless of the
order:

(template_substitution
 "${" @font-lock-constant-face
 "}" @font-lock-constant-face) @default
(escape_sequence) @font-lock-constant-face
(template_string) @font-lock-string-face

However, I am unsure how to address potentially nested template
substitutions. Perhaps a function could assist in that.

Trey




reply via email to

[Prev in Thread] Current Thread [Next in Thread]