Skip to content

Commit fcfc54c

Browse files
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)
1 parent b3d43e5 commit fcfc54c

File tree

3 files changed

+6
-2
lines changed

3 files changed

+6
-2
lines changed

src/client/pythonEnvironments/creation/provider/venvCreationProvider.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,8 @@ export class VenvCreationProvider implements CreateEnvironmentProvider {
162162
EnvironmentType.System,
163163
EnvironmentType.MicrosoftStore,
164164
EnvironmentType.Global,
165-
].includes(i.envType),
165+
EnvironmentType.Pyenv,
166+
].includes(i.envType) && i.type === undefined, // only global intepreters
166167
{
167168
skipRecommended: true,
168169
showBackButton: true,

src/client/pythonEnvironments/info/index.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,11 @@ export type InterpreterInformation = {
6868
*
6969
* @prop companyDisplayName - the user-facing name of the distro publisher
7070
* @prop displayName - the user-facing name for the environment
71-
* @prop type - the kind of Python environment
71+
* @prop envType - the kind of Python environment
7272
* @prop envName - the environment's name, if applicable (else `envPath` is set)
7373
* @prop envPath - the environment's root dir, if applicable (else `envName`)
7474
* @prop cachedEntry - whether or not the info came from a cache
75+
* @prop type - the type of Python environment, if applicable
7576
*/
7677
// Note that "cachedEntry" is specific to the caching machinery
7778
// and doesn't really belong here.
@@ -84,6 +85,7 @@ export type PythonEnvironment = InterpreterInformation & {
8485
envName?: string;
8586
envPath?: string;
8687
cachedEntry?: boolean;
88+
type?: string;
8789
};
8890

8991
/**

src/client/pythonEnvironments/legacyIOC.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,7 @@ function convertEnvInfo(info: PythonEnvInfo): PythonEnvironment {
7575
}
7676
env.displayName = info.display;
7777
env.detailedDisplayName = info.detailedDisplayName;
78+
env.type = info.type;
7879
// We do not worry about using distro.defaultDisplayName.
7980

8081
return env;

0 commit comments

Comments
 (0)