Subject: Re: bug#62399: 回复: bug#62399: 30.0.50; eglot + csharp-ts-mode, query pattern is malformed

From: Stefan Kangas <[email-masked]>
Date: Mon, 4 Sep 2023 12:56:48 -0700

Dmitry Gutov <[email-masked]> writes:

> On 23/03/2023 08:25, 牟 桐 wrote:
>> Ah sorry, here it is:
>> ``` csharp-ts-mode
>> Console.WriteLine("Hello, World!");
>> ```
>> (yes, just one line...)
>
> Thanks! I guess the problem will show up with any file.
>
> And I can repro after installing the c-sharp grammar from master.
>
>> The lsp I’m using is `csharp-ls`, I guess it won’t affect this issue.
>> But just in case, the way to install `csharp-ls` is
>>     dotnet tool install csharp-ls -g
>
> A language server was not necessary to reproduce this, but thanks.
>
> This is the patch that worked for me:

It doesn't seem like this was ever installed?  Should it be?

> diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el
> index 47cd13e7fdb..e2df08f4dae 100644
> --- a/lisp/progmodes/csharp-mode.el
> +++ b/lisp/progmodes/csharp-mode.el
> @@ -832,7 +832,7 @@ csharp-ts-mode--font-lock-settings
>
>       (constructor_declaration name: (_) @font-lock-type-face)
>
> -     (method_declaration type: [(identifier) (void_keyword)]
>       @font-lock-type-face)
> +     (method_declaration type: [(identifier) (predefined_type)]
> @font-lock-type-face)
>       (method_declaration type: (generic_name (identifier)
>       @font-lock-type-face))
>       (method_declaration name: (_) @font-lock-function-name-face)
>
>
> Looks like a change was made to the grammar fairly recently which made
> (void_keyword) not valid in the above context:
> https://github.com/tree-sitter/tree-sitter-c-sharp/commit/18a531d4c133d9f1b3796b9bead7681ba3382fb3
>
> Cc'ing the author of that mode for a second opinion. But I guess we'll need a
> runtime check just like we added for java-ts-mode recently.