Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Leverage notification progress support for progress API #44090

Closed
bpasero opened this issue Feb 21, 2018 · 7 comments · Fixed by #45958
Closed

Leverage notification progress support for progress API #44090

bpasero opened this issue Feb 21, 2018 · 7 comments · Fixed by #45958
Assignees
Labels
api api-proposal feature-request Request for new features or functionality on-testplan plan-item VS Code - planned item for upcoming workbench-notifications Notification widget issues
Milestone

Comments

@bpasero
Copy link
Member

bpasero commented Feb 21, 2018

With the new notifications comes support for showing long running operations:

before 1

We currently have an API where you can show global progress:

before

One advantage of having this within progress is to free space from the status bar and also to indicate from which extension the progress is reported (because notifications always show their source). Another advantage is that we could provide a "Cancel" button to stop the operation.

We could move this into a notification as a first step and could offer additional APIs to:

  • report more detailed progress on the progress bar
  • provide additional actions ("Cancel" for example)

@jrieken thoughts?

@bpasero bpasero added api under-discussion Issue is under discussion for relevance, priority, approach workbench-notifications Notification widget issues labels Feb 21, 2018
@bpasero bpasero added this to the On Deck milestone Feb 21, 2018
@bpasero bpasero self-assigned this Feb 21, 2018
@Tyriar
Copy link
Member

Tyriar commented Feb 21, 2018

@sean-mcmanus might find this useful for the C++ extension. Related: microsoft/vscode-cpptools#1160

@chrisdias
Copy link
Member

@EricJizbaMSFT @fiveisprime this would be great for the Azure extensions which have long running processes creating resources...

@dragonwolf83
Copy link

This would be useful for the PowerShell Extension as well.

@bpasero bpasero modified the milestones: On Deck, March 2018 Feb 28, 2018
@jrieken
Copy link
Member

jrieken commented Feb 28, 2018

Yeah, maybe another ProgressLocation is what we want. Something like ProgressLocation.Prominent and then add a cancellation token to the task-callback. An alternative approach would be to have a progress-message, tho it feels wrong

@bpasero bpasero added feature-request Request for new features or functionality and removed under-discussion Issue is under discussion for relevance, priority, approach labels Mar 5, 2018
@bpasero bpasero added the plan-item VS Code - planned item for upcoming label Mar 12, 2018
bpasero added a commit that referenced this issue Mar 21, 2018
* Leverage notification progress support for progress API

fixes #44090

* only allow positive total/worked values

* drop total/worked in favour of percentage

* make sure to dispose CancellationTokenSource after use

* make the cancellation button optional
@bpasero
Copy link
Member Author

bpasero commented Mar 21, 2018

@sean-mcmanus @EricJizbaMSFT @fiveisprime @dragonwolf83 @chrisdias this will be in stable API for our March release. You might want to create reminder issues to check it out next month. A sample to use it is:

vscode.window.withProgress({
    location: vscode.ProgressLocation.Notification,
    title: "this is cool",
    // cancellable: true
}, (progress, token) => {
    token.onCancellationRequested(() => {
        console.log("CANCELED")
    });

    setTimeout(() => {
        progress.report({ percentage: 10, message: "still going..."});
    }, 1000);

    setTimeout(() => {
        progress.report({ percentage: 50, message: "still going harder..."});
    }, 2000);

    setTimeout(() => {
        progress.report({ percentage: 90, message: "almost there..."});
    }, 3000);

    var p = new Promise(resolve => {
        setTimeout(() => {
            resolve();
        }, 5000);
    });

    return p;
});

@agauniyal
Copy link

I hope the progress bar won't be so thin 😕

@bpasero
Copy link
Member Author

bpasero commented Mar 24, 2018

@agauniyal the UI did not change from what I showed in #44090 (comment) and the size of the progress bar matches with any other progress bar we have in the UI.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
api api-proposal feature-request Request for new features or functionality on-testplan plan-item VS Code - planned item for upcoming workbench-notifications Notification widget issues
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants