diff options
author | Nicolas Hillegeer <nicolas@hillegeer.com> | 2022-07-12 09:44:11 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-07-12 09:44:11 +0200 |
commit | 0f1b17788eb584f41d59c12c968f5e1886655334 (patch) | |
tree | 74f014dcac5888cb4f112df197dfc094a19f400a /runtime/lua/vim/lsp.lua | |
parent | 8b75ca734541a42bf0d3f3fd8e39e94662084895 (diff) | |
download | rneovim-0f1b17788eb584f41d59c12c968f5e1886655334.tar.gz rneovim-0f1b17788eb584f41d59c12c968f5e1886655334.tar.bz2 rneovim-0f1b17788eb584f41d59c12c968f5e1886655334.zip |
fix(lsp): account for initializing servers in vim.lsp.start (#19329)
Fixes #19326
Diffstat (limited to 'runtime/lua/vim/lsp.lua')
-rw-r--r-- | runtime/lua/vim/lsp.lua | 10 |
1 files changed, 6 insertions, 4 deletions
diff --git a/runtime/lua/vim/lsp.lua b/runtime/lua/vim/lsp.lua index 29b077e3c0..0e72aae188 100644 --- a/runtime/lua/vim/lsp.lua +++ b/runtime/lua/vim/lsp.lua @@ -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) |