[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields a
From: |
Theodor Thornhill |
Subject: |
bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified |
Date: |
Mon, 05 Dec 2022 09:51:55 +0100 |
Jostein Kjønigsen <jostein@secure.kjonigsen.net> writes:
> When I create or use a class in a Typescript-file, I often have
> properties and field declarations.
>
> These are all fontified using default-face, instead of
> font-lock-property-face.
>
> Also when creating new objects using bracket syntac { key: value, key:
> value, etc: etc }, default-face is used.
>
> Attached is a patch which improves fontification of these aspects in
> both typescript-ts-mode and typescript-tsx-mode.
>
> It also contains code to further improve fontification of
> retuen-statements, which IMO is a little bit lacking.
>
LGTM :) Yuan, feel free to apply when you have some free time!
> From 3bcbd89cc43c6ad7885f11aa4c7c92ebd600a164 Mon Sep 17 00:00:00 2001
> From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <jostein@kjonigsen.net>
> Date: Mon, 5 Dec 2022 09:31:58 +0100
> Subject: [PATCH] lisp/progmodes/typescript-ts-mode: improve fontification
>
> - syntax-highlight property and field definitions in class declaration.
> - syntax-highlight property-keys in object initializaters.
> - syntax-highlight variable-names in function/method return-statements.
> ---
> lisp/progmodes/typescript-ts-mode.el | 13 +++++++++++--
> 1 file changed, 11 insertions(+), 2 deletions(-)
>
> diff --git a/lisp/progmodes/typescript-ts-mode.el
> b/lisp/progmodes/typescript-ts-mode.el
> index 48ac1169fe8..48d3c084b6e 100644
> --- a/lisp/progmodes/typescript-ts-mode.el
> +++ b/lisp/progmodes/typescript-ts-mode.el
> @@ -213,7 +213,9 @@ typescript-ts-mode--font-lock-settings
> parameters:
> [(_ (identifier) @font-lock-variable-name-face)
> (_ (_ (identifier) @font-lock-variable-name-face))
> - (_ (_ (_ (identifier) @font-lock-variable-name-face)))]))
> + (_ (_ (_ (identifier) @font-lock-variable-name-face)))])
> +
> + (return_statement (identifier) @font-lock-variable-name-face))
>
> :language language
> :override t
> @@ -282,7 +284,14 @@ typescript-ts-mode--font-lock-settings
> :language language
> :override t
> :feature 'property
> - `((pair value: (identifier) @font-lock-variable-name-face)
> + `((property_signature
> + name: (property_identifier) @font-lock-property-face)
> + (public_field_definition
> + name: (property_identifier) @font-lock-property-face)
> +
> + (pair key: (property_identifier) @font-lock-variable-name-face)
> +
> + (pair value: (identifier) @font-lock-variable-name-face)
>
> ((shorthand_property_identifier) @font-lock-property-face)
>
Thanks!
Theo
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Jostein Kjønigsen, 2022/12/05
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified,
Theodor Thornhill <=
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Jostein Kjønigsen, 2022/12/05
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Theodor Thornhill, 2022/12/05
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Yuan Fu, 2022/12/05
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Jostein Kjønigsen, 2022/12/07
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Theodor Thornhill, 2022/12/07
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Jostein Kjønigsen, 2022/12/07
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Jostein Kjønigsen, 2022/12/12
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Jostein Kjønigsen, 2022/12/14
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Eli Zaretskii, 2022/12/14
- bug#59831: 29.0.60; typescript-ts-mode: Variables, properties & fields are often not fontified, Yuan Fu, 2022/12/14