From 95b7a69bc6da2a6a740584ea3c555e5327638b7d Mon Sep 17 00:00:00 2001 From: Rational-Curiosity Date: Wed, 1 Mar 2023 13:21:53 +0100 Subject: fix(commands): Strange `LspStop` arguments, not matching doc (#2486) fix LspStop command receive params bug. --- plugin/lspconfig.lua | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'plugin/lspconfig.lua') diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua index 8f67f67a..09d80c69 100644 --- a/plugin/lspconfig.lua +++ b/plugin/lspconfig.lua @@ -117,18 +117,17 @@ end, { api.nvim_create_user_command('LspStop', function(info) local current_buf = vim.api.nvim_get_current_buf() - local server_name, force + local server_id, 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 + elseif v:find '^[0-9]+$' then + server_id = v end end - if not server_name then + if not server_id then local servers_on_buffer = lsp.get_active_clients { bufnr = current_buf } for _, client in ipairs(servers_on_buffer) do if client.attached_buffers[current_buf] then @@ -136,7 +135,7 @@ api.nvim_create_user_command('LspStop', function(info) end end else - for _, client in ipairs(get_clients_from_cmd_args(server_name)) do + for _, client in ipairs(get_clients_from_cmd_args(server_id)) do client.stop(force) end end -- cgit v1.2.3-70-g09d2