mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-04 02:38:46 +00:00
fix(picker.lsp): schedule_wrap cancel functions and resume when no clients
This commit is contained in:
parent
dfcf27e2a9
commit
6cbca8adff
1 changed files with 10 additions and 5 deletions
|
@ -112,13 +112,18 @@ function M.request(buf, method, params, cb)
|
|||
local async = Async.running()
|
||||
local cancel = {} ---@type fun()[]
|
||||
|
||||
async:on("abort", function()
|
||||
for _, c in ipairs(cancel) do
|
||||
c()
|
||||
end
|
||||
end)
|
||||
async:on(
|
||||
"abort",
|
||||
vim.schedule_wrap(function()
|
||||
vim.tbl_map(pcall, cancel)
|
||||
cancel = {}
|
||||
end)
|
||||
)
|
||||
vim.schedule(function()
|
||||
local clients = M.get_clients(buf, method)
|
||||
if vim.tbl_isempty(clients) then
|
||||
return async:resume()
|
||||
end
|
||||
local remaining = #clients
|
||||
for _, client in ipairs(clients) do
|
||||
local p = params(client)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue