Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions src/common/pickers/environments.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ function getIconPath(i: IconPath | undefined): QuickPickIcon {
interface EnvironmentPickOptions {
recommended?: PythonEnvironment;
showBackButton?: boolean;
showCreateEnvironment?: boolean;
projects: PythonProject[];
}
async function browseForPython(
Expand Down Expand Up @@ -156,7 +157,9 @@ async function pickEnvironmentImpl(
});

if (selected && !Array.isArray(selected)) {
if (selected.label === Interpreter.browsePath) {
if ('result' in selected) {
return selected.result;
} else if (selected.label === Interpreter.browsePath) {
return browseForPython(managers, projectEnvManagers);
} else if (selected.label === Interpreter.enterInterpreterPath) {
return enterPythonPath(managers, projectEnvManagers);
Expand All @@ -167,7 +170,6 @@ async function pickEnvironmentImpl(
});
return createEnvironment(managers, projectEnvManagers, options);
}
return (selected as { result: PythonEnvironment })?.result;
}
return undefined;
}
Expand All @@ -188,7 +190,7 @@ export async function pickEnvironment(
},
];

if (getWorkspaceFolders()?.length) {
if (options.showCreateEnvironment !== false && getWorkspaceFolders()?.length) {
items.push(
{
label: '',
Expand Down
Loading
Loading