In my script I need to initialize the tree-sitter parsers in headless mode, so the installation need to be sync instead of being async.
Old script with nvim-treesitter
local status_ok, ts = pcall(require, 'nvim-treesitter')
local ok, result = pcall(function()
return ts.install({ parser }, {
summary = false,
force = attempt > 1
}):wait(10 * 60 * 1000)
end)
the code in tree-sitter-manager.nvim
local function install_new(lang, verbose)
...
end
local function install_with_deps(lang, callback, installing)
...
end
local function install(lang, callback) install_with_deps(lang, callback) end
The install_new function is something I want, but it absent the key argument callback. If we have M.install
M.install = function (lang, callback)
...
end
I could use the following code to simulate sync mode
local finish = false
require("tree-sitter-manager").install(lang, function(stat) finish = stat end)
vim.wait(1000 * 15, function()
return finish == true
end)
In my script I need to initialize the tree-sitter parsers in headless mode, so the installation need to be sync instead of being async.
Old script with nvim-treesitter
the code in tree-sitter-manager.nvim
The
install_newfunction is something I want, but it absent the key argument callback. If we haveM.installI could use the following code to simulate sync mode