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(

View File

@@ -109,7 +109,7 @@ body {
it('clears document colors when sole client detaches', function()
exec_lua(function()
vim.lsp.stop_client(client_id)
vim.lsp.get_client_by_id(client_id):stop()
end)
screen:expect({ grid = grid_without_colors })
@@ -176,7 +176,7 @@ body {
end)
exec_lua(function()
vim.lsp.stop_client(client_id2)
vim.lsp.get_client_by_id(client_id2):stop()
end)
screen:expect({ grid = grid_with_colors, unchanged = true })
@@ -192,7 +192,7 @@ body {
)
exec_lua(function()
vim.lsp.stop_client(client_id)
vim.lsp.get_client_by_id(client_id):stop()
end)
eq(

View File

@@ -116,7 +116,7 @@ int main() {
it('clears inlay hints when sole client detaches', function()
exec_lua(function()
vim.lsp.stop_client(client_id)
vim.lsp.get_client_by_id(client_id):stop()
end)
screen:expect({ grid = grid_without_inlay_hints, unchanged = true })
end)
@@ -139,7 +139,7 @@ int main() {
end)
exec_lua(function()
vim.lsp.stop_client(client_id2)
vim.lsp.get_client_by_id(client_id2):stop()
end)
screen:expect({ grid = grid_with_inlay_hints, unchanged = true })
end)
@@ -422,7 +422,7 @@ test text
exec_lua([[vim.lsp.inlay_hint.enable(true, { bufnr = bufnr })]])
screen:expect({ grid = grid_with_inlay_hints })
exec_lua(function()
vim.lsp.stop_client(client_id)
vim.lsp.get_client_by_id(client_id):stop()
end)
screen:expect({ grid = grid_without_inlay_hints, unchanged = true })
end)