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 #14 received at 62399 <at> debbugs.gnu.org (full text, mbox):

From: Dmitry Gutov <dgutov <at> yandex.ru>
To: 牟 桐 <mou.tong <at> outlook.com>,
 "62399 <at> debbugs.gnu.org" <62399 <at> debbugs.gnu.org>,
 Theodor Thornhill <theo <at> thornhill.no>
Subject: Re: bug#62399: 回复: bug#62399: 30.0.50; eglot + csharp-ts-mode, query pattern is malformed
Date: Thu, 23 Mar 2023 09:57:36 +0200
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.




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.