aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorRaphael <glepnir@neovim.pro>2022-12-07 20:21:21 +0800
committerGitHub <noreply@github.com>2022-12-07 20:21:21 +0800
commit23c72d4da3656af72aba5950e5ad7c85dbca71f2 (patch)
treeba4ec3bc488bb6bb5441d2260f0f6be1caff61f6 /plugin
parentfix: typo of vim.loop.cwd (#2293) (diff)
downloadnvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.tar
nvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.tar.gz
nvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.tar.bz2
nvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.tar.lz
nvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.tar.xz
nvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.tar.zst
nvim-lspconfig-23c72d4da3656af72aba5950e5ad7c85dbca71f2.zip
feat: support force stop language server (#2294)
* feat: support force stop language server * feat: use vim syntax * feat: update doc
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lspconfig.lua15
1 files changed, 12 insertions, 3 deletions
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, {