[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
emacs-29 78999d52136: Update csharp tree-sitter support due to upstream
From: |
Eli Zaretskii |
Subject: |
emacs-29 78999d52136: Update csharp tree-sitter support due to upstream changes |
Date: |
Sat, 12 Aug 2023 03:25:37 -0400 (EDT) |
branch: emacs-29
commit 78999d52136ef5798ec06819c2546753e65e8ff4
Author: J M <jean@tbm.email>
Commit: Eli Zaretskii <eliz@gnu.org>
Update csharp tree-sitter support due to upstream changes
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 (csharp-ts-mode--font-lock-settings):
Support both old and new style of keywords in tree-sitter-c-sharp
grammar. (Bug#65113)
---
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 @@ compilation and evaluation time conflicts."
: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 @@ compilation and evaluation time conflicts."
(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)
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- emacs-29 78999d52136: Update csharp tree-sitter support due to upstream changes,
Eli Zaretskii <=