Skip to content

Cloud you please expose the install function with callback? #40

@ssfdust

Description

@ssfdust

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)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions