diff options
| author | glepnir <glephunter@gmail.com> | 2024-11-26 14:19:10 +0800 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2024-11-26 14:19:10 +0800 |
| commit | fe88eade4ab50fca9ace99205cad1d91645ed9e8 (patch) | |
| tree | 3eeef4996ab80d09b81e82672141f5f4e7182608 /lua | |
| parent | fix: outdated references to 'lspconfig.ui.windows' #3454 (diff) | |
| download | nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.tar nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.tar.gz nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.tar.bz2 nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.tar.lz nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.tar.xz nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.tar.zst nvim-lspconfig-fe88eade4ab50fca9ace99205cad1d91645ed9e8.zip | |
fix: check existing_client support workspaceFolder (#3452)
if existing_client does not support workpaceFolder
should spawn a new server instance
Diffstat (limited to 'lua')
| -rw-r--r-- | lua/lspconfig/manager.lua | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/lua/lspconfig/manager.lua b/lua/lspconfig/manager.lua index d5db2833..ca24d31c 100644 --- a/lua/lspconfig/manager.lua +++ b/lua/lspconfig/manager.lua @@ -58,12 +58,10 @@ end --- @param root_dir string --- @param client vim.lsp.Client function M:_notify_workspace_folder_added(root_dir, client) - if is_dir_in_workspace_folders(client, root_dir) then - return - end - - local supported = vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported') - if not supported then + if + is_dir_in_workspace_folders(client, root_dir) + or not vim.tbl_get(client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported') + then return end @@ -132,6 +130,10 @@ function M:_start_client(bufnr, new_config, root_dir, single_file, silent) bufnr = bufnr, silent = silent, reuse_client = function(existing_client) + if not vim.tbl_get(existing_client, 'server_capabilities', 'workspace', 'workspaceFolders', 'supported') then + return false + end + if (self._clients[root_dir] or {})[existing_client.name] then self:_notify_workspace_folder_added(root_dir, existing_client) return true |
