|
1 | 1 | // Copyright (c) Microsoft Corporation. All rights reserved.
|
2 | 2 | // Licensed under the MIT License.
|
3 | 3 |
|
4 |
| -import { Event, EventEmitter } from 'vscode'; |
| 4 | +import { Event, EventEmitter, workspace } from 'vscode'; |
5 | 5 | import '../../../../common/extensions';
|
6 | 6 | import { createDeferred, Deferred } from '../../../../common/utils/async';
|
7 | 7 | import { StopWatch } from '../../../../common/utils/stopWatch';
|
@@ -277,7 +277,14 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
|
277 | 277 | }
|
278 | 278 | this.telemetrySentOnce = true;
|
279 | 279 | const { elapsedTime } = stopWatch;
|
280 |
| - const envs = this.cache.getAllEnvs(); |
| 280 | + const workspaceFolders = workspace.workspaceFolders || []; |
| 281 | + const query: PythonLocatorQuery = { |
| 282 | + searchLocations: { |
| 283 | + roots: workspaceFolders.map((w) => w.uri), |
| 284 | + }, |
| 285 | + }; |
| 286 | + |
| 287 | + const envs = this.getEnvs(workspaceFolders.length ? query : undefined); |
281 | 288 |
|
282 | 289 | const nativeEnvs = [];
|
283 | 290 | const executablesFoundByNativeLocator = new Set<string>();
|
@@ -485,6 +492,7 @@ export class EnvsCollectionService extends PythonEnvsWatcher<PythonEnvCollection
|
485 | 492 | // Intent is to capture time taken for discovery of all envs to complete the first time.
|
486 | 493 | sendTelemetryEvent(EventName.PYTHON_INTERPRETER_DISCOVERY, elapsedTime, {
|
487 | 494 | nativeDuration,
|
| 495 | + workspaceFolderCount: (workspace.workspaceFolders || []).length, |
488 | 496 | interpreters: this.cache.getAllEnvs().length,
|
489 | 497 | environmentsWithoutPython,
|
490 | 498 | activeStateEnvs,
|
|
0 commit comments