From 4bb563d835081dc991503fc55f0e82a9007845a5 Mon Sep 17 00:00:00 2001 From: Raphael Date: Mon, 12 Jun 2023 21:15:11 +0800 Subject: fix: lsprestart only restart client which have attached buffer (#2669) --- plugin/lspconfig.lua | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'plugin') diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua index 09d80c69..5afd0895 100644 --- a/plugin/lspconfig.lua +++ b/plugin/lspconfig.lua @@ -90,7 +90,9 @@ api.nvim_create_user_command('LspRestart', function(info) local detach_clients = {} for _, client in ipairs(get_clients_from_cmd_args(info.args)) do client.stop() - detach_clients[client.name] = client + if #client.attached_buffers > 0 then + detach_clients[client.name] = client + end end local timer = vim.loop.new_timer() timer:start( -- cgit v1.2.3-70-g09d2