From: Jostein Kjønigsen Date: Mon, 2 Jan 2023 19:56:41 +0000 (+0100) Subject: Fontification improvements in typescript-ts-mode (bug#60500) X-Git-Tag: emacs-29.0.90~854 X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=dfdf9c21cbe7896d03da011773e636fc287d97db;p=emacs.git Fontification improvements in typescript-ts-mode (bug#60500) - 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: (typescript-ts-mode--font-lock-settings): Update rules. (typescript-ts-mode, tsx-ts-mode): Update feature list. --- diff --git a/lisp/progmodes/typescript-ts-mode.el b/lisp/progmodes/typescript-ts-mode.el index a0ba425b3e9..e0583f4b05c 100644 --- a/lisp/progmodes/typescript-ts-mode.el +++ b/lisp/progmodes/typescript-ts-mode.el @@ -167,6 +167,8 @@ Argument LANGUAGE is either `typescript' or `tsx'." (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 @@ Argument LANGUAGE is either `typescript' or `tsx'." (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 @@ Argument LANGUAGE is either `typescript' or `tsx'." 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 @@ Argument LANGUAGE is either `typescript' or `tsx'." 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 @@ -377,7 +375,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." '((comment declaration) (keyword string escape-sequence) (constant expression identifier number pattern property) - (bracket delimiter))) + (function bracket delimiter))) (treesit-major-mode-setup))) @@ -412,7 +410,7 @@ Argument LANGUAGE is either `typescript' or `tsx'." '((comment declaration) (keyword string escape-sequence) (constant expression identifier jsx number pattern property) - (bracket delimiter))) + (function bracket delimiter))) (treesit-major-mode-setup)))