This commit is contained in:
Christian Clason 2025-05-16 15:55:18 +02:00
parent 4eaca06ee2
commit a0a5753679
3 changed files with 8 additions and 13 deletions

View file

@ -68,9 +68,9 @@ Parsers and queries can then be installed with
require'nvim-treesitter'.install { 'rust', 'javascript', 'zig' }
```
(This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), use something like
(This is a no-op if the parsers are already installed.) Note that this function runs asynchronously; for synchronous installation in a script context ("bootstrapping"), you need to `wait()` for it to finish:
```lua
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):wait(3000000)
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):wait(300000) -- wait max. 5 minutes
```
Check [`:h nvim-treesitter-commands`](doc/nvim-treesitter.txt) for a list of all available commands.

View file

@ -112,7 +112,7 @@ install({languages} [, {opts}]) *nvim-treesitter.install()*
synchronous operation (e.g., in a bootstrapping script), you need to
`wait()` for it: >lua
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' })
:wait(3000000)
:wait(300000) -- max. 5 minutes
<
Parameters: ~
• {languages} `(string[]|string)` (List of) languages or tiers (`stable`,
@ -142,7 +142,7 @@ update([{languages}]) *nvim-treesitter.update()
Note: This operation is performed asynchronously by default. For
synchronous operation (e.g., in a bootstrapping script), you need to
`wait()` for it: >lua
require('nvim-treesitter').update():wait(3000000)
require('nvim-treesitter').update():wait(300000) -- max. 5 minutes
<
Parameters: ~
• {languages} `(string[]|string)?` (List of) languages or tiers to update

View file

@ -21,19 +21,14 @@ vim.opt.runtimepath:append('.')
-- needed on CI
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
local task = nil
if update then
--- @type async.Task
task = require('nvim-treesitter.install').update('all')
else
--- @type async.Task
task = 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 }
)
end
local ok, err_or_ok = task:pwait(6000000)
local ok, err_or_ok = task:pwait(1800000) -- wait max. 30 minutes
if not ok then
print('ERROR: ', err_or_ok)
vim.cmd.cq()