From 26e62185ac8794bfe87751c860934aad81ae4b34 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Jostein=20Kj=C3=B8nigsen?= Date: Mon, 6 Jan 2025 15:08:36 +0100 Subject: [PATCH] lisp/progmodes/csharp-mode.el: Fix fontification of typeof (bug#75406). (cherry picked from commit 0ef78b131b4e232f064e370699a7ae2413715a44) --- lisp/progmodes/csharp-mode.el | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 3e07da40cdd..9d19456179b 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -748,6 +748,12 @@ compilation and evaluation time conflicts." (treesit-query-compile 'c-sharp "(type_of_expression)" t) t)) +(defun csharp-ts-mode--test-typeof-expression () + "Return non-nil if (type_of_expression) is in the grammar." + (ignore-errors + (treesit-query-compile 'c-sharp "(typeof_expression)" t) + t)) + (defun csharp-ts-mode--test-name-equals () "Return non-nil if (name_equals) is in the grammar." (ignore-errors @@ -871,7 +877,9 @@ compilation and evaluation time conflicts." (type_parameter_constraint (type type: (generic_name (identifier) @font-lock-type-face))))) ,@(when (csharp-ts-mode--test-type-of-expression) - '((type_of_expression (identifier) @font-lock-type-face)) + '((type_of_expression (identifier) @font-lock-type-face))) + + ,@(when (csharp-ts-mode--test-typeof-expression) '((typeof_expression (identifier) @font-lock-type-face))) (object_creation_expression -- 2.39.5