Subject: bug#78747: 31.0.50; Bash and C# missing from Tree-sitter compatibility report

From: Peter Oliver <[email-masked]>
Date: Tue, 10 Jun 2025 16:48:11 +0100 (BST)

Tree-sitter parsers for the Bash and C# languages are not currently included in the version compatibility report generated by admin/tree-sitter/treesit-admin.el

A patch to resolve this is attached.

-- 
Peter Oliver

From 9685b83e5464695ca32e32f6f59b67bc9f8286ba Mon Sep 17 00:00:00 2001
From: Peter Oliver <[email-masked]>
Date: Tue, 10 Jun 2025 14:17:33 +0100
Subject: [PATCH] Add bash and c-sharp to Tree-sitter compatibility report
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

* admin/tree-sitter/treesit-admin.el
(treesit-admin--builtin-language-sources): Link to source of
tree-sitter-bash and tree-sitter-c-sharp.
(treesit-admin--builtin-modes): Include bash-ts-mode and csharp-ts-mode.
(treesit-admin--mode-languages): bash-ts-mode is “clever” and switches
back to sh-mode if it thinks the current buffer does not contain a Bash
script.
---
 admin/tree-sitter/treesit-admin.el | 42 ++++++++++++++++--------------
 1 file changed, 23 insertions(+), 19 deletions(-)

diff --git a/admin/tree-sitter/treesit-admin.el b/admin/tree-sitter/treesit-admin.el
index f41c4592039..6f17a174f0c 100644
--- a/admin/tree-sitter/treesit-admin.el
+++ b/admin/tree-sitter/treesit-admin.el
@@ -72,41 +72,43 @@ treesit-admin-check-manual-coverage
 ;;; Query validation
 
 (defvar treesit-admin--builtin-language-sources
-  '((c "https://github.com/tree-sitter/tree-sitter-c" "v0.23.4")
-    (cpp "https://github.com/tree-sitter/tree-sitter-cpp" "v0.23.4")
+  '((bash "https://github.com/tree-sitter/tree-sitter-bash")
+    (c "https://github.com/tree-sitter/tree-sitter-c" "v0.23.4")
+    (c-sharp "https://github.com/tree-sitter/tree-sitter-c-sharp")
     (cmake "https://github.com/uyha/tree-sitter-cmake" "v0.5.0")
+    (cpp "https://github.com/tree-sitter/tree-sitter-cpp" "v0.23.4")
+    (css "https://github.com/tree-sitter/tree-sitter-css" "v0.23.1")
     (dockerfile "https://github.com/camdencheek/tree-sitter-dockerfile" "v0.2.0")
+    (doxygen "https://github.com/tree-sitter-grammars/tree-sitter-doxygen" "v1.1.0")
+    (elixir "https://github.com/elixir-lang/tree-sitter-elixir" "v0.3.3")
     (go "https://github.com/tree-sitter/tree-sitter-go" "v0.23.4")
-    (ruby "https://github.com/tree-sitter/tree-sitter-ruby" "v0.23.1")
+    (heex "https://github.com/phoenixframework/tree-sitter-heex" "v0.7.0")
+    (html "https://github.com/tree-sitter/tree-sitter-html" "v0.23.2")
+    (java "https://github.com/tree-sitter/tree-sitter-java" "v0.23.5")
     (javascript "https://github.com/tree-sitter/tree-sitter-javascript" "v0.23.1")
-    (typescript "https://github.com/tree-sitter/tree-sitter-typescript"
-                "v0.23.2" "typescript/src")
-    (tsx "https://github.com/tree-sitter/tree-sitter-typescript"
-         "v0.23.2" "tsx/src")
+    (jsdoc "https://github.com/tree-sitter/tree-sitter-jsdoc" "v0.23.2")
     (json "https://github.com/tree-sitter/tree-sitter-json" "v0.24.8")
-    (rust "https://github.com/tree-sitter/tree-sitter-rust" "v0.23.2")
+    (lua "https://github.com/tree-sitter-grammars/tree-sitter-lua" "v0.3.0")
     (php "https://github.com/tree-sitter/tree-sitter-php"
          "v0.23.11" "php/src")
-    (css "https://github.com/tree-sitter/tree-sitter-css" "v0.23.1")
     (phpdoc "https://github.com/claytonrcarter/tree-sitter-phpdoc")
-    (doxygen "https://github.com/tree-sitter-grammars/tree-sitter-doxygen" "v1.1.0")
-    (lua "https://github.com/tree-sitter-grammars/tree-sitter-lua" "v0.3.0")
     (python "https://github.com/tree-sitter/tree-sitter-python" "v0.23.6")
-    (html "https://github.com/tree-sitter/tree-sitter-html" "v0.23.2")
-    (elixir "https://github.com/elixir-lang/tree-sitter-elixir" "v0.3.3")
-    (heex "https://github.com/phoenixframework/tree-sitter-heex" "v0.7.0")
-    (java "https://github.com/tree-sitter/tree-sitter-java" "v0.23.5")
-    (jsdoc "https://github.com/tree-sitter/tree-sitter-jsdoc" "v0.23.2")
+    (ruby "https://github.com/tree-sitter/tree-sitter-ruby" "v0.23.1")
+    (rust "https://github.com/tree-sitter/tree-sitter-rust" "v0.23.2")
     (toml "https://github.com/tree-sitter-grammars/tree-sitter-toml" "v0.7.0")
+    (tsx "https://github.com/tree-sitter/tree-sitter-typescript"
+         "v0.23.2" "tsx/src")
+    (typescript "https://github.com/tree-sitter/tree-sitter-typescript"
+                "v0.23.2" "typescript/src")
     (yaml "https://github.com/tree-sitter-grammars/tree-sitter-yaml" "v0.7.0"))
   "A list of sources for the builtin modes.
 The source information are in the format of
 `treesit-language-source-alist'.  This is for development only.")
 
 (defvar treesit-admin--builtin-modes
-  '( c-ts-mode c++-ts-mode cmake-ts-mode dockerfile-ts-mode
-     go-ts-mode ruby-ts-mode js-ts-mode typescript-ts-mode tsx-ts-mode
-     json-ts-mode rust-ts-mode php-ts-mode css-ts-mode lua-ts-mode
+  '( bash-ts-mode c-ts-mode c++-ts-mode cmake-ts-mode csharp-mode
+     dockerfile-ts-mode go-ts-mode ruby-ts-mode js-ts-mode typescript-ts-mode
+     tsx-ts-mode json-ts-mode rust-ts-mode php-ts-mode css-ts-mode lua-ts-mode
      html-ts-mode elixir-ts-mode heex-ts-mode java-ts-mode)
   "Builtin tree-sitter modes that we check.")
 
@@ -268,6 +270,8 @@ treesit-admin--mode-languages
   (let ((settings
          (with-temp-buffer
            (ignore-errors
+             (when (eq mode 'bash-ts-mode)
+               (insert "#!/bin/bash"))
              ;; TODO: A more generic way to find all queries.
              (let ((c-ts-mode-enable-doxygen t)
                    (c-ts-mode-enable-doxygen t)
-- 
2.49.0