From: Jostein Kjønigsen Date: Wed, 23 Apr 2025 08:32:30 +0000 (+0200) Subject: csharp-mode.el: Improve fontification of string-interpolation exprs X-Git-Url: http://git.eshelyaron.com/gitweb/?a=commitdiff_plain;h=f72bcb4861a5bf37111f5c89df94fe74cbaf4c2e;p=emacs.git csharp-mode.el: Improve fontification of string-interpolation exprs * lisp/progmodes/csharp-mode.el (csharp-ts-mode--font-lock-settings): Remove too wide selector, causing non-string content to be fonitified as strings. Add additional eselectors to highlight variables inside interpolation-expressions too. (Bug#78008) (cherry picked from commit 67e8351bdb78eadaf07a5b308806ec3c00c9e979) --- diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index a421d616d9b..e002391d305 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -777,11 +777,19 @@ compilation and evaluation time conflicts." :feature 'expression '((conditional_expression (identifier) @font-lock-variable-use-face) (postfix_unary_expression (identifier)* @font-lock-variable-use-face) - (initializer_expression (assignment_expression left: (identifier) @font-lock-variable-use-face))) + (initializer_expression (assignment_expression left: (identifier) @font-lock-variable-use-face)) + (interpolated_string_expression + (interpolation + (identifier) @font-lock-variable-use-face)) + (interpolated_string_expression + (interpolation + (member_access_expression + expression: (identifier) @font-lock-variable-use-face + name: (identifier) @font-lock-property-use-face)))) :language 'c-sharp :feature 'bracket - '((["(" ")" "[" "]" "{" "}"]) @font-lock-bracket-face) + '((["(" ")" "[" "]" "{" "}" (interpolation_brace)]) @font-lock-bracket-face) :language 'c-sharp :feature 'delimiter @@ -839,8 +847,7 @@ compilation and evaluation time conflicts." "$\"" "@$\"" "$@\"") - '((interpolated_string_expression) - (interpolation_start) + '((interpolation_start) (interpolation_quote)))] @font-lock-string-face)