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

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,12 +100,14 @@ api.nvim_create_user_command('LspRestart', function(info)
100, 100,
vim.schedule_wrap(function() vim.schedule_wrap(function()
for client_name, tuple in pairs(detach_clients) do for client_name, tuple in pairs(detach_clients) do
local client, attached_buffers = unpack(tuple) if require('lspconfig.configs')[client_name] then
if client.is_stopped() then local client, attached_buffers = unpack(tuple)
for buf in pairs(attached_buffers) do if client.is_stopped() then
require('lspconfig.configs')[client_name].launch(buf) for _, buf in pairs(attached_buffers) do
require('lspconfig.configs')[client_name].launch(buf)
end
detach_clients[client_name] = nil
end end
detach_clients[client_name] = nil
end end
end end