Skip to content

Commit e3bf458

Browse files
author
Kartik Raj
authored
Return union of all envs from all workspace folders (microsoft#18967)
1 parent 3e7bdf5 commit e3bf458

1 file changed

Lines changed: 8 additions & 10 deletions

File tree

src/client/pythonEnvironments/legacyIOC.ts

Lines changed: 8 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -245,9 +245,13 @@ class ComponentAdapter implements IComponentAdapter {
245245
this.refreshing.fire();
246246

247247
const query: PythonLocatorQuery = {};
248+
let roots: vscode.Uri[] = [];
248249
let wsFolder: vscode.WorkspaceFolder | undefined;
249250
if (resource !== undefined) {
250251
wsFolder = vscode.workspace.getWorkspaceFolder(resource);
252+
if (wsFolder) {
253+
roots = [wsFolder.uri];
254+
}
251255
}
252256
// Untitled files should still use the workspace as the query location
253257
if (
@@ -256,18 +260,12 @@ class ComponentAdapter implements IComponentAdapter {
256260
vscode.workspace.workspaceFolders.length > 0 &&
257261
(!resource || resource.scheme === 'untitled')
258262
) {
259-
[wsFolder] = vscode.workspace.workspaceFolders;
263+
roots = vscode.workspace.workspaceFolders.map((w) => w.uri);
260264
}
261265

262-
if (wsFolder !== undefined) {
263-
query.searchLocations = {
264-
roots: [wsFolder.uri],
265-
};
266-
} else {
267-
query.searchLocations = {
268-
roots: [],
269-
};
270-
}
266+
query.searchLocations = {
267+
roots,
268+
};
271269

272270
let envs = this.api.getEnvs(query);
273271
if (source) {

0 commit comments

Comments
 (0)