Subject: Re: bug#70361: [PATCH] Add font-locking for operators in go-ts-mode.

From: Yuan Fu <[email-masked]>
Date: Sun, 14 Apr 2024 16:25:54 -0700

Eli Zaretskii <[email-masked]> writes:

>> From: Noah Peart <[email-masked]>
>> Date: Sat, 13 Apr 2024 00:53:45 -0700
>> Cc: Yuan Fu <[email-masked]>, [email-masked]
>> 
>> > What problems do you see with the current approach that would require
>> more fine-grained user control?
>> 
>> The main issue for me is removing the `error` feature from any mode
>> that adds it with `:override t`. I find the override font-locking is jarring - in some
>> Languages half the buffer can switch in and out of parse errors when you
>> do something as simple as removing a closing paren.
>
> Maybe we should have a user option to turn error feature on and off.
> Yuan, WDYT?

Sure, I’m not a big advocate for highlighting the errors to begin with.
The tree-sitter parse errors aren’t meant to be used for highlighting
anyway. This is just something some major mode provides because it’s a
nice bonus, and it’s effectiveness probably varies by language grammar.

The user can turn off error feature with
treesit-font-lock-recompute-features, like they do for any other
features. Do we want to add a user option in addition? In any case, even
if we add such user option, it should be added at the major mode level,
since the error feature is at major mode level, it isn’t something
provided uniformly across all tree-sitter modes.

>> Also, allowing users to rearrange features at different levels seems like a bonus.
>
> Not sure about this one.  We didn't have that in the traditional
> font-lock, did we?

If major modes define a xxx-mode-feature-list, sure, the user can
redefine that list to their liking. Again that’s a major mode level
decision.

I CC’ed Randy since he’s the maintainer of go-ts-mode.

Yuan