]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve fontification of typescript-ts-mode (bug#59831)
authorJostein Kjønigsen <jostein@kjonigsen.net>
Mon, 5 Dec 2022 08:31:58 +0000 (09:31 +0100)
committerYuan Fu <casouri@gmail.com>
Mon, 5 Dec 2022 20:27:25 +0000 (12:27 -0800)
- 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.

lisp/progmodes/typescript-ts-mode.el

index 48ac1169fe80baa6bff912d42faa97bca953d051..3da690567e2c4eea1c7d76c5af0664110a88893e 100644 (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)