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: Theodor Thornhill
Subject: Re: Disable tree-sitter font-locking for smaller ranges
Date: Tue, 18 Oct 2022 07:04:02 +0200


On 18 October 2022 02:20:02 CEST, Yuan Fu <casouri@gmail.com> wrote:
>
>
>> 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

Oh, right, thanks!

The separate variables was more for readability, but I can change that back :)

Theo



reply via email to

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