From fcfc54c43e01942d8d7bd89214a5e94c0c34d469 Mon Sep 17 00:00:00 2001 From: Jonathan Rayner Date: Fri, 12 May 2023 23:42:24 +0100 Subject: [PATCH] Add option for pyenv interpreters when creating environments with venv (#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) --- .../creation/provider/venvCreationProvider.ts | 3 ++- src/client/pythonEnvironments/info/index.ts | 4 +++- src/client/pythonEnvironments/legacyIOC.ts | 1 + 3 files changed, 6 insertions(+), 2 deletions(-) diff --git a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts index e18f2fa79fde..b00682c3cb5d 100644 --- a/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts +++ b/src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts @@ -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, diff --git a/src/client/pythonEnvironments/info/index.ts b/src/client/pythonEnvironments/info/index.ts index 70abbb0fad76..60628f61314e 100644 --- a/src/client/pythonEnvironments/info/index.ts +++ b/src/client/pythonEnvironments/info/index.ts @@ -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. @@ -84,6 +85,7 @@ export type PythonEnvironment = InterpreterInformation & { envName?: string; envPath?: string; cachedEntry?: boolean; + type?: string; }; /** diff --git a/src/client/pythonEnvironments/legacyIOC.ts b/src/client/pythonEnvironments/legacyIOC.ts index 0c80c3414728..f116bdb63a89 100644 --- a/src/client/pythonEnvironments/legacyIOC.ts +++ b/src/client/pythonEnvironments/legacyIOC.ts @@ -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;