Subject: Re: bug#67809: [PATCH] Add font-locking for assignments in typescript-ts-mode

From: Noah Peart <[email-masked]>
Date: Wed, 13 Dec 2023 11:26:55 -0800

I thought `font-lock-variable-name-face` was standard for assignments?
It's what is applied
in ruby-ts-mode, python-ts-mode, and c-ts-mode for example.  I like it
personally, cause
it allows for visual distinction between l/r values.

Either way, I think the patch can be simplified to only highlight the
variable being assigned
and not any others on the left-hand side.  It would be simpler and more
customizable
to highlight any remaining variables in a `variable` feature in a following
rule.

I noticed another issue where I forgot to handle `this.var = ` cases as
well. I could take
another stab at it unless there's no interest in this feature.

On Wed, Dec 13, 2023 at 10:31 AM Dmitry Gutov <[email-masked]> wrote:

> Hi!
>
> On 13/12/2023 10:33, Noah Peart wrote:
> >      arr[obj.x * obj.x] = 1;
> >      //^ font-lock-variable-name-face
> >      //    ^ font-lock-variable-use-face
> >      //      ^ font-lock-property-use-face
> >      obj.x.y = 0;
> >      //^ font-lock-variable-name-face
> >      //  ^ font-lock-property-name-face
> >      //    ^ font-lock-property-name-face
> >      ++mat[x][arr[0]];
> >      // ^ font-lock-variable-name-face
> >      //        ^ font-lock-variable-use-face
>
> I think in all of these cases font-lock-variable-name-face should not be
> used, since arr, and obj, and mat, are all introduced (declared) at a
> different place.
>
> font-lock-variable-use-face is more appropriate.
>