Skip to content

Commit e4d98a6

Browse files
authored
bug fix to make quick create function from project panel select env (#565)
fixes #485
1 parent 5187c7e commit e4d98a6

File tree

1 file changed

+14
-3
lines changed

1 file changed

+14
-3
lines changed

src/common/pickers/environments.ts

Lines changed: 14 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { ProgressLocation, QuickInputButtons, QuickPickItem, QuickPickItemKind, ThemeIcon, Uri } from 'vscode';
2-
import { IconPath, PythonEnvironment, PythonProject } from '../../api';
2+
import { CreateEnvironmentOptions, IconPath, PythonEnvironment, PythonProject } from '../../api';
33
import { InternalEnvironmentManager } from '../../internal.api';
44
import { Common, Interpreter, Pickers } from '../localize';
55
import { traceError } from '../logging';
@@ -79,13 +79,24 @@ async function createEnvironment(
7979
projectEnvManagers.filter((m) => m.supportsCreate),
8080
);
8181

82-
const manager = managers.find((m) => m.id === managerId);
82+
let manager: InternalEnvironmentManager | undefined;
83+
let createOptions: CreateEnvironmentOptions | undefined = undefined;
84+
if (managerId?.includes(`QuickCreate#`)) {
85+
manager = managers.find((m) => m.id === managerId.split('#')[1]);
86+
createOptions = {
87+
projects: projectEnvManagers.map((m) => m),
88+
quickCreate: true,
89+
} as CreateEnvironmentOptions;
90+
} else {
91+
manager = managers.find((m) => m.id === managerId);
92+
}
93+
8394
if (manager) {
8495
try {
8596
// add telemetry here
8697
const env = await manager.create(
8798
options.projects.map((p) => p.uri),
88-
undefined,
99+
createOptions,
89100
);
90101
return env;
91102
} catch (ex) {

0 commit comments

Comments
 (0)