aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
Diffstat (limited to 'plugin')
-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,
})