Repository navigation
Environments: synchronize the public active environment API - #26204
Draft
Eleanor Boyd (eleanorjboyd) wants to merge 2 commits into
Draft
Eleanor Boyd (eleanorjboyd) wants to merge 2 commits into
Eleanor Boyd (eleanorjboyd) wants to merge 2 commits into
Conversation
Route public environment selection through the Python Environments extension when integration is enabled, and keep the synchronous getter aligned with its authoritative selection state.\n\nCo-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Comment on lines
+81
to
+84
| export function getCachedEnvExtApi(): PythonEnvironmentApi | undefined { | ||
| return _extApi; | ||
| } | ||
|
|
There was a problem hiding this comment.
Why not use the getEnvExtApi which automatically returns cached _extApi?
Comment on lines
+164
to
+165
| getWorkspaceFolders()?.forEach((folder) => | ||
| cacheActiveEnvExtPath(folder.uri, envExtApi.getEnvironmentSync(folder.uri)), |
There was a problem hiding this comment.
Suggested change
| getWorkspaceFolders()?.forEach((folder) => | |
| cacheActiveEnvExtPath(folder.uri, envExtApi.getEnvironmentSync(folder.uri)), | |
| getWorkspaceFolders()?.forEach(({uri}) => | |
| cacheActiveEnvExtPath(uri, envExtApi.getEnvironmentSync(uri)), |
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
updateActiveEnvironmentPath()through the Python Environments extension when integration is enabledgetActiveEnvironmentPath()from the Environments extension last-known selectionWhy
Fixes microsoft/vscode-python-environments#1896. The public Python API currently reads and writes legacy configuration state while integrated run, debug, and terminal execution use the Python Environments extension selection state. This makes the reported selection diverge from the interpreter actually used.
Coordinated API addition: microsoft/vscode-python-environments#1898.
Validation
npx gulp prePublishNonBundlenpm run test:unittests -- --grep Python Environment API(23 passing)