Subject: Re: bug#61655: [Tree sitter] [Feature Request] font-lock function calls, definitions, separately

From: Randy Taylor <[email-masked]>
Date: Sat, 25 Feb 2023 01:06:02 +0000

On Thursday, February 23rd, 2023 at 21:31, Dmitry Gutov <[email-masked]> wrote:
> 
> On 23/02/2023 20:15, Eli Zaretskii wrote:
> 
> > > Cc:[email-masked]
> > > Date: Wed, 22 Feb 2023 23:38:04 +0200
> > > From: Dmitry [email-masked]
> > > 
> > > On 22/02/2023 22:45, Yuan Fu wrote:
> > > 
> > > > Yeah that’s just an idea, and I don’t have problem adding faces. But we probably can’t keep adding more and more specific faces. At one point we’ll need to either add indirection, or ask users to just add their own fontification rules, if it is really specific. We’ll see.
> > > > An indirection seems like a separate new feature. Might be useful for
> > > > some, but probably unnecessary for this discussion.
> > > 
> > > > Function definition & call is totally reasonable. But adapting all the major modes to use them is might be too big a change for emacs-29.
> > > > The change itself should be very straightforward. If we agree on the set
> > > > of faces (for variables and properties as well, right?), I don't mind
> > > > posting a patch for review.
> > > 
> > > Whether it gets accepted or not.
> > > I'm okay with adding a few more faces to emacs-29, but please hurry,
> > > as we don't have too much time for more additions.
> 
> 
> Here's the patch which adds the faces and their uses in all ts modes.
> 
> Comments welcome from all the interested parties. The patch is mostly
> straightforward, but there are some changes added as well, where it was
> needed to differentiate between declarations and references.
> 
> The important question here, I think, is whether we want to split
> font-lock-property-faces in two, like I did here.
> 
> By analogy with the other faces, I think it's going to be useful to
> differentiate between property definitions and property references. Not
> many of the languages modes used font-lock-property-face for
> property/attribute definitions, but some did.

I'm not sure about the naming of font-lock-variable-ref-face. It's confusing for languages that support actual references like C++ and Rust.

Maybe the opposite direction is better: font-lock-variable-def-face (or something similar) for definitions (or whatnot), and font-lock-variable-name-face to refer to uses (same goes for property). Or font-lock-variable-use-face. I don't know, naming is hard :).

Personally, I don't really see the value in differentiating these for variables. I can understand it a little more for properties. But I guess it doesn't hurt to add if folks want it.