You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Create Python Environment: show a back button and ability to detect user cancellation #20274
Is it possible to have a back button on the quick pick displayed for env creation.
This way when users go into kernel picker and choose the ability to create a kernel, then they can go back.
Else today when users hit the cancel button there's no way to know the user hit cancel
Suggestions:'
When command is called from an extension add support for an argument which would indicate whether a back button is required
If this new argument is prohibited an user hits the back button then throw a CancellationError (vscode error to notify of the cancellation)
If the user hits cancel and dismisses the quick pick , then do as previous step
This way when users go into kernel picker and choose the ability to create a kernel, then they can go back.
Else today when users hit the cancel button there's no way to know the user hit cancel
So is the concern more that you are somewhere part way in picking a kernel and you don't know someone dropped out of it? I can see a back button happening when someone realizes they made a mistake, but that won't solve knowing about a cancellation in all cases, correct?
Karthik Nadig (@karthiknadig)
Please could you install the latest pre-release of Jupyter and Python extension in vsocode insiders
Then add the following setting into your user settings file
"notebook.kernelPicker.type": "mru",
Open a new empty workspace folder
Create a new ipynb file
Go into the kernel picker,. and select Python Environment and use the option to create a new python env
That will take you to the Python Quick pick to create a Python env (venv or conda), however one you get there
there's no way to cancel that and go back to the original kernel picker UI
We would like the whole workflow to be a smooth process so that users have the ability to go back (e.g. they might not want to create a venv or the like).
changed the title [-]Create Python Environment: show a back button and ability to detect uyser cancellation[/-][+]Create Python Environment: show a back button and ability to detect user cancellation[/+]on Feb 2, 2023
Karthik Nadig (@karthiknadig) Just wanted to check if there was any update on this or whether you could provide some guidance on what this API would look like. thanks
The command for this will have an optional field that takes showBackButton, with that field set, when user hits back or cancel (keyboard escape) we will raise an exception indicating if it was Back or Cancel.
Thanks, however we will need to differentiate between cancel and back
As cancel means dismiss the whole workflow
And back means go back to the previous quickpick
Minor change to the above description, the action for the command will be returned using a field. We will provide a proper extension API for this, the solution below is a stop gap till then. Below is how you can get the UI to show back button, and action field to see what action was taken.
letresult: CreateEnvironmentResult|undefined;try{constresult=awaitcommands.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}
Activity
DonJayamanne commentedon Jan 10, 2023
Brett Cannon (@brettcannon) Kartik Raj (@karrtikr)
Are you happy for me to submit a PR for this.
Would you prefer a new API method or re-use the same command?
karrtikr commentedon Jan 11, 2023
Karthik Nadig (@karthiknadig) owns this component. What do you think?
brettcannon commentedon Jan 11, 2023
So is the concern more that you are somewhere part way in picking a kernel and you don't know someone dropped out of it? I can see a back button happening when someone realizes they made a mistake, but that won't solve knowing about a cancellation in all cases, correct?
karthiknadig commentedon Jan 11, 2023
I would like some clarity on the flow. It is a confusing on how back button will be used here.
DonJayamanne commentedon Jan 11, 2023
Karthik Nadig (@karthiknadig)
Please could you install the latest pre-release of Jupyter and Python extension in vsocode insiders
Python Environmentand use the option to create a new python envThat will take you to the Python Quick pick to create a Python env (venv or conda), however one you get there
there's no way to cancel that and go back to the original kernel picker UI
We would like the whole workflow to be a smooth process so that users have the ability to go back (e.g. they might not want to create a venv or the like).
brettcannon commentedon Jan 12, 2023
Which settings are you referring to?
DonJayamanne commentedon Jan 13, 2023
Oops, updated
DonJayamanne commentedon Jan 18, 2023
Karthik Nadig (@karthiknadig) do you have an update on this?
4 remaining items
[-]Create Python Environment: show a back button and ability to detect uyser cancellation[/-][+]Create Python Environment: show a back button and ability to detect user cancellation[/+]DonJayamanne commentedon Feb 10, 2023
Karthik Nadig (@karthiknadig) Just wanted to check if there was any update on this or whether you could provide some guidance on what this API would look like. thanks
karthiknadig commentedon Feb 10, 2023
The command for this will have an optional field that takes
showBackButton, with that field set, when user hits back or cancel (keyboard escape) we will raise an exception indicating if it was Back or Cancel.DonJayamanne commentedon Feb 10, 2023
Thanks, however we will need to differentiate between cancel and back
As cancel means dismiss the whole workflow
And back means go back to the previous quickpick
karthiknadig commentedon Feb 11, 2023
Yes, "Back" and "Cancel" represent distinct user actions and therefore the API will represent them as separate exceptions.
Add support for 'back' to all create env UI. (#20693)
karthiknadig commentedon Feb 14, 2023
Minor change to the above description, the action for the command will be returned using a field. We will provide a proper extension API for this, the solution below is a stop gap till then. Below is how you can get the UI to show back button, and
actionfield to see what action was taken.Merge latest upstream python extension
Merge latest upstream python extension