neovim

Neovim text editor
git clone https://git.dasho.dev/neovim.git
Log | Files | Refs | README

commit e5c5b563ec1e2076b950e80dd5522187ca53b699
parent 3165e94a64b0b62a1d38b41969be57365dc516b6
Author: Kai-Hsiang Hsu <john801205@users.noreply.github.com>
Date:   Fri,  6 Jun 2025 21:26:50 +0800

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.
Diffstat:
Mruntime/lua/vim/lsp.lua | 4+++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua @@ -541,7 +541,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