* bug#65113: Emacs-29 and master csharp-mode with broken treesit @ 2023-08-06 15:03 J M 2023-08-06 15:36 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: J M @ 2023-08-06 15:03 UTC (permalink / raw) To: 65113 [-- Attachment #1: Type: text/plain, Size: 341 bytes --] Hi all Treesit is broken for csharp-mode in the latest version in master and emacs-29 and therefore does not provide syntax highlighting.  The latest grammar repository (https://github.com/tree-sitter/tree-sitter-c-sharp) has removed the keyword void_keyword. Please see attached the patch to resolve the issue. Thanks Jean M [-- Attachment #2.1: Type: text/html, Size: 369 bytes --] [-- Attachment #2.2: treesit_void_keyword_removed_from_grammar.patch --] [-- Type: application/octet-stream, Size: 629 bytes --] diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 00587a8a515..1a753cb309b 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -844,7 +844,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) [-- Attachment #2.3: Type: text/html, Size: 554 bytes --] ^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#65113: Emacs-29 and master csharp-mode with broken treesit 2023-08-06 15:03 bug#65113: Emacs-29 and master csharp-mode with broken treesit J M @ 2023-08-06 15:36 ` Eli Zaretskii 2023-08-07 5:46 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2023-08-06 15:36 UTC (permalink / raw) To: J M, Theodor Thornhill, Yuan Fu; +Cc: 65113 > From: J M <jean@tbm.email> > Date: Sun, 6 Aug 2023 16:03:45 +0100 > > Treesit is broken for csharp-mode in the latest version in master and emacs-29 and therefore does not provide syntax highlighting.  > > The latest grammar repository (https://github.com/tree-sitter/tree-sitter-c-sharp) has removed the keyword void_keyword. > > Please see attached the patch to resolve the issue. Thanks, but your patch will not work with the older version of the grammar library, right? Is it possible to make a patch that will work with both? Wed cannot rely on users having the latest grammar versions, so a backward-compatible change is much more preferable. ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#65113: Emacs-29 and master csharp-mode with broken treesit 2023-08-06 15:36 ` Eli Zaretskii @ 2023-08-07 5:46 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors 2023-08-10 9:05 ` Eli Zaretskii 0 siblings, 1 reply; 7+ messages in thread From: Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-07 5:46 UTC (permalink / raw) To: Eli Zaretskii, J M, Yuan Fu; +Cc: 65113 On 6 August 2023 17:36:47 CEST, Eli Zaretskii <eliz@gnu.org> wrote: >> From: J M <jean@tbm.email> >> Date: Sun, 6 Aug 2023 16:03:45 +0100 >> >> Treesit is broken for csharp-mode in the latest version in master and emacs-29 and therefore does not provide syntax highlighting.  >> >> The latest grammar repository (https://github.com/tree-sitter/tree-sitter-c-sharp) has removed the keyword void_keyword. >> >> Please see attached the patch to resolve the issue. > >Thanks, but your patch will not work with the older version of the >grammar library, right? Is it possible to make a patch that will work >with both? Wed cannot rely on users having the latest grammar >versions, so a backward-compatible change is much more preferable. We've had some similar patches lately that you can use for inspiration. Thanks, Theo ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#65113: Emacs-29 and master csharp-mode with broken treesit 2023-08-07 5:46 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors @ 2023-08-10 9:05 ` Eli Zaretskii 2023-08-10 22:42 ` J M 0 siblings, 1 reply; 7+ messages in thread From: Eli Zaretskii @ 2023-08-10 9:05 UTC (permalink / raw) To: jean, Theodor Thornhill; +Cc: casouri, 65113 > Date: Mon, 07 Aug 2023 07:46:05 +0200 > From: Theodor Thornhill <theo@thornhill.no> > CC: 65113@debbugs.gnu.org Ping! Can we please have a patch that is backward-compatible? > On 6 August 2023 17:36:47 CEST, Eli Zaretskii <eliz@gnu.org> wrote: > >> From: J M <jean@tbm.email> > >> Date: Sun, 6 Aug 2023 16:03:45 +0100 > >> > >> Treesit is broken for csharp-mode in the latest version in master and emacs-29 and therefore does not provide syntax highlighting.  > >> > >> The latest grammar repository (https://github.com/tree-sitter/tree-sitter-c-sharp) has removed the keyword void_keyword. > >> > >> Please see attached the patch to resolve the issue. > > > >Thanks, but your patch will not work with the older version of the > >grammar library, right? Is it possible to make a patch that will work > >with both? Wed cannot rely on users having the latest grammar > >versions, so a backward-compatible change is much more preferable. > > We've had some similar patches lately that you can use for inspiration. > > Thanks, > Theo > ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#65113: Emacs-29 and master csharp-mode with broken treesit 2023-08-10 9:05 ` Eli Zaretskii @ 2023-08-10 22:42 ` J M 2023-08-11 5:57 ` Eli Zaretskii 2023-08-12 7:27 ` Eli Zaretskii 0 siblings, 2 replies; 7+ messages in thread From: J M @ 2023-08-10 22:42 UTC (permalink / raw) To: Eli Zaretskii; +Cc: casouri, 65113, Theodor Thornhill [-- Attachment #1: Type: text/plain, Size: 64 bytes --] Hi Eli See attached the requested backward-compatible change. [-- Attachment #2: 0001-Update-csharp-treesit-support-due-to-upstream-change.patch --] [-- Type: application/octet-stream, Size: 1975 bytes --] From ca9ad7d0738e71775bdc1d83f7aa5a2849ba5a8b Mon Sep 17 00:00:00 2001 From: J M <jean@tbm.email> Date: Thu, 10 Aug 2023 23:23:20 +0100 Subject: [PATCH] Update csharp treesit support due to upstream changes (bug#65113) A change in tree-sitter-c-sharp grammar for csharp (commit 18a531), has removed the keyword void_keyword and advised we should use predefined_type --- lisp/progmodes/csharp-mode.el | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/lisp/progmodes/csharp-mode.el b/lisp/progmodes/csharp-mode.el index 00587a8a515..74968f3a06a 100644 --- a/lisp/progmodes/csharp-mode.el +++ b/lisp/progmodes/csharp-mode.el @@ -816,7 +816,7 @@ csharp-ts-mode--font-lock-settings :language 'c-sharp :feature 'definition :override t - '((qualified_name (identifier) @font-lock-type-face) + `((qualified_name (identifier) @font-lock-type-face) (using_directive (identifier) @font-lock-type-face) (using_directive (name_equals (identifier) @font-lock-type-face)) @@ -843,8 +843,13 @@ csharp-ts-mode--font-lock-settings (class_declaration (identifier) @font-lock-type-face) (constructor_declaration name: (_) @font-lock-type-face) - - (method_declaration type: [(identifier) (void_keyword)] @font-lock-type-face) + ;;; Handle different releases of tree-sitter-c-sharp. + ;;; Check if keyword void_keyword is available, then return the correct rule." + ,@(condition-case nil + (progn (treesit-query-capture 'csharp '((void_keyword) @capture)) + `((method_declaration type: [(identifier) (void_keyword)] @font-lock-type-face))) + (error + `((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) -- [-- Attachment #3: Type: text/plain, Size: 1172 bytes --] > On 10 Aug 2023, at 10:05, Eli Zaretskii <eliz@gnu.org> wrote: > >> Date: Mon, 07 Aug 2023 07:46:05 +0200 >> From: Theodor Thornhill <theo@thornhill.no> >> CC: 65113@debbugs.gnu.org > > Ping! Can we please have a patch that is backward-compatible? > >> On 6 August 2023 17:36:47 CEST, Eli Zaretskii <eliz@gnu.org> wrote: >>>> From: J M <jean@tbm.email> >>>> Date: Sun, 6 Aug 2023 16:03:45 +0100 >>>> >>>> Treesit is broken for csharp-mode in the latest version in master and emacs-29 and therefore does not provide syntax highlighting.  >>>> >>>> The latest grammar repository (https://github.com/tree-sitter/tree-sitter-c-sharp) has removed the keyword void_keyword. >>>> >>>> Please see attached the patch to resolve the issue. >>> >>> Thanks, but your patch will not work with the older version of the >>> grammar library, right? Is it possible to make a patch that will work >>> with both? Wed cannot rely on users having the latest grammar >>> versions, so a backward-compatible change is much more preferable. >> >> We've had some similar patches lately that you can use for inspiration. >> >> Thanks, >> Theo >> ^ permalink raw reply related [flat|nested] 7+ messages in thread
* bug#65113: Emacs-29 and master csharp-mode with broken treesit 2023-08-10 22:42 ` J M @ 2023-08-11 5:57 ` Eli Zaretskii 2023-08-12 7:27 ` Eli Zaretskii 1 sibling, 0 replies; 7+ messages in thread From: Eli Zaretskii @ 2023-08-11 5:57 UTC (permalink / raw) To: J M; +Cc: casouri, 65113, theo > From: J M <jean@tbm.email> > Date: Thu, 10 Aug 2023 23:42:22 +0100 > Cc: Theodor Thornhill <theo@thornhill.no>, > casouri@gmail.com, > 65113@debbugs.gnu.org > > See attached the requested backward-compatible change. Thank you! Should we perhaps swap the order, and query first about the newer type, so as to make the code a bit faster when used with the latest grammar? ^ permalink raw reply [flat|nested] 7+ messages in thread
* bug#65113: Emacs-29 and master csharp-mode with broken treesit 2023-08-10 22:42 ` J M 2023-08-11 5:57 ` Eli Zaretskii @ 2023-08-12 7:27 ` Eli Zaretskii 1 sibling, 0 replies; 7+ messages in thread From: Eli Zaretskii @ 2023-08-12 7:27 UTC (permalink / raw) To: J M; +Cc: casouri, theo, 65113-done > From: J M <jean@tbm.email> > Date: Thu, 10 Aug 2023 23:42:22 +0100 > Cc: Theodor Thornhill <theo@thornhill.no>, > casouri@gmail.com, > 65113@debbugs.gnu.org > > See attached the requested backward-compatible change. Thanks, installed on the emacs-29 branch, and closing the bug. Please in the future accompany your changes with a ChangeLog-style description of files and functions where you make changes (I did it this time for you). ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-08-12 7:27 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2023-08-06 15:03 bug#65113: Emacs-29 and master csharp-mode with broken treesit J M 2023-08-06 15:36 ` Eli Zaretskii 2023-08-07 5:46 ` Theodor Thornhill via Bug reports for GNU Emacs, the Swiss army knife of text editors 2023-08-10 9:05 ` Eli Zaretskii 2023-08-10 22:42 ` J M 2023-08-11 5:57 ` Eli Zaretskii 2023-08-12 7:27 ` Eli Zaretskii
Code repositories for project(s) associated with this external index https://git.savannah.gnu.org/cgit/emacs.git https://git.savannah.gnu.org/cgit/emacs/org-mode.git This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.