Subject: bug#79406: [PATCH] 31.0.50; csharp-ts-mode does not fontify variable-use consistently

From: Eli Zaretskii <[email-masked]>
Date: Mon, 08 Sep 2025 14:14:32 +0300

> Cc: Yuan Fu <[email-masked]>
> From: Jostein Kjønigsen <[email-masked]>
> Date: Mon, 8 Sep 2025 10:34:50 +0200
> 
> As I'm getting more and more accustomed to font-lock level differentiation between variable-declaration and variable-use, I spot more cases which I think should be fixed in csharp-ts-mode. I've also found some areas of fontification which has been omitted entirely.
> 
> This looks inconsistent, and I'm willing to call that a bug :)
> 
> Attached is a patch which addresses the following areas of csharp-ts-mode fontification:
> 
> - hightlight reserved keywords agressively, dont allow misuse as
>   variables etc (the compiler will fail!)
> - highlight lambda-valued variables as funtions
> - improve semantics of function/class annotations using attributes
>   (maps closer to using-something than declaring it). also: rename to
>   "attribute". "property" has a different, defined meaning in C#.
> - better highlight variable-use in different scenarios (function-calls,
>   if-statements, assignment-expressions, property-use, anonymous object
>   initializers)
> - better hight property-use (anonymous object initializers)

Are all of these appropriate for the default value of
treesit-font-lock-level?  I see that
csharp-ts-mode--font-lock-settings doesn't use the level at all -- is
that on purpose?