From 35e1d638712d473fa556f01e9af667a2a7fb92e9 Mon Sep 17 00:00:00 2001 From: Kim Santiago <31145923+kisantia@users.noreply.github.com> Date: Thu, 13 Apr 2023 09:49:14 -0700 Subject: [PATCH] fix project listed twice when using multi root workspaces (#22705) * fix project listed twice when using multi root workspaces * uppercase --- .../data-workspace/src/services/workspaceService.ts | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/extensions/data-workspace/src/services/workspaceService.ts b/extensions/data-workspace/src/services/workspaceService.ts index f6d198f822..18d138a140 100644 --- a/extensions/data-workspace/src/services/workspaceService.ts +++ b/extensions/data-workspace/src/services/workspaceService.ts @@ -168,7 +168,13 @@ export class WorkspaceService implements IWorkspaceService { try { const projectPromises = vscode.workspace.workspaceFolders?.map(f => this.getAllProjectsInFolder(f.uri)) ?? []; - this.openedProjects = (await Promise.all(projectPromises)).reduce((prev, curr) => prev.concat(curr), []); + const allProjects = (await Promise.all(projectPromises)).reduce((prev, curr) => prev.concat(curr), []); + + // convert to Set to make sure all the fsPaths are unique so projects aren't listed multiple times if they are included by multiple workspace folders. + // Need to use fsPath for the set to be able to filter out duplicates because it's a string, rather than the vscode.Uri + const uniqueProjects = [...new Set(allProjects.map(p => p.fsPath))]; + this.openedProjects = uniqueProjects.map(p => vscode.Uri.file(p)); + this.getProjectsPromise.resolve(); } catch (err) { this.getProjectsPromise.reject(err);