From bc02d9d154823a41efad9204a80fe888e142a932 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Tempel?= <soeren+git@soeren-tempel.net> Date: Tue, 25 Feb 2025 23:45:33 +0100 Subject: [PATCH] community/tree-sitter: don't modify grammar name in abuild-tree-sitter The `-` character is not allowed in tree-sitter grammar names as defined by the tree-sitter JSON Schema file [1]. Some software using tree-sitter also builds upon this assumption. Most prominently, neovim rejects tree-sitter grammars containing a `-` character [2]. Therefore, for my point of view, no replacement shall be performed on the grammar name specified in grammar.json. It is not entirely clear to me why this string replacement was added in the first place. It is part of the initial commit adding abuild-tree-sitter, i.e. b12a2a438bab41aa8df6139138541b7211644915. Without this patch, several tree-sitter grammars that we package presently (e.g. tree-sitter-markdown or tree-sitter-c-sharp) do not work with neovim. See also !80246 [1]: https://github.com/tree-sitter/tree-sitter/blob/v0.25.2/docs/src/assets/schemas/grammar.schema.json#L15-L19 [2]: https://github.com/neovim/neovim/commit/8b11cf5092e0dfe45ee0f9cf0b72ce4ddeb8740c --- community/tree-sitter/APKBUILD | 4 ++-- community/tree-sitter/abuild-tree-sitter | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/community/tree-sitter/APKBUILD b/community/tree-sitter/APKBUILD index cfb3a9e19450..f5af7d68b86d 100644 --- a/community/tree-sitter/APKBUILD +++ b/community/tree-sitter/APKBUILD @@ -3,7 +3,7 @@ # Maintainer: TBK <alpine@jjtc.eu> pkgname=tree-sitter pkgver=0.22.2 -pkgrel=1 +pkgrel=2 pkgdesc="Incremental parsing system for programming tools" url="https://tree-sitter.github.io/" license="MIT" @@ -56,5 +56,5 @@ grammars() { sha512sums=" a42d744f6e1db7c7c842804f3435b87ccb5d0df2363a18eee38353f12f18c8cf0c6211bf0225fd5f2c0431ca8531aa4ddd73d87d42b80fa35c3c701cae2d7856 tree-sitter-0.22.2.tar.gz -3ddaf38e368371ec7fef8846f9f40d2c1be9166f50f22c84e886f22bd7950cfe4125b16c41722c2d0abfe6b9fbf08f19332d292e4d8bc422a8ff57f99793e67c abuild-tree-sitter +38e4dd95d68197bb8009f8c71d043881cb9bca2c1e2a8d2b7c12e13981b530285e8823bc63530c6c55e81551571255b63a6c6df2210e315f7138c5e3f68a0d1b abuild-tree-sitter " diff --git a/community/tree-sitter/abuild-tree-sitter b/community/tree-sitter/abuild-tree-sitter index 14238b5c9c49..125964f7cfe4 100644 --- a/community/tree-sitter/abuild-tree-sitter +++ b/community/tree-sitter/abuild-tree-sitter @@ -70,7 +70,7 @@ while getopts ':q:s:D:n:h' OPT; do done shift $((OPTIND - 1)) -[ "$name" ] || name=$(jq -re '.name | gsub("_"; "-")' "$srcdir"/grammar.json) +[ "$name" ] || name=$(jq -re '.name' "$srcdir"/grammar.json) case "$subcmd" in build) -- GitLab