diff --git a/src/vs/workbench/services/progress/browser/progressService.ts b/src/vs/workbench/services/progress/browser/progressService.ts index d8abbcda9d0..cb8831c7e77 100644 --- a/src/vs/workbench/services/progress/browser/progressService.ts +++ b/src/vs/workbench/services/progress/browser/progressService.ts @@ -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); }