GNU bug report logs - #70361
[PATCH] Add font-locking for operators in go-ts-mode.

Previous Next

Package: emacs;

Reported by: Noah Peart <noah.v.peart <at> gmail.com>

Date: Sat, 13 Apr 2024 05:24:03 UTC

Severity: normal

Tags: patch

Done: Yuan Fu <casouri <at> gmail.com>

Bug is archived. No further changes may be made.

Full log


Message #38 received at 70361 <at> debbugs.gnu.org (full text, mbox):

From: Yuan Fu <casouri <at> gmail.com>
To: Noah Peart <noah.v.peart <at> gmail.com>
Cc: 70361 <at> debbugs.gnu.org, eliz <at> gnu.org
Subject: Re: bug#70361: [PATCH] Add font-locking for operators in go-ts-mode.
Date: Mon, 15 Apr 2024 22:57:43 -0700
Noah Peart <noah.v.peart <at> gmail.com> writes:

> Thankyou, this all makes sense.  I do think it would be nice if it was easier to somehow 
> add user customizations to the font-locking, especially since it is so easy to write tree-sitter
> font-locking rules.

Right. We (well, I) were focusing on support for writing major modes and
didn’t give enough attention to the customization aspect, especially for
beginners.

>> We just don’t want a central tree-sitter-font-lock-feature-list that controls
> the feature list of every major mode in a single place.
>
> What would you think of something like a `user` feature that could be enabled
> globally and users could add their mode-specific rules there? Eg.
>
>     (defvar my-treesit-font-lock-rules
>       (treesit-font-lock-rules
>        :language 'go
>        :feature 'user
>        '((identifier))
>
>        :language 'typescript
>        :feature 'user
>        '((identifier))
>        ;; ...
>        ))
>
> This wouldn't work very well in certain cases where ordering of the rules
> was important, however.

I think that’s a good start. I like that it’s tied to each language
rather than a major mode, so it avoids problems with derived major
modes.

Indentation can also use some easy customization options.

On a separate note, something like this might be better off in a ELPA
package, such that it has more freedom to evolve and break things.
Things that are added to Emacs core tend to fossilize, or at least
become very hard to change. (To be precise, I mean the interface tend to
be hard to change, implementation details can and do change all the
time.)

I’d say that order wouldn’t be a problem since I imagine most of
tht time, the user wants their fontification override all else.

Yuan




This bug report was last modified 1 year and 33 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.