Fix invalid temporary text

This commit is contained in:
hrsh7th
2021-08-27 23:06:35 +09:00
parent 61984efaf0
commit 405581e740
5 changed files with 27 additions and 4 deletions

View File

@@ -51,5 +51,20 @@ async.dedup = function()
end
end
---Wiat for callback.
---@param runner fun(done: function)
---@param timeout number
---@return any
async.sync = function(runner, timeout)
local done = false
local res = runner(function()
done = true
end)
vim.wait(timeout or 1000, function()
return done
end, 100, false)
return res
end
return async