mirror of
https://github.com/nvim-treesitter/nvim-treesitter.git
synced 2026-07-04 12:30:01 -04:00
fix(install): return error code in callback
This commit is contained in:
parent
a2841d29d7
commit
aaf5b7fdf7
9 changed files with 202 additions and 188 deletions
|
|
@ -406,8 +406,8 @@ end
|
|||
--- Install a parser
|
||||
---@param languages string[]
|
||||
---@param options? InstallOptions
|
||||
---@param _callback? fun()
|
||||
local function install(languages, options, _callback)
|
||||
---@param callback? fun(boolean)
|
||||
local function install(languages, options, callback)
|
||||
options = options or {}
|
||||
|
||||
local cache_dir = fs.normalize(fn.stdpath('cache'))
|
||||
|
|
@ -430,9 +430,12 @@ local function install(languages, options, _callback)
|
|||
a.main()
|
||||
log.info('Installed %d/%d languages', done, #tasks)
|
||||
end
|
||||
if callback then
|
||||
callback(done == #tasks)
|
||||
end
|
||||
end
|
||||
|
||||
M.install = a.sync(function(languages, options, _callback)
|
||||
M.install = a.sync(function(languages, options, callback)
|
||||
reload_parsers()
|
||||
if not languages or #languages == 0 then
|
||||
languages = 'all'
|
||||
|
|
@ -444,8 +447,8 @@ M.install = a.sync(function(languages, options, _callback)
|
|||
options.force = true
|
||||
end
|
||||
|
||||
install(languages, options)
|
||||
end, 2)
|
||||
install(languages, options, callback)
|
||||
end, 3)
|
||||
|
||||
---@class UpdateOptions
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue