mirror of
https://github.com/neovim/neovim.git
synced 2024-12-19 10:45:16 -07:00
fix(lsp): cancel watchers when closing a client
This commit is contained in:
parent
bf1e098d97
commit
816b56f878
@ -167,5 +167,14 @@ function M.unregister(unreg, ctx)
|
||||
end
|
||||
end
|
||||
|
||||
--- @param client_id integer
|
||||
function M.cancel(client_id)
|
||||
for _, reg_cancels in pairs(cancels[client_id]) do
|
||||
for _, cancel in pairs(reg_cancels) do
|
||||
cancel()
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
return M
|
||||
|
||||
|
@ -727,6 +727,7 @@ function Client:_stop(force)
|
||||
rpc.terminate()
|
||||
self._graceful_shutdown_failed = true
|
||||
end
|
||||
vim.lsp._watchfiles.cancel(self.id)
|
||||
end)
|
||||
end
|
||||
|
||||
|
@ -4573,6 +4573,8 @@ describe('LSP', function()
|
||||
|
||||
wait_for_message()
|
||||
|
||||
vim.lsp.stop_client(client_id)
|
||||
|
||||
return server.messages
|
||||
]],
|
||||
root_dir,
|
||||
@ -4581,7 +4583,7 @@ describe('LSP', function()
|
||||
|
||||
local uri = vim.uri_from_fname(root_dir .. '/watch')
|
||||
|
||||
eq(4, #result)
|
||||
eq(6, #result)
|
||||
|
||||
eq({
|
||||
method = 'workspace/didChangeWatchedFiles',
|
||||
|
Loading…
Reference in New Issue
Block a user