Skip to content

Fix ${workspaceFolder} resolution and relative path handling for defaultInterpreterPath#1603

Open
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-python-interpreter-resolution
Open

Fix ${workspaceFolder} resolution and relative path handling for defaultInterpreterPath#1603
Copilot wants to merge 4 commits into
mainfrom
copilot/fix-python-interpreter-resolution

Conversation

Copilot AI commented Jun 23, 2026

Copy link
Copy Markdown
Contributor

python.defaultInterpreterPath failed 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 — When getWorkspaceFolder() returns undefined for a project scope, fall back to the single open workspace folder so ${workspaceFolder} still expands.
  • interpreterSelection.ts — Added toAbsoluteInterpreterPath() 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.
  • Tests — Added unit coverage for the new edge cases:
    • ${workspaceFolder} single-folder fallback, multi-folder no-op, no-scope, and no-folders-open cases.
    • Relative path resolution via owning folder and via single-folder fallback, multi-folder pass-through, and absolute-path pass-through.

Notes

  • resolveVariables() is separator-preserving string substitution, so the new assertions intentionally compare forward-slash inputs rather than path.join(). Relative-path expectations use path.resolve() / Uri.file().fsPath to stay cross-platform.

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 requested a review from edvilme June 23, 2026 17:09
@edvilme edvilme marked this pull request as ready for review June 23, 2026 18:53
@edvilme edvilme added the bug Issue identified by VS Code Team member as probable bug label 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Issue identified by VS Code Team member as probable bug

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants