What
A user command (e.g. :LspToggle <client-name>) that stops or re-starts a specific LSP client for the current buffer without restarting Neovim.
Where
lua/config/plugin_config.lua — the LspAttach block and/or a new autocommand group. Would complement the existing LSP setup at lines 104–116.
Why it matters
The config enables several LSPs simultaneously, including both pyright and pyrefly for Python (see related audit issue). More generally, some LSPs are expensive (pyright on a large monorepo, rust_analyzer on a cold cache) and the user may want to temporarily silence one without editing config and reloading. Currently there is no ergonomic way to do this — the only escape hatch is :lua vim.lsp.stop_client(id) which requires knowing the numeric client ID.
A command like:
vim.api.nvim_create_user_command("LspToggle", function(opts)
local name = opts.args
for _, client in ipairs(vim.lsp.get_clients({ bufnr = 0, name = name })) do
vim.lsp.stop_client(client.id)
return
end
vim.lsp.enable(name) -- re-attach if it was stopped
end, { nargs = 1, complete = function()
return vim.tbl_map(function(c) return c.name end, vim.lsp.get_clients({ bufnr = 0 }))
end })
would let the user toggle an active client from the command line with tab-completion.
Suggested implementation sketch
What
A user command (e.g.
:LspToggle <client-name>) that stops or re-starts a specific LSP client for the current buffer without restarting Neovim.Where
lua/config/plugin_config.lua— theLspAttachblock and/or a new autocommand group. Would complement the existing LSP setup at lines 104–116.Why it matters
The config enables several LSPs simultaneously, including both
pyrightandpyreflyfor Python (see related audit issue). More generally, some LSPs are expensive (pyright on a large monorepo, rust_analyzer on a cold cache) and the user may want to temporarily silence one without editing config and reloading. Currently there is no ergonomic way to do this — the only escape hatch is:lua vim.lsp.stop_client(id)which requires knowing the numeric client ID.A command like:
would let the user toggle an active client from the command line with tab-completion.
Suggested implementation sketch
:LspToggle pyrefly— stops pyrefly on current buffer:LspToggle pyright— stops pyright, enabling pyrefly-only mode