summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSearidang Pa <dangsyncpa@gmail.com>2026-01-09 22:18:35 -0500
committerSearidang Pa <dangsyncpa@gmail.com>2026-01-09 22:18:35 -0500
commit4179e791e62c6d54a61757fe1ec67e7424949326 (patch)
treeb7a600985d5eab602b7c56dd5561a6d6a80d35ed /scripts
parent57042a790e24214149b50f5e908823d5ecbb9966 (diff)
downloada4-4179e791e62c6d54a61757fe1ec67e7424949326.tar.xz
a4-4179e791e62c6d54a61757fe1ec67e7424949326.zip
make it a bit easier to read
Diffstat (limited to 'scripts')
-rw-r--r--scripts/ci/install_treesitter_parsers.lua34
1 files changed, 34 insertions, 0 deletions
diff --git a/scripts/ci/install_treesitter_parsers.lua b/scripts/ci/install_treesitter_parsers.lua
new file mode 100644
index 0000000..c742beb
--- /dev/null
+++ b/scripts/ci/install_treesitter_parsers.lua
@@ -0,0 +1,34 @@
+local function fail(message)
+ vim.api.nvim_err_writeln(message)
+ vim.cmd("cq")
+end
+
+local install_dir = vim.fn.stdpath("data") .. "/site"
+
+local ok_setup, setup_err = pcall(function()
+ require("nvim-treesitter").setup({ install_dir = install_dir })
+end)
+
+if not ok_setup then
+ fail(tostring(setup_err))
+end
+
+local ok_install, install_err = pcall(function()
+ require("nvim-treesitter").install({ "lua", "typescript" }):wait(300000)
+end)
+
+if not ok_install then
+ fail(tostring(install_err))
+end
+
+local required_parsers = {
+ lua = "lua.so",
+ typescript = "typescript.so",
+}
+
+for lang, filename in pairs(required_parsers) do
+ local parser_path = install_dir .. "/parser/" .. filename
+ if not vim.uv.fs_stat(parser_path) then
+ fail(lang .. " parser missing after install: " .. parser_path)
+ end
+end