Skip to content

Commit

Permalink
fix #93029
Browse files Browse the repository at this point in the history
  • Loading branch information
bpasero committed Apr 6, 2020
1 parent 1d9a68c commit 3764d68
Showing 1 changed file with 19 additions and 5 deletions.
24 changes: 19 additions & 5 deletions src/vs/workbench/services/progress/browser/progressService.ts
Expand Up @@ -380,11 +380,25 @@ export class ProgressService extends Disposable implements IProgressService {
const listener = progressStateModel.onDidReport(step => updateNotification(step));
Event.once(progressStateModel.onDispose)(() => listener.dispose());

// Show progress for at least 800ms and then hide once done or canceled
Promise.all([timeout(800), progressStateModel.promise]).finally(() => {
clearTimeout(notificationTimeout);
notificationHandle?.close();
});
// Clean up eventually
(async () => {
try {

// with a delay we only wait for the finish of the promise
if (typeof options.delay === 'number' && options.delay > 0) {
await progressStateModel.promise;
}

// without a delay we show the notification for at least 800ms
// to reduce the chance of the notification flashing up and hiding
else {
await Promise.all([timeout(800), progressStateModel.promise]);
}
} finally {
clearTimeout(notificationTimeout);
notificationHandle?.close();
}
})();

return progressStateModel.promise;
}
Expand Down

0 comments on commit 3764d68

Please sign in to comment.