aboutsummaryrefslogtreecommitdiff
path: root/runtime/lua/vim/lsp.lua
diff options
context:
space:
mode:
authorDavid Hotham <david.hotham@metaswitch.com>2021-10-31 19:05:57 +0000
committerGitHub <noreply@github.com>2021-10-31 12:05:57 -0700
commit98f578293b58b66e2314f5cd0f61c3d2d0ba90e2 (patch)
tree3c78ecd47d84b99c5f6b47caf3cb9c672b10b156 /runtime/lua/vim/lsp.lua
parent478748881f535ba54178622f2d9789e131641ac2 (diff)
downloadrneovim-98f578293b58b66e2314f5cd0f61c3d2d0ba90e2.tar.gz
rneovim-98f578293b58b66e2314f5cd0f61c3d2d0ba90e2.tar.bz2
rneovim-98f578293b58b66e2314f5cd0f61c3d2d0ba90e2.zip
fix(lsp): don't update active_clients on exit_timeout (#16192)
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r--runtime/lua/vim/lsp.lua19
1 files changed, 11 insertions, 8 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua
index 3e73ae7b78..a77dc8a13f 100644
--- a/runtime/lua/vim/lsp.lua
+++ b/runtime/lua/vim/lsp.lua
@@ -1255,27 +1255,30 @@ function lsp._vim_exit_handler()
send_kill = true
timeouts[client_id] = timeout
max_timeout = math.max(timeout, max_timeout)
- else
- active_clients[client_id] = nil
end
end
local poll_time = 50
local function check_clients_closed()
+ for client_id, timeout in pairs(timeouts) do
+ timeouts[client_id] = timeout - poll_time
+ end
+
for client_id, _ in pairs(active_clients) do
- timeouts[client_id] = timeouts[client_id] - poll_time
- if timeouts[client_id] < 0 then
- active_clients[client_id] = nil
+ if timeouts[client_id] ~= nil and timeouts[client_id] > 0 then
+ return false
end
end
- return tbl_isempty(active_clients)
+ return true
end
if send_kill then
if not vim.wait(max_timeout, check_clients_closed, poll_time) then
- for _, client in pairs(active_clients) do
- client.stop(true)
+ for client_id, client in pairs(active_clients) do
+ if timeouts[client_id] ~= nil then
+ client.stop(true)
+ end
end
end
end