fix: stuck input control if callback fails (#158)

This commit is contained in:
emmanueltouzery 2024-05-22 22:48:25 +02:00 committed by GitHub
parent 572314728c
commit 3c38ac861e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -200,8 +200,10 @@ M.make_queued_async_fn = function(callback_arg_num, fn)
args[callback_arg_num] = function(...)
local cb_args = vim.F.pack_len(...)
vim.schedule(function()
cb(vim.F.unpack_len(cb_args))
-- first schedule the consumption, only later invoke
-- the callback, because the callback could fail
vim.schedule(consume)
cb(vim.F.unpack_len(cb_args))
end)
end
table.insert(queue, args)