mirror of
https://github.com/folke/snacks.nvim
synced 2025-08-05 11:18:26 +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 async = Async.running()
|
||||||
local cancel = {} ---@type fun()[]
|
local cancel = {} ---@type fun()[]
|
||||||
|
|
||||||
async:on("abort", function()
|
async:on(
|
||||||
for _, c in ipairs(cancel) do
|
"abort",
|
||||||
c()
|
vim.schedule_wrap(function()
|
||||||
end
|
vim.tbl_map(pcall, cancel)
|
||||||
end)
|
cancel = {}
|
||||||
|
end)
|
||||||
|
)
|
||||||
vim.schedule(function()
|
vim.schedule(function()
|
||||||
local clients = M.get_clients(buf, method)
|
local clients = M.get_clients(buf, method)
|
||||||
|
if vim.tbl_isempty(clients) then
|
||||||
|
return async:resume()
|
||||||
|
end
|
||||||
local remaining = #clients
|
local remaining = #clients
|
||||||
for _, client in ipairs(clients) do
|
for _, client in ipairs(clients) do
|
||||||
local p = params(client)
|
local p = params(client)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue