Skip to content

Commit fefc113

Browse files
authored
include pyenv virtualenv and enhance display name (microsoft#646)
microsoft#590
1 parent e4074d7 commit fefc113

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/managers/pyenv/pyenvUtils.ts

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,10 @@ function nativeToPythonEnv(
177177

178178
const sv = shortVersion(info.version);
179179
const name = info.name || info.displayName || path.basename(info.prefix);
180-
const displayName = info.displayName || `pyenv (${sv})`;
180+
let displayName = info.displayName || `pyenv (${sv})`;
181+
if (info.kind === NativePythonEnvironmentKind.pyenvVirtualEnv) {
182+
displayName = `${name} (${sv})`;
183+
}
181184

182185
const shellActivation: Map<string, PythonCommandRunConfiguration[]> = new Map();
183186
const shellDeactivation: Map<string, PythonCommandRunConfiguration[]> = new Map();
@@ -232,7 +235,10 @@ export async function refreshPyenv(
232235
const envs = data
233236
.filter((e) => isNativeEnvInfo(e))
234237
.map((e) => e as NativeEnvInfo)
235-
.filter((e) => e.kind === NativePythonEnvironmentKind.pyenv);
238+
.filter(
239+
(e) =>
240+
e.kind === NativePythonEnvironmentKind.pyenv || e.kind === NativePythonEnvironmentKind.pyenvVirtualEnv,
241+
);
236242

237243
const collection: PythonEnvironment[] = [];
238244

0 commit comments

Comments
 (0)