diff options
| author | Jostein Kjønigsen | 2022-12-05 09:31:58 +0100 |
|---|---|---|
| committer | Yuan Fu | 2022-12-05 12:27:25 -0800 |
| commit | 318bf42b410d4a8ecf0e8ff64280cfd655884877 (patch) | |
| tree | e8c7d3400bc7f64b69e2edc8b04bfc1074e82fed | |
| parent | 64271bbb7d9066080ea1e8dbae72beed979350e6 (diff) | |
| download | emacs-318bf42b410d4a8ecf0e8ff64280cfd655884877.tar.gz emacs-318bf42b410d4a8ecf0e8ff64280cfd655884877.zip | |
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.
| -rw-r--r-- | lisp/progmodes/typescript-ts-mode.el | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 48ac1169fe8..3da690567e2 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el | |||
| @@ -213,7 +213,14 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 213 | parameters: | 213 | parameters: |
| 214 | [(_ (identifier) @font-lock-variable-name-face) | 214 | [(_ (identifier) @font-lock-variable-name-face) |
| 215 | (_ (_ (identifier) @font-lock-variable-name-face)) | 215 | (_ (_ (identifier) @font-lock-variable-name-face)) |
| 216 | (_ (_ (_ (identifier) @font-lock-variable-name-face)))])) | 216 | (_ (_ (_ (identifier) @font-lock-variable-name-face)))]) |
| 217 | |||
| 218 | (return_statement (identifier) @font-lock-variable-name-face) | ||
| 219 | |||
| 220 | (binary_expression left: (identifier) @font-lock-variable-name-face) | ||
| 221 | (binary_expression right: (identifier) @font-lock-variable-name-face) | ||
| 222 | |||
| 223 | (arguments (identifier) @font-lock-variable-name-face)) | ||
| 217 | 224 | ||
| 218 | :language language | 225 | :language language |
| 219 | :override t | 226 | :override t |
| @@ -282,7 +289,14 @@ Argument LANGUAGE is either `typescript' or `tsx'." | |||
| 282 | :language language | 289 | :language language |
| 283 | :override t | 290 | :override t |
| 284 | :feature 'property | 291 | :feature 'property |
| 285 | `((pair value: (identifier) @font-lock-variable-name-face) | 292 | `((property_signature |
| 293 | name: (property_identifier) @font-lock-property-face) | ||
| 294 | (public_field_definition | ||
| 295 | name: (property_identifier) @font-lock-property-face) | ||
| 296 | |||
| 297 | (pair key: (property_identifier) @font-lock-variable-name-face) | ||
| 298 | |||
| 299 | (pair value: (identifier) @font-lock-variable-name-face) | ||
| 286 | 300 | ||
| 287 | ((shorthand_property_identifier) @font-lock-property-face) | 301 | ((shorthand_property_identifier) @font-lock-property-face) |
| 288 | 302 | ||