progress - clarify handling of taskCompleted (#245134)

This commit is contained in:
Benjamin Pasero
2025-03-31 16:53:38 +02:00
committed by GitHub
parent 13e3308f69
commit 99b0b5b108
@@ -572,6 +572,12 @@ export class ProgressService extends Disposable implements IProgressService {
disposables.add(dialog);
dialog.show().then(dialogResult => {
// The dialog may close as a result of disposing it after the
// task has completed. In that case, we do not want to trigger
// the `onDidCancel` callback.
// However, if the task is still running, this means that the
// user has clicked the cancel button and we want to trigger
// the `onDidCancel` callback.
if (!taskCompleted) {
onDidCancel?.(dialogResult.button);
}