From 1366beb59c18c2e2c125bfff5d5f26d97059cbb4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= Date: Mon, 2 Jan 2023 20:56:41 +0100 Subject: [PATCH 2/2] lisp/progmodes/typescript-ts-mode.el: fontification improvements. - highlight method-definitins in interfaces. - only highlight variable-declarations, not variables everywhere (consistency with other modes). - move highlighting of method invocations to level 4 --- lisp/progmodes/typescript-ts-mode.el | 20 +++++++++----------- 1 file changed, 9 insertions(+), 11 deletions(-) diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index a0ba425b3e9..7e064d20f25 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -167,6 +167,8 @@ typescript-ts-mode--font-lock-settings (method_definition name: (property_identifier) @font-lock-function-name-face) + (method_signature + name: (property_identifier) @font-lock-function-name-face) (required_parameter (identifier) @font-lock-variable-name-face) (optional_parameter (identifier) @font-lock-variable-name-face) @@ -211,10 +213,8 @@ typescript-ts-mode--font-lock-settings (enum_assignment name: (property_identifier) @font-lock-type-face) - (assignment_expression - left: [(identifier) @font-lock-variable-name-face - (member_expression - property: (property_identifier) @font-lock-variable-name-face)]) + (variable_declarator + name: (identifier) @font-lock-variable-name-face) (for_in_statement left: (identifier) @font-lock-variable-name-face) @@ -242,10 +242,6 @@ typescript-ts-mode--font-lock-settings 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) @@ -263,9 +259,11 @@ typescript-ts-mode--font-lock-settings left: [(identifier) @font-lock-function-name-face (member_expression property: (property_identifier) @font-lock-function-name-face)] - right: [(function) (arrow_function)]) + right: [(function) (arrow_function)])) - (call_expression + :language language + :feature 'function + '((call_expression function: [(identifier) @font-lock-function-name-face (member_expression @@ -412,7 +410,7 @@ tsx-ts-mode '((comment declaration) (keyword string escape-sequence) (constant expression identifier jsx number pattern property) - (bracket delimiter))) + (function bracket delimiter))) (treesit-major-mode-setup))) -- 2.37.2