GNU bug report logs - #62399
30.0.50; eglot + csharp-ts-mode, query pattern is malformed

Previous Next

Package: emacs;

Reported by: 牟 桐 <mou.tong <at> outlook.com>

Date: Thu, 23 Mar 2023 06:05:01 UTC

Severity: normal

Tags: patch

Found in version 30.0.50

Full log


Message #17 received at 62399 <at> debbugs.gnu.org (full text, mbox):

From: 牟 桐 <mou.tong <at> outlook.com>
To: Dmitry Gutov <dgutov <at> yandex.ru>, "62399 <at> debbugs.gnu.org"
 <62399 <at> debbugs.gnu.org>, Theodor Thornhill <theo <at> thornhill.no>
Subject: bug#62399: 30.0.50; eglot + csharp-ts-mode, query pattern is malformed
Date: Thu, 23 Mar 2023 16:19:59 +0000
[Message part 1 (text/plain, inline)]
Thanks, I tried your patch and now it works fine on my computer now.

Hope to see it got merged soon 😉

发件人: Dmitry Gutov<mailto:dgutov <at> yandex.ru>
发送时间: 2023年3月23日 15:57
收件人: 牟 桐<mailto:mou.tong <at> outlook.com>; 62399 <at> debbugs.gnu.org<mailto:62399 <at> debbugs.gnu.org>; Theodor Thornhill<mailto:theo <at> thornhill.no>
主题: Re: bug#62399: 回复: bug#62399: 30.0.50; eglot + csharp-ts-mode, query pattern is malformed

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:

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.

[Message part 2 (text/html, inline)]

This bug report was last modified 1 year and 278 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.