Skip to content

Commit f2f5e3e

Browse files
committed
bug fix to make quick create function from project panel select env
1 parent e4895e2 commit f2f5e3e

1 file changed

Lines changed: 18 additions & 7 deletions

File tree

src/common/pickers/environments.ts

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
1-
import { Uri, ThemeIcon, QuickPickItem, QuickPickItemKind, ProgressLocation, QuickInputButtons } from 'vscode';
2-
import { IconPath, PythonEnvironment, PythonProject } from '../../api';
1+
import { ProgressLocation, QuickInputButtons, QuickPickItem, QuickPickItemKind, ThemeIcon, Uri } from 'vscode';
2+
import { CreateEnvironmentOptions, IconPath, PythonEnvironment, PythonProject } from '../../api';
33
import { InternalEnvironmentManager } from '../../internal.api';
44
import { Common, Interpreter, Pickers } from '../localize';
5-
import { showQuickPickWithButtons, showQuickPick, showOpenDialog, withProgress } from '../window.apis';
65
import { traceError } from '../logging';
7-
import { pickEnvironmentManager } from './managers';
8-
import { handlePythonPath } from '../utils/pythonPath';
96
import { isWindows } from '../utils/platformUtils';
7+
import { handlePythonPath } from '../utils/pythonPath';
8+
import { showOpenDialog, showQuickPick, showQuickPickWithButtons, withProgress } from '../window.apis';
9+
import { pickEnvironmentManager } from './managers';
1010

1111
type QuickPickIcon =
1212
| Uri
@@ -77,12 +77,23 @@ async function createEnvironment(
7777
projectEnvManagers.filter((m) => m.supportsCreate),
7878
);
7979

80-
const manager = managers.find((m) => m.id === managerId);
80+
let manager: InternalEnvironmentManager | undefined;
81+
let createOptions: CreateEnvironmentOptions | undefined = undefined;
82+
if (managerId?.includes(`QuickCreate#`)) {
83+
manager = managers.find((m) => m.id === managerId.split('#')[1]);
84+
createOptions = {
85+
projects: projectEnvManagers.map((m) => m),
86+
quickCreate: true,
87+
} as CreateEnvironmentOptions;
88+
} else {
89+
manager = managers.find((m) => m.id === managerId);
90+
}
91+
8192
if (manager) {
8293
try {
8394
const env = await manager.create(
8495
options.projects.map((p) => p.uri),
85-
undefined,
96+
createOptions,
8697
);
8798
return env;
8899
} catch (ex) {

0 commit comments

Comments
 (0)