You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Fast Pylance startup: don't block activation on environment enumeration (#26019)
## Related issue
Part of #26020
## Summary
Make Python interpreter resolution non-blocking so Pylance can start
immediately, even while the environment extension is doing a full
refresh on first run.
Previously, activation awaited interpreter auto-selection and
`getActiveInterpreter()` could block for the entire
environment-enumeration window (tens of seconds on large/conda setups),
which delayed the language server from starting.
## Changes
- **`interpreter/interpreterService.ts`** – `getActiveInterpreter()` now
races resolution against a ~100ms timeout. If discovery is slow it
returns the last-known/persisted interpreter immediately; the real
resolution still completes in the background and notifies listeners, so
the value self-corrects after a refresh. In-flight resolutions are
de-duplicated, and completion is reported via `onDidChange` so the
eventual interpreter propagates to Pylance without a server restart.
- **`activation/activationManager.ts`** – No longer blocks activation on
auto-select; it races a short timeout. Auto-selection still runs exactly
once and completes in the background.
- **`pythonEnvironments/.../conda.ts` + `pythonEnvironments/index.ts`**
– Add `Conda.setSkipDeepProbe(true)` when the environments extension
owns discovery, so startup no longer triggers slow sequential registry /
`conda info --json` probes (the env extension / PET already discovers
conda). `python.condaPath` remains an escape hatch.
- **`envExt/api.legacy.ts`** – De-duplicate in-flight active-interpreter
resolutions and keep reporting changes via
`reportActiveInterpreterChanged`.
- **`testing/testController/...`** – Defer project discovery and
self-heal on environment change instead of throwing `No Python
environment found` when an env hasn't been assigned yet during fast
startup.
## Tests
Updated/added unit tests for `activationManager`, `interpreterService`,
`conda`, the legacy env API, and the test controller.
## Notes
This is part of a cross-repo effort to speed up Pylance startup
(companion PRs in `vscode-python-environments` and the Pylance server).
---------
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
0 commit comments