Skip to content

Commit 02e1694

Browse files
Copiloteleanorjboyd
andcommitted
Implement script file opening after creation
Co-authored-by: eleanorjboyd <26030610+eleanorjboyd@users.noreply.github.com>
1 parent d11e39c commit 02e1694

1 file changed

Lines changed: 13 additions & 3 deletions

File tree

src/features/envCommands.ts

Lines changed: 13 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ import {} from '../common/errors/utils';
2222
import { pickEnvironment } from '../common/pickers/environments';
2323
import { pickCreator, pickEnvironmentManager, pickPackageManager } from '../common/pickers/managers';
2424
import { pickProject, pickProjectMany } from '../common/pickers/projects';
25-
import { activeTextEditor, showErrorMessage, showInformationMessage } from '../common/window.apis';
25+
import { activeTextEditor, showErrorMessage, showInformationMessage, showTextDocument } from '../common/window.apis';
2626
import { quoteArgs } from './execution/execUtils';
2727
import { runAsTask } from './execution/runAsTask';
2828
import { runInTerminal } from './terminal/runInTerminal';
@@ -434,7 +434,12 @@ export async function addPythonProjectCommand(
434434
quickCreate: true,
435435
};
436436
}
437-
await existingProjectsCreator.create(options);
437+
const result = await existingProjectsCreator.create(options);
438+
439+
// If the creator returns a Uri (like a script file), open it in the editor
440+
if (result instanceof Uri) {
441+
await showTextDocument(result);
442+
}
438443
return;
439444
} catch (ex) {
440445
if (ex === QuickInputButtons.Back) {
@@ -452,7 +457,12 @@ export async function addPythonProjectCommand(
452457
}
453458

454459
try {
455-
await creator.create(options);
460+
const result = await creator.create(options);
461+
462+
// If the creator returns a Uri (like a script file), open it in the editor
463+
if (result instanceof Uri) {
464+
await showTextDocument(result);
465+
}
456466
} catch (ex) {
457467
if (ex === QuickInputButtons.Back) {
458468
return addPythonProjectCommand(resource, wm, em, pc);

0 commit comments

Comments
 (0)