fix(command): check server config exist in lspconfig ()

This commit is contained in:
glepnir 2024-04-29 16:09:54 +08:00 committed by GitHub
parent 559a7e8c6c
commit ae0651d850
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -100,14 +100,16 @@ api.nvim_create_user_command('LspRestart', function(info)
100,
vim.schedule_wrap(function()
for client_name, tuple in pairs(detach_clients) do
if require('lspconfig.configs')[client_name] then
local client, attached_buffers = unpack(tuple)
if client.is_stopped() then
for buf in pairs(attached_buffers) do
for _, buf in pairs(attached_buffers) do
require('lspconfig.configs')[client_name].launch(buf)
end
detach_clients[client_name] = nil
end
end
end
if next(detach_clients) == nil and not timer:is_closing() then
timer:close()