Improved treesitter config stuff

main
Jef Roosens 2022-04-26 17:08:06 +02:00
parent 848f127b19
commit 96dc30ed46
Signed by: Jef Roosens
GPG Key ID: B580B976584B5F30
1 changed files with 4 additions and 14 deletions

View File

@ -26,19 +26,10 @@ build() {
v run build.vsh gcc
msg "Building treesitter grammar..."
# Patch the language server files & build the shared library
# Neovim wants all functions in the grammar library to correctly use the
# filetype, which in this case is vlang. However, the standard codebase
# uses v as the name.
mv tree_sitter_v tree_sitter_vlang
find tree_sitter_vlang \
-\( -iname '*.v' -or -iname '*.c' -or -iname '*.h' -\) \
-exec sed -i 's/tree_sitter_v/tree_sitter_vlang/' "{}" \;
# Building with -prod is required because otherwise, the binary contains
# tcc symbols which isn't usually installed on the user's system.
v -shared -prod tree_sitter_vlang
v -shared -prod tree_sitter_v
}
package() {
@ -50,8 +41,7 @@ package() {
# Install treesitter grammar
# This package installs the parser & queries for Neovim in its runtimepath
install -dm755 "$pkgdir/usr/share/nvim/runtime/parser"
install -dm755 "$pkgdir/usr/share/nvim/runtime/queries/vlang"
install -Dm755 "$pkgname/tree_sitter_vlang/tree_sitter_vlang.so" "$pkgdir/usr/share/nvim/runtime/parser/vlang.so"
install -m644 "$pkgname/tree_sitter_vlang/queries"/* "$pkgdir/usr/share/nvim/runtime/queries/vlang"
install -dm755 "$pkgdir/usr/share/nvim/runtime/queries/v"
install -Dm755 "$pkgname/tree_sitter_v/tree_sitter_v.so" "$pkgdir/usr/share/nvim/runtime/parser/v.so"
install -m644 "$pkgname/tree_sitter_v/queries"/* "$pkgdir/usr/share/nvim/runtime/queries/v"
}