mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-21 12:50:09 -04:00
fixup
This commit is contained in:
parent
72fa526a85
commit
8a11b02fe4
4 changed files with 22 additions and 31 deletions
|
|
@ -71,8 +71,8 @@ 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' }, function(success)
|
||||
done = success
|
||||
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' }):await(function(_, ok)
|
||||
done = ok
|
||||
end)
|
||||
vim.wait(3000000, function() return done ~= nil end)
|
||||
```
|
||||
|
|
|
|||
2
TODO.md
2
TODO.md
|
|
@ -4,7 +4,6 @@ This document lists the planned and finished changes in this rewrite towards [Nv
|
|||
|
||||
## TODO
|
||||
|
||||
- [ ] **`install.lua`:** migrate to async v2
|
||||
- [ ] **tests:** remove custom crate, plenary dependency
|
||||
- [ ] **indents:** rewrite (Helix or Zed compatible)
|
||||
- [ ] **textobjects:** include simple(!) `node`, `scope` (using `locals`) objects
|
||||
|
|
@ -26,3 +25,4 @@ This document lists the planned and finished changes in this rewrite towards [Nv
|
|||
- [X] drop ensure_install (replace with install)
|
||||
- [X] **CI:** switch to ts_query_ls, add update readme as check (remove update job)
|
||||
- [X] **CI:** track versioned releases for tier 1
|
||||
- [X] **`install.lua`:** migrate to async v2
|
||||
|
|
|
|||
|
|
@ -102,7 +102,7 @@ setup({opts}) *nvim-treesitter.setup()*
|
|||
directory to install parsers and queries to. Note: will be
|
||||
appended to |runtimepath|.
|
||||
|
||||
install({languages}, {opts}, {callback}) *nvim-treesitter.install()*
|
||||
install({languages} [, {opts}]) *nvim-treesitter.install()*
|
||||
|
||||
Download, compile, and install the specified treesitter parsers and copy
|
||||
the corresponding queries to a directory on |runtimepath|, enabling their
|
||||
|
|
@ -110,12 +110,10 @@ install({languages}, {opts}, {callback}) *nvim-treesitter.install()*
|
|||
|
||||
Note: This operation is performed asynchronously by default. For
|
||||
synchronous operation (e.g., in a bootstrapping script), you need to
|
||||
provide a suitable {callback}: >lua
|
||||
`await()` it: >lua
|
||||
local done = nil
|
||||
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' },
|
||||
function(success)
|
||||
done = success
|
||||
end)
|
||||
require('nvim-treesitter').install({ 'rust', 'javascript', 'zig' })
|
||||
:await(function(_, ok) done = ok end)
|
||||
vim.wait(3000000, function() return done ~= nil end)
|
||||
<
|
||||
Parameters: ~
|
||||
|
|
@ -129,7 +127,6 @@ install({languages}, {opts}, {callback}) *nvim-treesitter.install()*
|
|||
compiling.
|
||||
• {max_jobs} (`integer?`) limit parallel tasks (useful in
|
||||
combination with {generate} on memory-limited systems).
|
||||
• {callback} `(function?`) Callback for synchronous execution.
|
||||
|
||||
uninstall({languages}) *nvim-treesitter.uninstall()*
|
||||
|
||||
|
|
@ -139,25 +136,21 @@ uninstall({languages}) *nvim-treesitter.uninstall()
|
|||
• {languages} `(string[]|string)` (List of) languages or tiers (`stable`,
|
||||
`unstable`) to update.
|
||||
|
||||
update({languages}, {callback}) *nvim-treesitter.update()*
|
||||
update([{languages}]) *nvim-treesitter.update()*
|
||||
|
||||
Update the parsers and queries if older than the revision specified in the
|
||||
manifest.
|
||||
|
||||
Note: This operation is performed asynchronously by default. For
|
||||
synchronous operation (e.g., in a bootstrapping script), you need to
|
||||
provide a suitable {callback}: >lua
|
||||
`await()` it: >lua
|
||||
local done = nil
|
||||
require('nvim-treesitter').update(),
|
||||
function(success)
|
||||
done = success
|
||||
end)
|
||||
require('nvim-treesitter').update():await(function(_, ok) done = ok end)
|
||||
vim.wait(3000000, function() return done ~= nil end)
|
||||
<
|
||||
Parameters: ~
|
||||
• {languages} `(string[]|string)` (List of) languages or tiers to
|
||||
uninstall.
|
||||
• {callback} `(function?`) Callback for synchronous execution.
|
||||
• {languages} `(string[]|string)?` (List of) languages or tiers to update
|
||||
(default: all installed).
|
||||
|
||||
indentexpr() *nvim-treesitter.indentexpr()*
|
||||
|
||||
|
|
|
|||
|
|
@ -21,24 +21,22 @@ vim.opt.runtimepath:append('.')
|
|||
-- needed on CI
|
||||
vim.fn.mkdir(vim.fn.stdpath('cache'), 'p')
|
||||
|
||||
local ok = nil
|
||||
local done = nil
|
||||
if update then
|
||||
require('nvim-treesitter.install').update('all', {}, function(success)
|
||||
ok = success
|
||||
require('nvim-treesitter.install').update('all'):await(function(_err, ok)
|
||||
done = ok
|
||||
end)
|
||||
else
|
||||
require('nvim-treesitter.install').install(
|
||||
#parsers > 0 and parsers or 'all',
|
||||
{ force = true, generate = generate, max_jobs = max_jobs },
|
||||
function(success)
|
||||
ok = success
|
||||
end
|
||||
)
|
||||
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
|
||||
|
||||
vim.wait(6000000, function()
|
||||
return ok ~= nil
|
||||
return done ~= nil
|
||||
end)
|
||||
if not ok then
|
||||
if not done then
|
||||
vim.cmd.cq()
|
||||
end
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue