Skip to content

Commit 2215d2e

Browse files
committed
feat: add button from no workspace open in new project flow (#475)
improves the problem faced here: #470 but I think ultimately we should determine a more comprehensive flow
1 parent 0cd010f commit 2215d2e

File tree

1 file changed

+12
-3
lines changed

1 file changed

+12
-3
lines changed

src/features/envCommands.ts

Lines changed: 12 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { QuickInputButtons, TaskExecution, TaskRevealKind, Terminal, Uri, workspace } from 'vscode';
1+
import { commands, QuickInputButtons, TaskExecution, TaskRevealKind, Terminal, Uri, workspace } from 'vscode';
22
import {
33
CreateEnvironmentOptions,
44
PythonEnvironment,
@@ -397,8 +397,17 @@ export async function addPythonProjectCommand(
397397
pc: ProjectCreators,
398398
): Promise<void> {
399399
if (wm.getProjects().length === 0) {
400-
showErrorMessage('Please open a folder/project before adding a workspace');
401-
return;
400+
const r = await showErrorMessage(
401+
'Please open a folder/project to create a Python project.',
402+
{
403+
modal: true,
404+
},
405+
'Open Folder',
406+
);
407+
if (r === 'Open Folder') {
408+
await commands.executeCommand('vscode.openFolder');
409+
return;
410+
}
402411
}
403412
if (resource instanceof Array) {
404413
for (const r of resource) {

0 commit comments

Comments
 (0)