forked from DonJayamanne/pythonVSCode
-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for 'back' to all create env UI. (#20693)
Closes #20274 ### Usage This change allows callers of the Create Environment command to handle `Back` and `Cancel`: ``` typescript let result: CreateEnvironmentResult | undefined; try { const result = await commands.executeCommand("python.createEnvironment", {showBackButton: true}); } catch(e) { // error while creating environment } if (result?.action === 'Back') { // user clicked Back } if (result?.action === 'Cancel') { // user pressed escape or Cancel } ``` I decided to go with `result?.action` because we don't have a npm package for python extension API so catching particular exception might be error prone with `ex instanceof <error>`. We will provide a proper interface via `api.environments` for create environment, and contribution to create environment. Until that point this command will provide the stop gap. ### Notes 1. I did not use the multi-step input that is used in the rest of the extension because, the existing implementation does not have context. Consider the following scenario: venv -> workspace select -> python select -> packages. Assume that there is only one workspace, and we don't show the workspace selection UI, that decision is done inside the workspace step. So, if there is only 1 workspace it is a short circuit to next step. User is on python selection and clicks `back`, workspace selection short circuits to next step which is python selection. So, from user perspective, back does not work. This can be fixed by sending context that the reason control moved to previous step was because user clicked on back. 2. This makes a change to old multi step API to rethrow the exception, if user hits `back` and the current step has no steps to go back to.
- Loading branch information
1 parent
f3ecbf5
commit 995b0bc
Showing
18 changed files
with
902 additions
and
284 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.