From: J M <jean@tbm.email>
To: Eli Zaretskii <eliz@gnu.org>
Cc: casouri@gmail.com, 65113@debbugs.gnu.org,
Theodor Thornhill <theo@thornhill.no>
Subject: bug#65113: Emacs-29 and master csharp-mode with broken treesit
Date: Thu, 10 Aug 2023 23:42:22 +0100 [thread overview]
Message-ID: <42C29EBD-86EA-4F55-AD84-CBA7F9AE6A60@tbm.email> (raw)
In-Reply-To: <834jl7jmhc.fsf@gnu.org>
[-- 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
>>
next prev parent reply other threads:[~2023-08-10 22:42 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
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 [this message]
2023-08-11 5:57 ` Eli Zaretskii
2023-08-12 7:27 ` Eli Zaretskii
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=42C29EBD-86EA-4F55-AD84-CBA7F9AE6A60@tbm.email \
--to=jean@tbm.email \
--cc=65113@debbugs.gnu.org \
--cc=casouri@gmail.com \
--cc=eliz@gnu.org \
--cc=theo@thornhill.no \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.