Commit b8d1a91
Fix "Create New" script to open the script file after creation (#499)
When using the "Create New" functionality to create a Python script, the
script file was being created successfully but not opened in the editor,
requiring users to manually navigate and open the file.
This PR fixes the issue by modifying the `addPythonProjectCommand`
function to:
1. Capture the return value from `creator.create()`
2. Check if the result is a `Uri` (indicating a single file like a
script was created)
3. Call `showTextDocument(uri)` to automatically open the script in the
editor
**Before:**
- User selects "Create New" → Script → enters name
- Script file is created but user has to manually find and open it
**After:**
- User selects "Create New" → Script → enters name
- Script file is created AND automatically opened in the editor
The implementation is minimal and surgical:
- Only affects cases where creators return a `Uri` (like script files)
- Projects that return `PythonProject` objects are unaffected
- Uses existing `showTextDocument` utility function
- Applied to both the main creator path and existing projects creator
path
Fixes #478.
---
💡 You can make Copilot smarter by setting up custom instructions,
customizing its development environment and configuring Model Context
Protocol (MCP) servers. Learn more [Copilot coding agent
tips](https://gh.io/copilot-coding-agent-tips) in the docs.
---------
Co-authored-by: copilot-swe-agent[bot] <[email protected]>
Co-authored-by: eleanorjboyd <[email protected]>1 parent 307f8ba commit b8d1a91
1 file changed
+5
-2
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
27 | 27 | | |
28 | 28 | | |
29 | 29 | | |
30 | | - | |
| 30 | + | |
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
| |||
471 | 471 | | |
472 | 472 | | |
473 | 473 | | |
474 | | - | |
| 474 | + | |
| 475 | + | |
| 476 | + | |
| 477 | + | |
475 | 478 | | |
476 | 479 | | |
477 | 480 | | |
| |||
0 commit comments