aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--doc/lspconfig.txt3
-rw-r--r--plugin/lspconfig.lua15
2 files changed, 14 insertions, 4 deletions
diff --git a/doc/lspconfig.txt b/doc/lspconfig.txt
index 8144b708..5a387a97 100644
--- a/doc/lspconfig.txt
+++ b/doc/lspconfig.txt
@@ -467,7 +467,8 @@ contained in `:LspInfo`:
if it successfully resolves a root directory. Note: Defaults to all
configured servers matching the current buffer filetype.
- `:LspStop <client_id>` stops the server with the given client id. Defaults to
- stopping all servers active on the current buffer.
+ stopping all servers active on the current buffer. if you want to force stop
+ a language server you can do it like `:LspStop <client_id> ++force`
- `:LspRestart <client_id>` restarts the client with the given client id, and
will attempt to reattach to all previously attached buffers.
diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua
index 5526264c..d8c77493 100644
--- a/plugin/lspconfig.lua
+++ b/plugin/lspconfig.lua
@@ -117,19 +117,28 @@ end, {
api.nvim_create_user_command('LspStop', function(info)
local current_buf = vim.api.nvim_get_current_buf()
- local server_name = string.len(info.args) > 0 and info.args or nil
+ local server_name, force
+ local arguments = vim.split(info.args, '%s')
+ for _, v in pairs(arguments) do
+ if v == '++force' then
+ force = true
+ end
+ if v:find '%(' then
+ server_name = v
+ end
+ end
if not server_name then
local servers_on_buffer = lsp.get_active_clients { buffer = current_buf }
for _, client in ipairs(servers_on_buffer) do
local filetypes = client.config.filetypes
if filetypes and vim.tbl_contains(filetypes, vim.bo[current_buf].filetype) then
- client.stop()
+ client.stop(force)
end
end
else
for _, client in ipairs(get_clients_from_cmd_args(server_name)) do
- client.stop()
+ client.stop(force)
end
end
end, {