fix: wait for init to finish before finding file

fixes #1003
This commit is contained in:
kiyan
2022-02-20 22:20:02 +01:00
parent 83f398ee8f
commit e1c6a575c0

View File

@@ -15,16 +15,19 @@ local M = {
TreeExplorer = nil TreeExplorer = nil
function M.init(with_open, foldername) function M.init(with_open, foldername)
local init_done = false
TreeExplorer = explorer.Explorer.new(foldername) TreeExplorer = explorer.Explorer.new(foldername)
TreeExplorer:init(function() TreeExplorer:init(function()
if with_open then if with_open then
M.open() M.open()
end end
init_done = true
if not first_init_done then if not first_init_done then
events._dispatch_ready() events._dispatch_ready()
first_init_done = true first_init_done = true
end end
end) end)
while not vim.wait(10, function() return init_done end, 10) do end
end end
local function get_node_at_line(line) local function get_node_at_line(line)