From f2f79b2bde2147fd0febddea696ab43bcc257b96 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= Date: Wed, 7 Dec 2022 09:27:42 +0100 Subject: [PATCH] lisp/progmodes/typescript-ts-mode.el: Improve fontification of variables --- lisp/progmodes/typescript-ts-mode.el | 42 +++++++++++++++++----------- 1 file changed, 26 insertions(+), 16 deletions(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index 3da690567e2..fc2f746a0f4 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -220,7 +220,31 @@ typescript-ts-mode--font-lock-settings (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 @@ -286,22 +310,8 @@ typescript-ts-mode--font-lock-settings :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)) -- 2.37.2