Fix ${workspaceFolder} resolution and relative path handling for defaultInterpreterPath#1603
Open
Copilot wants to merge 4 commits into
Open
Fix ${workspaceFolder} resolution and relative path handling for defaultInterpreterPath#1603Copilot wants to merge 4 commits into
Copilot wants to merge 4 commits into
Conversation
…ultInterpreterPath
…ultInterpreterPath
Copilot
AI
changed the title
[WIP] Fix python.defaultInterpreterPath resolution issue on Windows
Fix python.defaultInterpreterPath ${workspaceFolder} resolution and workspace path duplication
Jun 23, 2026
Copilot
AI
changed the title
Fix python.defaultInterpreterPath ${workspaceFolder} resolution and workspace path duplication
Fix ${workspaceFolder} resolution and relative path handling for defaultInterpreterPath
Jun 23, 2026
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.
python.defaultInterpreterPathfailed to resolve in two cases:${workspaceFolder}was left unexpanded when VS Code couldn't determine the owning folder (e.g. Windows drive-letter casing), and relative paths were resolved against an unrelated CWD by the native finder—producing malformed, duplicated paths like<workspace>/<workspace-name>/.venv/....Changes
internalVariables.ts— WhengetWorkspaceFolder()returnsundefinedfor a project scope, fall back to the single open workspace folder so${workspaceFolder}still expands.interpreterSelection.ts— AddedtoAbsoluteInterpreterPath()to resolve relative interpreter paths against the workspace folder (with the same single-folder fallback) before handing them to the native finder. Absolute paths pass through unchanged.${workspaceFolder}single-folder fallback, multi-folder no-op, no-scope, and no-folders-open cases.Notes
resolveVariables()is separator-preserving string substitution, so the new assertions intentionally compare forward-slash inputs rather thanpath.join(). Relative-path expectations usepath.resolve()/Uri.file().fsPathto stay cross-platform.