Skip to content

Commit

Permalink
enhance(main/neovim): Add tree sitter parsers
Browse files Browse the repository at this point in the history
Backport fix for tree-sitter-vimdoc 3.0.0 parser
  • Loading branch information
Biswa96 committed Jun 22, 2024
1 parent ac0daf5 commit a8d3d8d
Show file tree
Hide file tree
Showing 5 changed files with 106 additions and 1 deletion.
6 changes: 5 additions & 1 deletion packages/neovim/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,12 @@ TERMUX_PKG_LICENSE="Apache-2.0, VIM License"
TERMUX_PKG_LICENSE_FILE="LICENSE.txt"
TERMUX_PKG_MAINTAINER="Joshua Kahn @TomJo2000"
TERMUX_PKG_VERSION="0.10.0"
TERMUX_PKG_REVISION=1
TERMUX_PKG_SRCURL=https://github.com/neovim/neovim/archive/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=372ea2584b0ea2a5a765844d95206bda9e4a57eaa1a2412a9a0726bab750f828
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_UPDATE_VERSION_REGEXP="^\d+\.\d+\.\d+$"
TERMUX_PKG_DEPENDS="libiconv, libuv, luv, libmsgpack, libvterm (>= 1:0.3-0), libluajit, libunibilium, libtreesitter, libandroid-support, lua51-lpeg"
TERMUX_PKG_DEPENDS="libiconv, libuv, luv, libmsgpack, libvterm (>= 1:0.3-0), libluajit, libunibilium, libtreesitter, libandroid-support, lua51-lpeg, tree-sitter-lua, tree-sitter-query, tree-sitter-vimdoc"
TERMUX_PKG_HOSTBUILD=true

TERMUX_PKG_EXTRA_CONFIGURE_ARGS="
Expand Down Expand Up @@ -79,6 +80,9 @@ termux_step_post_make_install() {
local _CONFIG_DIR=$TERMUX_PREFIX/share/nvim
mkdir -p $_CONFIG_DIR
cp $TERMUX_PKG_BUILDER_DIR/sysinit.vim $_CONFIG_DIR/

# Tree-sitter grammars are packaged separately and installed into TERMUX_PREFIX/lib/tree_sitter.
ln -s "${TERMUX_PREFIX}"/lib/tree_sitter "${TERMUX_PREFIX}"/share/nvim/runtime/parser
}

termux_step_create_debscripts() {
Expand Down
38 changes: 38 additions & 0 deletions packages/neovim/neovim-fix-latest-tree-sitter-vimdoc.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 105a9e3dcf95ba64e7737a479579e20063ead0bb Mon Sep 17 00:00:00 2001
From: Christian Clason <[email protected]>
Date: Sat, 8 Jun 2024 10:19:28 +0200
Subject: [PATCH] build(deps): bump tree-sitter-vimdoc to v3.0.0

---
runtime/queries/vimdoc/highlights.scm | 16 +++++++++++-----
2 files changed, 13 insertions(+), 7 deletions(-)

diff --git a/runtime/queries/vimdoc/highlights.scm b/runtime/queries/vimdoc/highlights.scm
index 70a3a2f2060723..194c80362c4091 100644
--- a/runtime/queries/vimdoc/highlights.scm
+++ b/runtime/queries/vimdoc/highlights.scm
@@ -1,13 +1,19 @@
-(h1) @markup.heading.1
+(h1
+ (delimiter) @markup.heading.1
+ (heading) @markup.heading.1)

-(h2) @markup.heading.2
+(h2
+ (delimiter) @markup.heading.2
+ (heading) @markup.heading.2)

-(h3) @markup.heading.3
+(h3
+ (heading) @markup.heading.3)

-(column_heading) @markup.heading.4
+(column_heading
+ (heading) @markup.heading.4)

(column_heading
- "~" @markup.heading.4
+ (delimiter) @markup.heading.4
(#set! conceal ""))

(tag
21 changes: 21 additions & 0 deletions packages/tree-sitter-lua/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TERMUX_PKG_HOMEPAGE=https://github.com/tree-sitter-grammars/tree-sitter-lua
TERMUX_PKG_DESCRIPTION="Lua grammar for tree-sitter"
TERMUX_PKG_LICENSE="MIT"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="0.1.0"
TERMUX_PKG_SRCURL=https://github.com/tree-sitter-grammars/tree-sitter-lua/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=230cfcbfa74ed1f7b8149e9a1f34c2efc4c589a71fe0f5dc8560622f8020d722
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="
PARSER_URL="${TERMUX_PKG_HOMEPAGE}"
"

termux_step_pre_configure() {
rm setup.py pyproject.toml
}

termux_step_post_make_install() {
install -d "${TERMUX_PREFIX}"/lib/tree_sitter
ln -s "${TERMUX_PREFIX}"/lib/libtree-sitter-lua.so "${TERMUX_PREFIX}"/lib/tree_sitter/lua.so
}
21 changes: 21 additions & 0 deletions packages/tree-sitter-query/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TERMUX_PKG_HOMEPAGE=https://github.com/tree-sitter-grammars/tree-sitter-query
TERMUX_PKG_DESCRIPTION="TS query grammar for tree-sitter"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="0.4.0"
TERMUX_PKG_SRCURL=https://github.com/tree-sitter-grammars/tree-sitter-query/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=d3a423ab66dc62b2969625e280116678a8a22582b5ff087795222108db2f6a6e
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="
PARSER_URL="${TERMUX_PKG_HOMEPAGE}"
"

termux_step_pre_configure() {
rm setup.py pyproject.toml
}

termux_step_post_make_install() {
install -d "${TERMUX_PREFIX}"/lib/tree_sitter
ln -s "${TERMUX_PREFIX}"/lib/libtree-sitter-query.so "${TERMUX_PREFIX}"/lib/tree_sitter/query.so
}
21 changes: 21 additions & 0 deletions packages/tree-sitter-vimdoc/build.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
TERMUX_PKG_HOMEPAGE=https://github.com/neovim/tree-sitter-vimdoc
TERMUX_PKG_DESCRIPTION="Tree-sitter parser for Vim help files"
TERMUX_PKG_LICENSE="Apache-2.0"
TERMUX_PKG_MAINTAINER="@termux"
TERMUX_PKG_VERSION="3.0.0"
TERMUX_PKG_SRCURL=https://github.com/neovim/tree-sitter-vimdoc/archive/refs/tags/v${TERMUX_PKG_VERSION}.tar.gz
TERMUX_PKG_SHA256=a639bf92bf57bfa1cdc90ca16af27bfaf26a9779064776dd4be34c1ef1453f6c
TERMUX_PKG_AUTO_UPDATE=true
TERMUX_PKG_BUILD_IN_SRC=true
TERMUX_PKG_EXTRA_MAKE_ARGS="
PARSER_URL="${TERMUX_PKG_HOMEPAGE}"
"

termux_step_pre_configure() {
rm setup.py pyproject.toml
}

termux_step_post_make_install() {
install -d "${TERMUX_PREFIX}"/lib/tree_sitter
ln -s "${TERMUX_PREFIX}"/lib/libtree-sitter-vimdoc.so "${TERMUX_PREFIX}"/lib/tree_sitter/vimdoc.so
}

0 comments on commit a8d3d8d

Please sign in to comment.