Subject: bug#78130: closed (Re: bug#78130: Acknowledgement ([PATCH] 31.0.50; csharp-ts-mode does not highlight generic types correctly everywhere))

From: [email-masked] (GNU bug Tracking System)
Date: Thu, 01 May 2025 07:55:04 +0000

Your bug report

#78130: [PATCH] 31.0.50; csharp-ts-mode does not highlight generic types correctly everywhere

which was filed against the emacs package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
78130: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=78130
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#78130: Acknowledgement ([PATCH] 31.0.50; csharp-ts-mode does not highlight generic types correctly everywhere)
From: Yuan Fu <[email-masked]>
To: Jostein Kjønigsen <[email-masked]>
Cc: [email-masked]
Date: Thu, 1 May 2025 00:54:19 -0700
List-Id: <debbugs-submit.debbugs.gnu.org>

> On Apr 29, 2025, at 12:51 PM, Jostein Kjønigsen <[email-masked]> wrote:
> 
> Attached is a better patch, which addresses a lot of different areas of C# fontification.
> 
> Overall I think these are pure improvements:
> 
> - fontification of generic types with namespace-prefixes
> - function-call parameters
> - variable use in string interpolation
> - implicitly typed parameters in lambda-expressions
> - index-expressions
> - variables used in return-statements
> - variables used in binary expressions
> 
> What might warrant some review is the use of the (:match) selector to identify local variables (as opposed to properties or types) for a more consistent fontification. This is the first time I'm using it, and I see there's some repetition in the implementation... Could this be improved somehow?
> 
> Do we have a "emacsy" way or convention to do this which I could have applied, or is it still a bit early wrt treesitter based modes?
> 

Great work! The use of :match seems legit to me. Rust-ts-mode has something similar for fortifying variable vs type, it doesn’t use it as many as here though. A bit strange for the grammar to put properties on identifier too. I don’t have any good idea for reducing the duplication. 

I applied the patch to master. Thanks!

Yuan

Subject: [PATCH] 31.0.50; csharp-ts-mode does not highlight generic types correctly everywhere
From: Jostein Kjønigsen <[email-masked]>
To: [email-masked]
Date: Tue, 29 Apr 2025 11:51:47 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hey everyone.

When using charp-ts-mode to edit C# files, you often work with generic-types (ie List<string>, etc). csharp-ts-mode has treesitter selectors for this type of syntax, but the current implementation constraints it to only be used in specialized circumstances, when we really want to apply it all over the place.

As an example, generic return-types in function declarations are currently not highlighted correctly.

Attached is a patch which removes this unneeded narrowing of the selector and makes generic types look correct everywhere.

It also corrects a small semantic error (property-use vs variable-use) in initializer-expressions, but I didn't feel like making a separate bug-report for that :)

—
Kind Regards
Jostein Kjønigsen

￼