mirror of
https://github.com/neovim/neovim
synced 2025-07-15 16:51:49 +00:00
fix(lsp): only auto-detach lsp.config enabled clients #34325
Problem: A custom server (initialized through `vim.lsp.start`) gets
unexpectedly detached.
Solution: Only auto-detach the clients enabled through `vim.lsp.enable`
to prevent unexpected behavior.
(cherry picked from commit e5c5b563ec
)
This commit is contained in:
committed by
github-actions[bot]
parent
d32a4dd4b0
commit
c13eba5254
@ -523,7 +523,9 @@ local function lsp_enable_callback(bufnr)
|
||||
-- Stop any clients that no longer apply to this buffer.
|
||||
local clients = lsp.get_clients({ bufnr = bufnr, _uninitialized = true })
|
||||
for _, client in ipairs(clients) do
|
||||
if lsp.config[client.name] and not can_start(bufnr, client.name, lsp.config[client.name]) then
|
||||
if
|
||||
lsp.is_enabled(client.name) and not can_start(bufnr, client.name, lsp.config[client.name])
|
||||
then
|
||||
lsp.buf_detach_client(bufnr, client.id)
|
||||
end
|
||||
end
|
||||
|
Reference in New Issue
Block a user