Skip to content

fix: preserve bare defaultInterpreterPath commands - #1927

Merged
Eduardo Villalpando Mello (edvilme) merged 4 commits into
microsoft:mainfrom
jibin7jose:fix/bare-default-interpreter-command-resolution
Nov 5, 2026
Merged

Eduardo Villalpando Mello (edvilme) merged 4 commits into
microsoft:mainfrom
jibin7jose:fix/bare-default-interpreter-command-resolution

Conversation

@jibin7jose

Copy link
Copy Markdown
Contributor

Fixes #1917

Fix workspace-scoped python.defaultInterpreterPath values that use a bare command name, such as python3.12. When the command is unavailable on the extension-host PATH, keep it unchanged for native resolution instead of converting it to a workspace-relative path.

@eleanorjboyd

Copy link
Copy Markdown
Contributor

For separator-free values, could we use this precedence?

  1. Found on PATH → return that executable, preserving existing behavior.
  2. Names an existing directory in the workspace → return its absolute path so PET can find Python inside it.
  3. Otherwise → pass the bare name unchanged to PET.

This would preserve workspace-relative environment folders such as .venv or env, which the new early return also treats as bare commands, while still fixing command names such as python3.12 that are missing from the extension host PATH.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Native lookup can succeed while background execution still fails with ENOENT because the fallback retains a bare command name instead of the resolved environment’s executable and path.

1 open issue
What changed in this PR

Addresses #1917 by preserving bare python.defaultInterpreterPath commands for native resolution when they are absent from the extension-host PATH.

Changes:

  • Pass missing bare commands through unchanged instead of resolving them against the workspace.
  • Preserve workspace-relative resolution for existing bare directory names such as .venv.
  • Update regression tests for both behaviors.
File Description
src/​test/​features/​interpreterSelection.unit.test.ts Tests unchanged command forwarding and bare workspace-directory resolution.
src/​features/​interpreterSelection.ts Distinguishes unresolved bare commands from existing workspace directories.

Review effort: Balanced

Comment thread src/features/interpreterSelection.ts Resolved

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Changes look good overall, except for a few comments and questions. Thank you very much for working on this!

Comment thread src/features/interpreterSelection.ts Resolved
Comment thread src/features/interpreterSelection.ts Resolved
Comment thread src/features/interpreterSelection.ts Resolved
@edvilme

Copy link
Copy Markdown
Contributor

Hello, thanks for your quick response and for taking a look at all the comments. Changes look good to me.
Will let tests run and let you know if there is anything else.

Thank you!

@edvilme Eduardo Villalpando Mello (edvilme) added the bug Issue identified by VS Code Team member as probable bug label Nov 4, 2026
@edvilme
Eduardo Villalpando Mello (edvilme) merged commit 0f7bcaf into microsoft:main Nov 5, 2026
58 of 59 checks passed
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.

Bare python.defaultInterpreterPath command is workspace-resolved when missing from extension host PATH

6 participants