aboutsummaryrefslogtreecommitdiffstats
path: root/lua/lspconfig/util.lua
diff options
context:
space:
mode:
authorRaphael <glepnir@neovim.pro>2022-12-09 06:08:39 +0800
committerGitHub <noreply@github.com>2022-12-09 06:08:39 +0800
commitb03ff434790b42b03a6c34b97ba0c5dd0afe5142 (patch)
tree2fe05239c43011fce6d789d7ab2fc9a329679ac0 /lua/lspconfig/util.lua
parentfix: improve client stop logic in LspStop (#2296) (diff)
downloadnvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.tar
nvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.tar.gz
nvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.tar.bz2
nvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.tar.lz
nvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.tar.xz
nvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.tar.zst
nvim-lspconfig-b03ff434790b42b03a6c34b97ba0c5dd0afe5142.zip
fix: add new root into the workspace folders (#2298)
* fix: add the new root to workspaceFolders * fix: add the new root to workspaceFolders
Diffstat (limited to 'lua/lspconfig/util.lua')
-rw-r--r--lua/lspconfig/util.lua15
1 files changed, 9 insertions, 6 deletions
diff --git a/lua/lspconfig/util.lua b/lua/lspconfig/util.lua
index a1f04bec..00f5a7a1 100644
--- a/lua/lspconfig/util.lua
+++ b/lua/lspconfig/util.lua
@@ -250,12 +250,15 @@ function M.server_per_root_dir_manager(make_config)
-- Check if we have a client already or start and store it.
if not client_id then
local new_config = make_config(root_dir)
- if next(clients) ~= nil then
- for _, id in pairs(clients) do
- local client = lsp.get_client_by_id(id)
- if client.name == new_config.name then
- return id
- end
+ if clients[1] then
+ local client = lsp.get_client_by_id(clients[1])
+ if client.name == new_config.name then
+ local params = lsp.util.make_workspace_params(
+ { { uri = vim.uri_from_fname(root_dir), name = root_dir } },
+ { {} }
+ )
+ table.insert(client.workspace_folders, params.event.added[1])
+ return clients[1]
end
end
-- do nothing if the client is not enabled