Skip to content

Comments

fix: streamline environment retrieval in venvManager and pyenvManager#1157

Merged
karthiknadig merged 2 commits intomainfrom
residential-canidae
Feb 3, 2026
Merged

fix: streamline environment retrieval in venvManager and pyenvManager#1157
karthiknadig merged 2 commits intomainfrom
residential-canidae

Conversation

@karthiknadig
Copy link
Member

@karthiknadig karthiknadig commented Feb 3, 2026

Fixes #610

Summary

This PR enables pyenv-installed Python versions to appear as available base interpreters when creating new venv environments.

Changes

1. Fixed bug in PyEnvManager.getEnvironments()

The filter callback for the 'global' scope was missing a return statement - it used braces without returning a value, causing it to always return an empty array:

// Before (buggy):
return this.collection.filter((env) => {
    env.group === PYENV_VERSIONS;  // Statement - doesn't return anything
});

// After (fixed):
return this.collection.filter((env) => env.group === PYENV_VERSIONS);

2. Updated VenvManager to use API for aggregating global environments

Changed from using only baseManager.getEnvironments('global') (which only returns system Python) to api.getEnvironments('global') which aggregates environments from ALL registered managers including pyenv, conda, etc.

This change was applied to three locations in venvManager.ts:

  • create() method - when showing available base interpreters for venv creation
  • resetGlobalEnv() method - when resetting the global environment reference
  • loadEnvMap() method - when loading environment mappings

Result

When users create a new venv environment, pyenv-installed Python versions (those in the PYENV_VERSIONS group) will now appear alongside system Python installations as available base interpreters.

@karthiknadig karthiknadig self-assigned this Feb 3, 2026
@karthiknadig karthiknadig added bug Issue identified by VS Code Team member as probable bug labels Feb 3, 2026
@karthiknadig karthiknadig marked this pull request as ready for review February 3, 2026 17:09
@karthiknadig karthiknadig enabled auto-merge (squash) February 3, 2026 17:09
@vs-code-engineering vs-code-engineering bot added this to the February 2026 milestone Feb 3, 2026
@karthiknadig karthiknadig merged commit 7551eb5 into main Feb 3, 2026
12 of 13 checks passed
@karthiknadig karthiknadig deleted the residential-canidae branch February 3, 2026 17:20
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.

Support "create" for pyenv

2 participants