aboutsummaryrefslogtreecommitdiffstats
path: root/plugin/lspconfig.lua
diff options
context:
space:
mode:
authorMarkus Koller <markus@snafu.ch>2025-06-10 16:14:18 +0200
committerGitHub <noreply@github.com>2025-06-10 07:14:18 -0700
commit77d3fdfb3554632c7a3b101ded643d422de7626f (patch)
tree85b81e2071ee8cdd74b0ff5c871584e892bb55e5 /plugin/lspconfig.lua
parentfix: support :LspStart/LspStop without arguments #3890 (diff)
downloadnvim-lspconfig-2.3.0.tar
nvim-lspconfig-2.3.0.tar.gz
nvim-lspconfig-2.3.0.tar.bz2
nvim-lspconfig-2.3.0.tar.lz
nvim-lspconfig-2.3.0.tar.xz
nvim-lspconfig-2.3.0.tar.zst
nvim-lspconfig-2.3.0.zip
fix: support :LspRestart without arguments #3895v2.3.0
Problem: After the refactoring in e4d1c8b for Neovim 0.11.2 this command now requires an argument. Solution: Restore the previous behaviour where `:LspRestart` defaults to restarting all active servers.
Diffstat (limited to 'plugin/lspconfig.lua')
-rw-r--r--plugin/lspconfig.lua20
1 files changed, 16 insertions, 4 deletions
diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua
index a5cd4715..7cde1386 100644
--- a/plugin/lspconfig.lua
+++ b/plugin/lspconfig.lua
@@ -120,9 +120,21 @@ if vim.version.ge(vim.version(), { 0, 11, 2 }) then
})
api.nvim_create_user_command('LspRestart', function(info)
- for _, name in ipairs(info.fargs) do
+ local clients = info.fargs
+
+ -- Default to restarting all active servers
+ if #clients == 0 then
+ clients = vim
+ .iter(vim.lsp.get_clients())
+ :map(function(client)
+ return client.name
+ end)
+ :totable()
+ end
+
+ for _, name in ipairs(clients) do
if vim.lsp.config[name] == nil then
- vim.notify(("Invalid server name '%s'"):format(info.args))
+ vim.notify(("Invalid server name '%s'"):format(name))
else
vim.lsp.enable(name, false)
end
@@ -130,7 +142,7 @@ if vim.version.ge(vim.version(), { 0, 11, 2 }) then
local timer = assert(vim.uv.new_timer())
timer:start(500, 0, function()
- for _, name in ipairs(info.fargs) do
+ for _, name in ipairs(clients) do
vim.schedule_wrap(function(x)
vim.lsp.enable(x)
end)(name)
@@ -138,7 +150,7 @@ if vim.version.ge(vim.version(), { 0, 11, 2 }) then
end)
end, {
desc = 'Restart the given client(s)',
- nargs = '+',
+ nargs = '*',
complete = complete_client,
})