mirror of
https://github.com/neovim/neovim.git
synced 2025-01-01 17:23:36 -07:00
Revert "lsp: fix blocking in closing of clients"
This reverts commit 2e6c09838f
.
* Fixes #14428
* This commit caused neovim to close while open handles to the uv timer
to kill active language servers were still open
This commit is contained in:
parent
be494023d8
commit
4eb29e079a
@ -1179,38 +1179,11 @@ function lsp._vim_exit_handler()
|
|||||||
client.stop()
|
client.stop()
|
||||||
end
|
end
|
||||||
|
|
||||||
local function wait_async(timeout, ms, predicate, cb)
|
if not vim.wait(500, function() return tbl_isempty(active_clients) end, 50) then
|
||||||
local timer = uv.new_timer()
|
for _, client in pairs(active_clients) do
|
||||||
local time = 0
|
client.stop(true)
|
||||||
|
|
||||||
local function done(in_time)
|
|
||||||
timer:stop()
|
|
||||||
timer:close()
|
|
||||||
cb(in_time)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
timer:start(0, ms, function()
|
|
||||||
if predicate() == true then
|
|
||||||
done(true)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
if time == timeout then
|
|
||||||
done(false)
|
|
||||||
return
|
|
||||||
end
|
|
||||||
|
|
||||||
time = time + ms
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
wait_async(500, 50, function() return tbl_isempty(active_clients) end, function(in_time)
|
|
||||||
if not in_time then
|
|
||||||
for _, client in pairs(active_clients) do
|
|
||||||
client.stop(true)
|
|
||||||
end
|
|
||||||
end
|
|
||||||
end)
|
|
||||||
end
|
end
|
||||||
|
|
||||||
nvim_command("autocmd VimLeavePre * lua vim.lsp._vim_exit_handler()")
|
nvim_command("autocmd VimLeavePre * lua vim.lsp._vim_exit_handler()")
|
||||||
|
Loading…
Reference in New Issue
Block a user