aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Clason <c.clason@uni-graz.at>2024-08-27 11:02:34 +0200
committerChristian Clason <c.clason@uni-graz.at>2025-05-12 18:43:40 +0200
commit83dae49a10d6eaedb77f0a26df921825341242d9 (patch)
tree3538610973205e13f29a04b8960f43e18787a4e4
parentfeat(config)!: remove auto_install (diff)
downloadnvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.tar
nvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.tar.gz
nvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.tar.bz2
nvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.tar.lz
nvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.tar.xz
nvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.tar.zst
nvim-treesitter-83dae49a10d6eaedb77f0a26df921825341242d9.zip
feat(install): allow specifying max jobs
-rw-r--r--lua/nvim-treesitter/install.lua5
-rwxr-xr-xscripts/install-parsers.lua5
2 files changed, 7 insertions, 3 deletions
diff --git a/lua/nvim-treesitter/install.lua b/lua/nvim-treesitter/install.lua
index f9a52461c..07be39d6d 100644
--- a/lua/nvim-treesitter/install.lua
+++ b/lua/nvim-treesitter/install.lua
@@ -23,7 +23,7 @@ local uv_symlink = a.wrap(uv.fs_symlink, 4)
---@type fun(path: string): string?
local uv_unlink = a.wrap(uv.fs_unlink, 2)
-local MAX_JOBS = 10
+local MAX_JOBS = 100
local INSTALL_TIMEOUT = 60000
---@async
@@ -402,6 +402,7 @@ end
---@class InstallOptions
---@field force? boolean
---@field generate? boolean
+---@field max_jobs? integer
--- Install a parser
---@param languages string[]
@@ -425,7 +426,7 @@ local function install(languages, options, _callback)
end)
end
- a.join(MAX_JOBS, nil, tasks)
+ a.join(options and options.max_jobs or MAX_JOBS, nil, tasks)
if #tasks > 1 then
a.main()
log.info('Installed %d/%d languages', done, #tasks)
diff --git a/scripts/install-parsers.lua b/scripts/install-parsers.lua
index c607e51f4..756d34561 100755
--- a/scripts/install-parsers.lua
+++ b/scripts/install-parsers.lua
@@ -1,10 +1,13 @@
#!/usr/bin/env -S nvim -l
local generate = false
+local max_jobs = nil ---@as integer
local parsers = {}
for i = 1, #_G.arg do
if _G.arg[i] == '--generate' then
generate = true
+ elseif _G.arg[i]:find('^%-%-max%-jobs') then
+ max_jobs = _G.arg[i]:match('=(%d+)')
else
parsers[#parsers + 1] = _G.arg[i]
end
@@ -18,7 +21,7 @@ vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
local done = false
require('nvim-treesitter.install').install(
#parsers > 0 and parsers or 'all',
- { force = true, generate = generate },
+ { force = true, generate = generate, max_jobs = max_jobs },
function()
done = true
end