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

From: Jostein Kjønigsen <[email-masked]>
Date: Mon, 2 Jan 2023 10:59:39 +0100

On 02.01.2023 01:12, Yuan Fu wrote:
> Fantastic! I applied the patch, thanks!
>
> Yuan

Great! Thanks!

Please note: The previous patch removed a very wide (generic_name 
(identifier)) selector, which incorrectly caused generic functions to be 
highlighted as a types.

This has lead to having to add in more specific (xxx (generic_name 
(identifier)) selectors around the codebase to compensate, and the 
previous patch evidently didn't have "all" the ones we need.

Attached is a very small patch which should make support for 
highlighting generic types more complete. I won't promise it has 100% 
coverage, but with this in place, I can't see any obvious places in code 
where I'm missing out.

With this in place, the only thing I'd like to improve now (if any) is 
indentation for object-creation/initialization expressions. I've made a 
few attempts and can't get those to behave properly.

Is this anything you could take a look at, Theo? :)

--
Jostein
From 77325442de2b3d2d6d4ffc4223e00c0a956cf256 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jostein=20Kj=C3=B8nigsen?= <[email-masked]>
Date: Sun, 1 Jan 2023 20:46:02 +0100
Subject: [PATCH] Further generic-related improvements.

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

diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
index 473e8f49fd3..79afd7f91dc 100644
--- a/lisp/progmodes/csharp-mode.el
+++ b/lisp/progmodes/csharp-mode.el
@@ -773,9 +773,12 @@ csharp-ts-mode--font-lock-settings
      (array_type
       (identifier) @font-lock-type-face)
      (cast_expression (identifier) @font-lock-type-face)
+     (cast_expression (generic_name (identifier) @font-lock-type-face))
      ["operator"] @font-lock-type-face
      (type_parameter_constraints_clause
       target: (identifier) @font-lock-type-face)
+     (type_constraint type: (identifier) @font-lock-type-face)
+     (type_constraint type: (generic_name (identifier) @font-lock-type-face))
      (type_of_expression (identifier) @font-lock-type-face)
      (object_creation_expression
       type: (identifier) @font-lock-type-face)
-- 
2.37.2