fix(lsp): account for initializing servers in vim.lsp.start (#19329)

Fixes #19326
This commit is contained in:
Nicolas Hillegeer 2022-07-12 09:44:11 +02:00 committed by GitHub
parent 8b75ca7345
commit 0f1b17788e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -739,10 +739,12 @@ function lsp.start(config, opts)
end
config.name = config.name or (config.cmd[1] and vim.fs.basename(config.cmd[1])) or nil
local bufnr = api.nvim_get_current_buf()
for _, client in pairs(lsp.get_active_clients()) do
if reuse_client(client, config) then
lsp.buf_attach_client(bufnr, client.id)
return client.id
for _, clients in ipairs({ uninitialized_clients, lsp.get_active_clients() }) do
for _, client in pairs(clients) do
if reuse_client(client, config) then
lsp.buf_attach_client(bufnr, client.id)
return client.id
end
end
end
local client_id = lsp.start_client(config)