Subject: Re: bug#59657: (29.0.50; lisp/progrmodes/csharp-mode.el: fontification of common constructs missing)

From: Jostein Kjønigsen <[email-masked]>
Date: Mon, 28 Nov 2022 13:38:36 +0100

Attached are a few patches for the issues found so far.

Kind Regards.
*Jostein Kjønigsen*

[email-masked] 🍵 [email-masked]
https://jostein.kjønigsen.no <https://jostein.kjønigsen.no>

-------- Forwarded Message --------
Subject: 	bug#59657: Acknowledgement (29.0.50; 
lisp/progrmodes/csharp-mode.el: fontification of common constructs missing)
Date: 	Mon, 28 Nov 2022 12:23:01 +0000
From: 	GNU bug Tracking System <[email-masked]>
Reply-To: 	[email-masked]
To: 	[email-masked]

Thank you for filing a new bug report with debbugs.gnu.org.

This is an automatically generated reply to let you know your message
has been received.

Your message is being forwarded to the package maintainers and other
interested parties for their attention; they will reply in due course.

Your message has been sent to the package maintainer(s):
[email-masked]

If you wish to submit further information on this problem, please
send it to [email-masked].

Please do not send mail to [email-masked] unless you wish
to report a problem with the Bug-tracking system.

-- 
59657:https://debbugs.gnu.org/cgi/bugreport.cgi?bug=59657
GNU Bug Tracking System
[email-masked]  with problems
From 0cd8453b34c176feada25fcf01ece5fbd0453c01 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
Date: Mon, 28 Nov 2022 13:06:03 +0100
Subject: [PATCH 1/3] lisp/progmodes/csharp-mode.el: Better fontification for
 variables

---
 lisp/progmodes/csharp-mode.el | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 6712fcc57e2..006b3fba26e 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -793,7 +793,10 @@ csharp-ts-mode--font-lock-settings
      (variable_declarator (identifier) @font-lock-variable-name-face)
 
      (parameter type: (identifier) @font-lock-type-face)
-     (parameter name: (identifier) @font-lock-variable-name-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 'expression
    '((conditional_expression (identifier) @font-lock-variable-name-face)
-- 
2.37.2

From 9e5f238b532ee377259dbd3f25f2ec9ced6929f6 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
Date: Mon, 28 Nov 2022 13:09:58 +0100
Subject: [PATCH 2/3] lisp/progmodes/csharp-mode.el: fontify type-names in
 new-expressions.

---
 lisp/progmodes/csharp-mode.el | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 006b3fba26e..48da6035dc7 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -743,7 +743,8 @@ csharp-ts-mode--font-lock-settings
      ["operator"] @font-lock-type-face
      (type_parameter_constraints_clause
       target: (identifier) @font-lock-type-face)
-     (type_of_expression (identifier) @font-lock-type-face))
+     (type_of_expression (identifier) @font-lock-type-face)
+     (object_creation_expression (identifier) @font-lock-type-face))
    :language 'c-sharp
    :feature 'definition
    :override t
-- 
2.37.2

From ed93f2feed488268cbdeaf017c66aca39915759f Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
Date: Mon, 28 Nov 2022 13:16:25 +0100
Subject: [PATCH 3/3] lisp/progmodes/csharp-mode.el: Improve fontification for
 catch-statements.

---
 lisp/progmodes/csharp-mode.el | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 48da6035dc7..3da3079f089 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -790,6 +790,12 @@ csharp-ts-mode--font-lock-settings
      (invocation_expression
       (member_access_expression (identifier) @font-lock-function-name-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)
 
-- 
2.37.2