diff options
| author | Searidang Pa <dangsyncpa@gmail.com> | 2026-01-09 22:23:33 -0500 |
|---|---|---|
| committer | Searidang Pa <dangsyncpa@gmail.com> | 2026-01-09 22:23:33 -0500 |
| commit | 52026fdf58c4fa10629d3f4ea985e1bb4bc00b45 (patch) | |
| tree | 72aa96ea0c8e4d8c235832bae86b0a276ee70842 /scripts | |
| parent | 4179e791e62c6d54a61757fe1ec67e7424949326 (diff) | |
| download | a4-52026fdf58c4fa10629d3f4ea985e1bb4bc00b45.tar.xz a4-52026fdf58c4fa10629d3f4ea985e1bb4bc00b45.zip | |
ci: improve treesitter parser install error output
Diffstat (limited to 'scripts')
| -rw-r--r-- | scripts/ci/install_treesitter_parsers.lua | 45 |
1 files changed, 29 insertions, 16 deletions
diff --git a/scripts/ci/install_treesitter_parsers.lua b/scripts/ci/install_treesitter_parsers.lua index c742beb..8c58601 100644 --- a/scripts/ci/install_treesitter_parsers.lua +++ b/scripts/ci/install_treesitter_parsers.lua @@ -1,34 +1,47 @@ -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 }) + require("nvim-treesitter").setup({ + install_dir = install_dir, + }) end) if not ok_setup then - fail(tostring(setup_err)) + vim.api.nvim_echo( + { { "Error: " .. tostring(setup_err), "ErrorMsg" } }, + true, + {} + ) + vim.cmd("cq") end local ok_install, install_err = pcall(function() - require("nvim-treesitter").install({ "lua", "typescript" }):wait(300000) + require("nvim-treesitter").install({ "lua", "typescript" }):wait(300000) end) if not ok_install then - fail(tostring(install_err)) + vim.api.nvim_echo({ + { "Error: " .. tostring(install_err), "ErrorMsg" }, + }, true, {}) + vim.cmd("cq") end local required_parsers = { - lua = "lua.so", - typescript = "typescript.so", + 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 + local parser_path = install_dir .. "/parser/" .. filename + if not vim.uv.fs_stat(parser_path) then + vim.api.nvim_echo({ + { + "Error: " + .. lang + .. " parser missing after install: " + .. parser_path, + "ErrorMsg", + }, + }, true, {}) + vim.cmd("cq") + end end |
