From 727fc415edad27d2664866543a2e4788e10fd927 Mon Sep 17 00:00:00 2001 From: Raphael Date: Thu, 25 Aug 2022 06:00:56 +0800 Subject: fix: LspStop should be only stop the current buffer servers by default (#2082) * fix: LspStop should be only stop the current buffer server by default * fix: check filetypes in if statement --- plugin/lspconfig.lua | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'plugin/lspconfig.lua') diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua index bb79da1e..117e51e9 100644 --- a/plugin/lspconfig.lua +++ b/plugin/lspconfig.lua @@ -86,8 +86,12 @@ end, { }) vim.api.nvim_create_user_command('LspStop', function(info) + local current_buf = vim.api.nvim_get_current_buf() for _, client in ipairs(get_clients_from_cmd_args(info.args)) do - client.stop() + local filetypes = client.config.filetypes + if filetypes and vim.tbl_contains(filetypes, vim.bo[current_buf].filetype) then + client.stop() + end end end, { desc = 'Manually stops the given language client(s)', -- cgit v1.2.3-70-g09d2