fix(async): make asyncs abortable

This commit is contained in:
Folke Lemaitre 2024-06-30 13:35:11 +02:00
parent c882227f1f
commit 1fad61712b
No known key found for this signature in database
GPG key ID: 41F8B1FBACAE2040
7 changed files with 29 additions and 8 deletions

View file

@ -252,7 +252,7 @@ end
---@param fn fun(self?)
---@param desc? string
---@param mode? string[]
function M:on_key(key, fn, desc,mode)
function M:on_key(key, fn, desc, mode)
vim.keymap.set(mode or "n", key, function()
fn(self)
end, {
@ -295,6 +295,7 @@ function M:close(opts)
vim.diagnostic.reset(Config.ns, buf)
vim.api.nvim_buf_delete(buf, { force = true })
end
vim.cmd.redraw()
end)
end

View file

@ -83,6 +83,7 @@ function M.create()
vim.keymap.set("n", ViewConfig.keys.abort, function()
require("lazy.manage.process").abort()
require("lazy.async").abort()
return ViewConfig.keys.abort
end, { silent = true, buffer = self.buf, expr = true })