diff --git a/src/client/common/utils/localize.ts b/src/client/common/utils/localize.ts index 5d1eb52514c7..6f0708fbcb7c 100644 --- a/src/client/common/utils/localize.ts +++ b/src/client/common/utils/localize.ts @@ -97,6 +97,7 @@ export namespace Common { export const useCommandPrompt = localize('Common.useCommandPrompt', 'Use Command Prompt'); export const download = localize('Common.download', 'Download'); export const showLogs = localize('Common.showLogs', 'Show logs'); + export const openFolder = localize('Common.openFolder', 'Open Folder...'); } export namespace CommonSurvey { @@ -563,7 +564,7 @@ export namespace CreateEnv { export const noWorkspace = localize( 'createEnv.noWorkspace', - 'Please open a directory when creating an environment using venv.', + 'Please open a folder when creating an environment using venv.', ); export const pickWorkspacePlaceholder = localize( diff --git a/src/client/pythonEnvironments/creation/common/workspaceSelection.ts b/src/client/pythonEnvironments/creation/common/workspaceSelection.ts index b2dc97882e23..625aaa5c265e 100644 --- a/src/client/pythonEnvironments/creation/common/workspaceSelection.ts +++ b/src/client/pythonEnvironments/creation/common/workspaceSelection.ts @@ -6,7 +6,8 @@ import * as path from 'path'; import { CancellationToken, QuickPickItem, WorkspaceFolder } from 'vscode'; import { showErrorMessage, showQuickPick } from '../../../common/vscodeApis/windowApis'; import { getWorkspaceFolders } from '../../../common/vscodeApis/workspaceApis'; -import { CreateEnv } from '../../../common/utils/localize'; +import { Common, CreateEnv } from '../../../common/utils/localize'; +import { executeCommand } from '../../../common/vscodeApis/commandApis'; function hasVirtualEnv(workspace: WorkspaceFolder): Promise { return Promise.race([ @@ -39,7 +40,10 @@ export async function pickWorkspaceFolder( const workspaces = getWorkspaceFolders(); if (!workspaces || workspaces.length === 0) { - showErrorMessage(CreateEnv.noWorkspace); + const result = await showErrorMessage(CreateEnv.noWorkspace, Common.openFolder); + if (result === Common.openFolder) { + await executeCommand('vscode.openFolder'); + } return undefined; }