Skip to content

Create Python Environment: show a back button and ability to detect user cancellation #20274

Closed

Description

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

Activity

  1. added
    needs PRReady to be worked on
    area-environmentsFeatures relating to handling interpreter environments
    and removed
    triage-neededNeeds assignment to the proper sub-team
    on Nov 24, 2022
  2. DonJayamanne commented on Jan 10, 2023

    @DonJayamanne
    Author

    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?

  3. karrtikr commented on Jan 11, 2023

    @karrtikr

    Karthik Nadig (@karthiknadig) owns this component. What do you think?

  4. brettcannon commented on Jan 11, 2023

    @brettcannon
    Member

    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?

  5. karthiknadig commented on Jan 11, 2023

    @karthiknadig
    Member

    I would like some clarity on the flow. It is a confusing on how back button will be used here.

  6. DonJayamanne commented on Jan 11, 2023

    @DonJayamanne
    Author

    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).
  7. brettcannon commented on Jan 12, 2023

    @brettcannon
    Member
    • Then add the following setting into your user settings file

    Which settings are you referring to?

  8. DonJayamanne commented on Jan 13, 2023

    @DonJayamanne
    Author

    Oops, updated

  9. DonJayamanne commented on Jan 18, 2023

    @DonJayamanne
    Author

    Karthik Nadig (@karthiknadig) do you have an update on this?

  10. 4 remaining items

  11. 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
  12. DonJayamanne commented on Feb 10, 2023

    @DonJayamanne
    Author

    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

  13. karthiknadig commented on Feb 10, 2023

    @karthiknadig
    Member

    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.

  14. DonJayamanne commented on Feb 10, 2023

    @DonJayamanne
    Author

    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

  15. karthiknadig commented on Feb 11, 2023

    @karthiknadig
    Member

    Yes, "Back" and "Cancel" represent distinct user actions and therefore the API will represent them as separate exceptions.

  16. karthiknadig commented on Feb 14, 2023

    @karthiknadig
    Member

    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.

    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
    }
  17. locked as resolved and limited conversation to collaborators on Mar 25, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

area-environmentsFeatures relating to handling interpreter environmentsauthor-verification-requestedIssues potentially verifiable by issue authorfeature-requestRequest for new features or functionalityneeds PRReady to be worked onpartner askverification-neededVerification of issue is requestedverifiedVerification succeeded

Type

No type

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions