aboutsummaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorLewis Russell <lewis6991@gmail.com>2025-05-16 15:44:26 +0100
committerChristian Clason <c.clason@uni-graz.at>2025-05-16 18:33:52 +0200
commit69371f0148bb96b41047f036a58e7e648e200140 (patch)
tree32915a193e2989297d25855b69bfc08f7f8615c8 /scripts
parentrefactor(indent): use `node:byte_length() (diff)
downloadnvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.tar
nvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.tar.gz
nvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.tar.bz2
nvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.tar.lz
nvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.tar.xz
nvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.tar.zst
nvim-treesitter-69371f0148bb96b41047f036a58e7e648e200140.zip
feat(install)!: migrate to latest async.nvim impl (#7856)
Provides significantly simpler blocking installation and update.
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/install-parsers.lua23
1 files changed, 8 insertions, 15 deletions
diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua
index 6dbc73d68..f06d3ee46 100755
--- a/scripts/install-parsers.lua
+++ b/scripts/install-parsers.lua
@@ -21,24 +21,17 @@ vim.opt.runtimepath:append('.')
-- needed on CI
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
-local ok = nil
-if update then
- require('nvim-treesitter.install').update('all', {}, function(success)
- ok = success
- end)
-else
- require('nvim-treesitter.install').install(
+---@type async.Task
+local task = update and require('nvim-treesitter.install').update('all')
+ or require('nvim-treesitter.install').install(
#parsers > 0 and parsers or 'all',
- { force = true, generate = generate, max_jobs = max_jobs },
- function(success)
- ok = success
- end
+ { force = true, generate = generate, max_jobs = max_jobs }
)
-end
-vim.wait(6000000, function()
- return ok ~= nil
-end)
+local ok, err_or_ok = task:pwait(1800000) -- wait max. 30 minutes
if not ok then
+ print('ERROR: ', err_or_ok)
+ vim.cmd.cq()
+elseif not err_or_ok then
vim.cmd.cq()
end