[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-nam
From: |
Eli Zaretskii |
Subject: |
bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly |
Date: |
Tue, 29 Nov 2022 14:10:19 +0200 |
> Cc: 59660@debbugs.gnu.org, theo@thornhill.no
> From: Yuan Fu <casouri@gmail.com>
> Date: Mon, 28 Nov 2022 15:06:30 -0800
>
> > 1. create a typescript file (sample.ts)
> > 2. create class and add some methods to it.
> >
> > I observe that:
> >
> > - method names are consistently fontified as font-lock-property-face.
> >
> > I expected that:
> >
> > - method names to be consistently fontified as font-luck-function-name-face.
> >
> > This seems to be because of the "property_identifier" is used for
> > functions in the treesitter-grammar, and this property is used
> > indiscriminately to apply font-lock-property-face at the bottom of the
> > major-mode grammar.
> >
> > This "shadows" the former rules which correctly apply
> > font-lock-function-name-face.
> >
> > The best would obviously have a way to identify properties more accurately,
> > to precent
> > shadowing from taking place. Unfortunately I cannot see a realiable way to
> > do that
> > based on the current parse-tree.
> >
> > Seeing as properties in Typescript are fairly rare while methods are very
> > common,
> > it seems appropriate to me to remove the property-specific fontification
> > rules
> > to restore the method-fontification rules.
> >
> > I got a patch for this ready, if people are willing to accept it.
>
> Maybe you can remove the :override flag for the property_identifier rule, so
> it doesn’t shadow the function rule? Would that work better?
This could be a personal preference, perhaps? It isn't clear to me that
only one of the two is definitely correct. So maybe we need a user option
for which one overrides which?
bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly, Yuan Fu, 2022/11/28
- bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly,
Eli Zaretskii <=
- bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly, Jostein Kjønigsen, 2022/11/29
- bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly, Eli Zaretskii, 2022/11/29
- bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly, Theodor Thornhill, 2022/11/29
- bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly, Jostein Kjønigsen, 2022/11/29
- bug#59660: 29.0.50; typescript-ts-mode consistently fontifies method-names incorrectly, Theodor Thornhill, 2022/11/29