From 99b0b5b10853ce59b1ca178e04dcc95495ef8f37 Mon Sep 17 00:00:00 2001 From: Benjamin Pasero Date: Mon, 31 Mar 2025 16:53:38 +0200 Subject: [PATCH] progress - clarify handling of `taskCompleted` (#245134) --- .../workbench/services/progress/browser/progressService.ts | 6 ++++++ 1 file changed, 6 insertions(+) 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); }