Improve fontification of typescript-ts-mode (bug#59831)

- Highlight property and field definitions in class declaration.
- Highlight property-keys in object initializaters.
- Highlight variable-names in function/method return-statements.

* lisp/progmodes/typescript-ts-mode.el
(typescript-ts-mode--font-lock-settings): Add fontification rules.
This commit is contained in:
Jostein Kjønigsen 2022-12-05 09:31:58 +01:00 committed by Yuan Fu
parent 64271bbb7d
commit 318bf42b41
No known key found for this signature in database
GPG key ID: 56E19BC57664A442

View file

@ -213,7 +213,14 @@ Argument LANGUAGE is either `typescript' or `tsx'."
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)
(binary_expression left: (identifier) @font-lock-variable-name-face)
(binary_expression right: (identifier) @font-lock-variable-name-face)
(arguments (identifier) @font-lock-variable-name-face))
:language language
:override t
@ -282,7 +289,14 @@ Argument LANGUAGE is either `typescript' or `tsx'."
: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)