Repository navigation
Fix global interpreter selection readback routing (#1922) - #1924
Open
Aadi Jain (Thrizzio) wants to merge 1 commit into
Open
Aadi Jain (Thrizzio) wants to merge 1 commit into
Aadi Jain (Thrizzio) wants to merge 1 commit into
Conversation
Prefer cached global environment manager over default manager when resolving global context. Ensure getEnvironment(undefined) and Python Projects sidebar reflect cross-manager selections. Add regression test for cross-manager global selection.
Author
|
@microsoft-github-policy-service agree |
Author
|
Hi Bill Schnurr (@bschnurr), Eduardo Villalpando Mello (@edvilme), and Rich Chiodo (@rchiodo), I've opened this PR to address #1922. The fix addresses global interpreter selection readback when the selected environment belongs to a different manager than the configured default. I've added regression coverage and run the unit tests, compilation, lint, and diff checks. I've also manually tested the selection flow in an empty VS Code window. If screenshots or a short recording of the manual verification would be helpful, I'm happy to add them. Thank you for your time! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Fixes #1922
Fixes inconsistent global Python interpreter selection readback when the selected interpreter belongs to a different environment manager than the configured default.
In an empty VS Code window, selecting a non-venv interpreter (e.g. system or Conda) while
ms-python.python:venvis the configured default could cause subsequent calls togetEnvironmentManager(undefined)andgetEnvironment(undefined)to resolve through the venv manager instead of the manager associated with the selected environment.Root Cause
Global interpreter selections are cached in
_activeSelectionunder the global selection key. However,getConfiguredOrCachedEnvironmentManager()previously preferred the configured default manager over the manager associated with the cached global selection.As a result, the configured default manager took precedence during subsequent global environment readback, even when the active selection belonged to another manager.
Changes
src/features/envManagers.ts:context === undefined), provided that manager is registered.getEnvironment(undefined)without writing manager defaults into User Settings.src/test/features/envManagers.unit.test.ts:ms-python.python:venv.getEnvironment(undefined)use the selected system interpreter's manager rather than the configured venv manager.Related Issues (Context Only)
Verification
2842 passing, 12 pending, 0 failing).npm run compile-tests && npm run unittest(Pass)npm run compile(Pass)npm run lint(Pass)git diff --check(Pass)Python Projects > Globalsidebar view and subsequent readbacks immediately synchronize with the chosen environment.