Subject: Re: bug#60376: 29.0.60; Standardize csharp-ts-mode's font-lock features

From: Jostein Kjønigsen <[email-masked]>
Date: Sun, 1 Jan 2023 17:29:19 +0100

On 31.12.2022 23:21, Yuan Fu wrote:
> I applied it, thanks!
> Yuan

Following up this case, attached is a patch which from what I can tell 
movies function invocation fontification to level 4, without any other 
regressions.

Theo: Care to take it for a spin? Does it look OK by you?

--
Jostein
From bdb70bba35aa1fe36f5bb66e880289cfcfe3b339 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
Date: Sun, 1 Jan 2023 17:27:06 +0100
Subject: [PATCH] lisp/progmodes/csharp-mode.el: adjust function-call
 fontification

---
 lisp/progmodes/csharp-mode.el | 40 ++++++++++++++++++-----------------
 1 file changed, 21 insertions(+), 19 deletions(-)

diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index da64daf9848..68eb9dea7f0 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -810,7 +810,25 @@ csharp-ts-mode--font-lock-settings
      (method_declaration type: (_) @font-lock-type-face)
      (method_declaration name: (_) @font-lock-function-name-face)
 
-     (invocation_expression
+     (catch_declaration
+      ((identifier) @font-lock-type-face))
+     (catch_declaration
+      ((identifier) @font-lock-type-face
+       (identifier) @font-lock-variable-name-face))
+
+     (variable_declaration (identifier) @font-lock-type-face)
+     (variable_declarator (identifier) @font-lock-variable-name-face)
+
+     (parameter type: (identifier) @font-lock-type-face)
+     (parameter name: (identifier) @font-lock-variable-name-face)
+
+     (binary_expression (identifier) @font-lock-variable-name-face)
+     (argument (identifier) @font-lock-variable-name-face))
+
+   :language 'c-sharp
+   :feature 'function
+   :override t
+   '((invocation_expression
       (member_access_expression
        (generic_name (identifier) @font-lock-function-name-face)))
      (invocation_expression
@@ -827,23 +845,7 @@ csharp-ts-mode--font-lock-settings
                  (generic_name (type_argument_list
                                 ["<"] @font-lock-bracket-face
                                 (identifier) @font-lock-type-face
-                                [">"] @font-lock-bracket-face)
-                               )])
-
-     (catch_declaration
-      ((identifier) @font-lock-type-face))
-     (catch_declaration
-      ((identifier) @font-lock-type-face
-       (identifier) @font-lock-variable-name-face))
-
-     (variable_declaration (identifier) @font-lock-type-face)
-     (variable_declarator (identifier) @font-lock-variable-name-face)
-
-     (parameter type: (identifier) @font-lock-type-face)
-     (parameter name: (identifier) @font-lock-variable-name-face)
-
-     (binary_expression (identifier) @font-lock-variable-name-face)
-     (argument (identifier) @font-lock-variable-name-face))
+                                [">"] @font-lock-bracket-face))]))
 
    :language 'c-sharp
    :feature 'escape-sequence
@@ -916,7 +918,7 @@ csharp-ts-mode
               '(( comment definition)
                 ( keyword string type)
                 ( constant escape-sequence expression literal property)
-                ( bracket delimiter error)))
+                ( function bracket delimiter error)))
 
   ;; Imenu.
   (setq-local treesit-simple-imenu-settings
-- 
2.37.2