From: Jostein Kjønigsen Date: Mon, 6 Jan 2025 14:08:36 +0000 (+0100) Subject: lisp/progmodes/csharp-mode.el: Fix fontification of typeof (bug#75406). X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=26e62185ac8794bfe87751c860934aad81ae4b34;p=emacs.git lisp/progmodes/csharp-mode.el: Fix fontification of typeof (bug#75406). (cherry picked from commit 0ef78b131b4e232f064e370699a7ae2413715a44) --- 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