Skip to content

Commit

Permalink
Add option for pyenv interpreters when creating environments with venv (
Browse files Browse the repository at this point in the history
#21219)

Resolves #20881 .

Testing:

Behaves as expected when testing with Extension Development Host:


![image](https://github.com/microsoft/vscode-python/assets/30149293/d114d9ab-f2d8-4273-877b-d7dd030cfe76)
  • Loading branch information
JonathanRayner authored May 12, 2023
1 parent b3d43e5 commit fcfc54c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,8 @@ export class VenvCreationProvider implements CreateEnvironmentProvider {
EnvironmentType.System,
EnvironmentType.MicrosoftStore,
EnvironmentType.Global,
].includes(i.envType),
EnvironmentType.Pyenv,
].includes(i.envType) && i.type === undefined, // only global intepreters
{
skipRecommended: true,
showBackButton: true,
Expand Down
4 changes: 3 additions & 1 deletion src/client/pythonEnvironments/info/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,10 +68,11 @@ export type InterpreterInformation = {
*
* @prop companyDisplayName - the user-facing name of the distro publisher
* @prop displayName - the user-facing name for the environment
* @prop type - the kind of Python environment
* @prop envType - the kind of Python environment
* @prop envName - the environment's name, if applicable (else `envPath` is set)
* @prop envPath - the environment's root dir, if applicable (else `envName`)
* @prop cachedEntry - whether or not the info came from a cache
* @prop type - the type of Python environment, if applicable
*/
// Note that "cachedEntry" is specific to the caching machinery
// and doesn't really belong here.
Expand All @@ -84,6 +85,7 @@ export type PythonEnvironment = InterpreterInformation & {
envName?: string;
envPath?: string;
cachedEntry?: boolean;
type?: string;
};

/**
Expand Down
1 change: 1 addition & 0 deletions src/client/pythonEnvironments/legacyIOC.ts
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,7 @@ function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment {
}
env.displayName = info.display;
env.detailedDisplayName = info.detailedDisplayName;
env.type = info.type;
// We do not worry about using distro.defaultDisplayName.

return env;
Expand Down

0 comments on commit fcfc54c

Please sign in to comment.