Subject: bug#60500: Acknowledgement (29.0.60; typescript-ts-mode and tsx-ts-mode has inconsistent features/fontification wrt other ts major-modes)

From: Jostein Kjønigsen <[email-masked]>
Date: Mon, 2 Jan 2023 21:12:35 +0100

Previous patch was incomplete and only introduced the new feature on one 
of the major-modes.

This latest patch introduces it on both and should be good.

--
Jostein

From 6a713726a5f00e49f2fb9e87443a304b85dabf50 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
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 | 22 ++++++++++------------
 1 file changed, 10 insertions(+), 12 deletions(-)

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 @@ 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
@@ -377,7 +375,7 @@ typescript-ts-mode
                 '((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 @@ 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