mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-22 13:20:09 -04:00
fixup: wait for it...
This commit is contained in:
parent
ad02b914ea
commit
1764c648c9
3 changed files with 9 additions and 28 deletions
|
|
@ -70,11 +70,7 @@ 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
|
||||
```lua
|
||||
local done = nil
|
||||
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):await(function(_, ok)
|
||||
done = ok
|
||||
end)
|
||||
vim.wait(3000000, function() return done ~= nil end)
|
||||
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):wait(3000000)
|
||||
```
|
||||
|
||||
Check [`:h nvim-treesitter-commands`](doc/nvim-treesitter.txt) for a list of all available commands.
|
||||
|
|
|
|||
|
|
@ -110,11 +110,9 @@ install({languages} [, {opts}]) *nvim-treesitter.install()*
|
|||
|
||||
Note: This operation is performed asynchronously by default. For
|
||||
synchronous operation (e.g., in a bootstrapping script), you need to
|
||||
`await()` it: >lua
|
||||
local done = nil
|
||||
`wait()` for it: >lua
|
||||
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' })
|
||||
:await(function(_, ok) done = ok end)
|
||||
vim.wait(3000000, function() return done ~= nil end)
|
||||
:wait(3000000)
|
||||
<
|
||||
Parameters: ~
|
||||
• {languages} `(string[]|string)` (List of) languages or tiers (`stable`,
|
||||
|
|
@ -143,10 +141,8 @@ 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
|
||||
`await()` it: >lua
|
||||
local done = nil
|
||||
require('nvim-treesitter').update():await(function(_, ok) done = ok end)
|
||||
vim.wait(3000000, function() return done ~= nil end)
|
||||
`wait()` for it: >lua
|
||||
require('nvim-treesitter').update():wait(3000000)
|
||||
<
|
||||
Parameters: ~
|
||||
• {languages} `(string[]|string)?` (List of) languages or tiers to update
|
||||
|
|
|
|||
|
|
@ -21,22 +21,11 @@ vim.opt.runtimepath:append('.')
|
|||
-- needed on CI
|
||||
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
|
||||
|
||||
local done = nil
|
||||
if update then
|
||||
require('nvim-treesitter.install').update('all'):await(function(_err, ok)
|
||||
done = ok
|
||||
end)
|
||||
else
|
||||
require('nvim-treesitter.install')
|
||||
local ok = update and require('nvim-treesitter.install').update('all'):wait(6000000)
|
||||
or require('nvim-treesitter.install')
|
||||
.install(#parsers > 0 and parsers or 'all', { force = true, generate = generate, max_jobs = max_jobs })
|
||||
:await(function(_err, ok)
|
||||
done = ok
|
||||
end)
|
||||
end
|
||||
:wait(6000000)
|
||||
|
||||
vim.wait(6000000, function()
|
||||
return done ~= nil
|
||||
end)
|
||||
if not done then
|
||||
if not ok then
|
||||
vim.cmd.cq()
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue