diff --git a/src/vs/workbench/services/lifecycle/browser/lifecycleService.ts b/src/vs/workbench/services/lifecycle/browser/lifecycleService.ts index 351cad96bc73a..3a1d55aa11d9f 100644 --- a/src/vs/workbench/services/lifecycle/browser/lifecycleService.ts +++ b/src/vs/workbench/services/lifecycle/browser/lifecycleService.ts @@ -109,12 +109,14 @@ export class BrowserLifecycleService extends AbstractLifecycleService { private doShutdown(vetoShutdown?: () => void): void { const logService = this.logService; + let storageServiceVeto = true; // Optimistically trigger a UI state flush // without waiting for it. The browser does // not guarantee that this is being executed // but if a dialog opens, we have a chance // to succeed. - this.storageService.flush(WillSaveStateReason.SHUTDOWN); + // If the refresh is not completed, it needs to be regarded as a veto to try to evoke the dialog. + this.storageService.flush(WillSaveStateReason.SHUTDOWN).finally(() => storageServiceVeto = false); let veto = false; @@ -148,7 +150,7 @@ export class BrowserLifecycleService extends AbstractLifecycleService { }); // Veto: handle if provided - if (veto && typeof vetoShutdown === 'function') { + if ((veto || storageServiceVeto) && typeof vetoShutdown === 'function') { return vetoShutdown(); }