]> git.eshelyaron.com Git - emacs.git/commitdiff
Improve fontifications in Typescript mode
authorJostein Kjønigsen <jostein@kjonigsen.net>
Wed, 7 Dec 2022 08:27:42 +0000 (09:27 +0100)
committerEli Zaretskii <eliz@gnu.org>
Wed, 14 Dec 2022 19:00:58 +0000 (21:00 +0200)
* lisp/progmodes/typescript-ts-mode.el: Improve fontification of
variables.  (Bug#59831)

lisp/progmodes/typescript-ts-mode.el

index e4d188971a06dfc226f498052d4d6882fd3dbbb1..b8a921e9c246ac532ce3751520e9b5106974c146 100644 (file)
@@ -225,7 +225,31 @@ Argument LANGUAGE is either `typescript' or `tsx'."
      (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))
+     (arguments (identifier) @font-lock-variable-name-face)
+
+     (parenthesized_expression (identifier) @font-lock-variable-name-face)
+     (parenthesized_expression (_ (identifier)) @font-lock-variable-name-face))
+
+   :language language
+   :override t
+   :feature 'property
+   `((property_signature
+      name: (property_identifier) @font-lock-property-face)
+     (public_field_definition
+      name: (property_identifier) @font-lock-property-face)
+     (member_expression
+      object: (identifier) @font-lock-variable-name-face)
+     (member_expression
+      property: (_) @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)
+
+     ((shorthand_property_identifier_pattern)
+      @font-lock-property-face))
 
    :language language
    :override t
@@ -291,22 +315,8 @@ Argument LANGUAGE is either `typescript' or `tsx'."
    :override t
    '((escape_sequence) @font-lock-escape-face)
 
-   :language language
-   :override t
-   :feature 'property
-   `((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)
-
-     ((shorthand_property_identifier_pattern)
-      @font-lock-property-face))))
+   ))
 
 ;;;###autoload
 (add-to-list 'auto-mode-alist '("\\.ts\\'" . typescript-ts-mode))