feat(lsp): deprecate vim.lsp.stop_client (#36459)

* feat(lsp): deprecate `vim.lsp.stop_client`

* fix(tests): fix nil variable in diagnostic_spec.lua
This commit is contained in:
Olivia Kinnear
2025-11-10 20:27:13 -06:00
committed by GitHub
parent 637c9c4f5f
commit 7c9b865bdd
7 changed files with 36 additions and 74 deletions

View File

@@ -129,7 +129,7 @@ describe('vim.lsp.diagnostic', function()
}, { client_id = client_id })
local diags = vim.diagnostic.get(diagnostic_bufnr)
vim.lsp.stop_client(client_id)
vim.lsp.get_client_by_id(client_id):stop()
vim.api.nvim_exec_autocmds('VimLeavePre', { modeline = false })
return diags
end)
@@ -361,7 +361,7 @@ describe('vim.lsp.diagnostic', function()
)
exec_lua(function()
vim.lsp.stop_client(client_id)
vim.lsp.get_client_by_id(client_id):stop()
end)
eq(
@@ -373,9 +373,8 @@ describe('vim.lsp.diagnostic', function()
end)
it('keeps diagnostics when one client detaches and others still are attached', function()
local client_id2
exec_lua(function()
client_id2 = vim.lsp.start({ name = 'dummy2', cmd = _G.server.cmd })
_G.client_id2 = vim.lsp.start({ name = 'dummy2', cmd = _G.server.cmd })
vim.lsp.diagnostic.on_diagnostic(nil, {
kind = 'full',
@@ -400,7 +399,7 @@ describe('vim.lsp.diagnostic', function()
)
exec_lua(function()
vim.lsp.stop_client(client_id2)
vim.lsp.get_client_by_id(_G.client_id2):stop()
end)
eq(