unofficial mirror of emacs-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: Yuan Fu <casouri@gmail.com>
To: Theodor Thornhill <theo@thornhill.no>
Cc: emacs-devel@gnu.org
Subject: Re: Disable tree-sitter font-locking for smaller ranges
Date: Mon, 17 Oct 2022 17:20:02 -0700	[thread overview]
Message-ID: <5759ADC4-835D-431C-9E68-CCAD1D6B8274@gmail.com> (raw)
In-Reply-To: <87o7uazpat.fsf@thornhill.no>



> On Oct 17, 2022, at 4:02 AM, Theodor Thornhill <theo@thornhill.no> wrote:
> 
>>> BTW, if you have time and energy, could you look into separating the
>>> queries into roughly three levels: minimum, moderate, and full
>>> fontification, and mark each with the new :feature flag? Or even
>>> better, separate them into different features (as suggested in the
>>> docstring of treesit-font-lock-feature-list).
>>> 
>> 
>> I will do that promptly and attach patches for ts-mode and js-mode to
>> this thread.
>> 
>> Theo
> 
> 
> See attached patch :-)

Thanks! I think you have a bit of misunderstanding of the :feature flag. You should only need to change

(defvar xxx-font-lock-settings
  (treesit-font-lock-rules
   :language 'xxx
   '(1111111111111
     2222222222222
     3333333333333)))

to

(defvar xxx-font-lock-settings
  (treesit-font-lock-rules
   :language 'xxx
   :feature 'minimum
   '(1111111111111)
   :language 'xxx
   :feature 'moderate
   '(2222222222222)
   :language 'xxx
   :feature 'full
   '(3333333333333)))

Ie, no need to create separate variables. And you should set treesit-font-lock-feature-list to

(setq treesit-font-lock-feature-list
      '((minimum) (moderate) (full)))

Yuan


  reply	other threads:[~2022-10-18  0:20 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-10-16 10:32 Disable tree-sitter font-locking for smaller ranges Theodor Thornhill
2022-10-17  5:04 ` Yuan Fu
2022-10-17  5:49   ` Theodor Thornhill
2022-10-17  6:01     ` Yuan Fu
2022-10-17  6:33       ` Theodor Thornhill
2022-10-17  9:00         ` Yuan Fu
2022-10-17  9:41           ` Theodor Thornhill
2022-10-17 11:02             ` Theodor Thornhill via Emacs development discussions.
2022-10-18  0:20               ` Yuan Fu [this message]
2022-10-18  5:04                 ` Theodor Thornhill
2022-10-18 20:07                   ` Theodor Thornhill
2022-10-18 20:44                     ` Yuan Fu
2022-10-18  5:06             ` Yuan Fu
2022-10-18  1:23           ` Trey Peacock

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

  List information: https://www.gnu.org/software/emacs/

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

  git send-email \
    --in-reply-to=5759ADC4-835D-431C-9E68-CCAD1D6B8274@gmail.com \
    --to=casouri@gmail.com \
    --cc=emacs-devel@gnu.org \
    --cc=theo@thornhill.no \
    /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 public inbox

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

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).