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

From: Jostein Kjønigsen <[email-masked]>
Date: Mon, 8 Sep 2025 10:34:50 +0200

Hey everyone.

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)

—
Kind Regards
Jostein Kjønigsen