fix: get promise value in timer, schedule cb

This commit is contained in:
əlemi 2024-09-17 01:53:55 +02:00
parent ecf58046b5
commit d98f6707d0
Signed by: alemi
GPG key ID: A4895B84D311642C

View file

@ -22,7 +22,8 @@ local function async_poller(generator, callback)
timer:start(500, 500, function()
if promise == nil then promise = generator() end
if promise.ready then
vim.schedule(function() callback(promise:await()) end)
local res = promise:await()
vim.schedule(function() callback(res) end)
promise = nil
end
end)