diff --git a/src/features/creators/newScriptProject.ts b/src/features/creators/newScriptProject.ts index cc9c440b..5a62b6cb 100644 --- a/src/features/creators/newScriptProject.ts +++ b/src/features/creators/newScriptProject.ts @@ -4,7 +4,7 @@ import { commands, l10n, MarkdownString, QuickInputButtons, Uri, window, workspa import { PythonProject, PythonProjectCreator, PythonProjectCreatorOptions } from '../../api'; import { NEW_PROJECT_TEMPLATES_FOLDER } from '../../common/constants'; import { traceError } from '../../common/logging'; -import { showInputBoxWithButtons } from '../../common/window.apis'; +import { showInputBoxWithButtons, showTextDocument } from '../../common/window.apis'; import { PythonProjectManager } from '../../internal.api'; import { isCopilotInstalled, manageCopilotInstructionsFile, replaceInFilesAndNames } from './creationHelpers'; @@ -120,6 +120,9 @@ export class NewScriptProject implements PythonProjectCreator { uri: Uri.file(scriptDestination), }; this.projectManager.add(createdScript); + + await showTextDocument(createdScript.uri); + return createdScript; } return undefined; diff --git a/src/features/envCommands.ts b/src/features/envCommands.ts index 28cfd13f..db756e84 100644 --- a/src/features/envCommands.ts +++ b/src/features/envCommands.ts @@ -29,7 +29,7 @@ import { pickWorkspaceFolder, } from '../common/pickers/managers'; import { pickProject, pickProjectMany } from '../common/pickers/projects'; -import { activeTextEditor, showErrorMessage, showInformationMessage, showTextDocument } from '../common/window.apis'; +import { activeTextEditor, showErrorMessage, showInformationMessage } from '../common/window.apis'; import { quoteArgs } from './execution/execUtils'; import { runAsTask } from './execution/runAsTask'; import { runInTerminal } from './terminal/runInTerminal'; @@ -450,10 +450,7 @@ export async function addPythonProjectCommand( } try { - const result = await creator.create(options); - if (result instanceof Uri) { - await showTextDocument(result); - } + await creator.create(options); } catch (ex) { if (ex === QuickInputButtons.Back) { return addPythonProjectCommand(resource, wm, em, pc);