aboutsummaryrefslogtreecommitdiffstats
path: root/plugin
diff options
context:
space:
mode:
authorRaphael <glepnir@neovim.pro>2023-06-14 21:02:33 +0800
committerGitHub <noreply@github.com>2023-06-14 21:02:33 +0800
commit295c646488d5baa63c6c4da68fe61171b9257375 (patch)
tree19961dec029841e6b3cfdcb127377db5ec6a7a09 /plugin
parentdocs: update server_configurations.md (diff)
downloadnvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.tar
nvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.tar.gz
nvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.tar.bz2
nvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.tar.lz
nvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.tar.xz
nvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.tar.zst
nvim-lspconfig-295c646488d5baa63c6c4da68fe61171b9257375.zip
fix(command): LspRestart should attached before buffers (#2674)
Diffstat (limited to 'plugin')
-rw-r--r--plugin/lspconfig.lua9
1 files changed, 6 insertions, 3 deletions
diff --git a/plugin/lspconfig.lua b/plugin/lspconfig.lua
index 5afd0895..b2e41461 100644
--- a/plugin/lspconfig.lua
+++ b/plugin/lspconfig.lua
@@ -91,7 +91,7 @@ api.nvim_create_user_command('LspRestart', function(info)
for _, client in ipairs(get_clients_from_cmd_args(info.args)) do
client.stop()
if #client.attached_buffers > 0 then
- detach_clients[client.name] = client
+ detach_clients[client.name] = { client, client.attached_buffers }
end
end
local timer = vim.loop.new_timer()
@@ -99,9 +99,12 @@ api.nvim_create_user_command('LspRestart', function(info)
500,
100,
vim.schedule_wrap(function()
- for client_name, client in pairs(detach_clients) do
+ for client_name, tuple in pairs(detach_clients) do
+ local client, attached_buffers = unpack(tuple)
if client.is_stopped() then
- require('lspconfig.configs')[client_name].launch()
+ for buf in pairs(attached_buffers) do
+ require('lspconfig.configs')[client_name].launch(buf)
+ end
detach_clients[client_name] = nil
end
end