diff --git a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts index 723b23a47a81b..4eae9ffb67901 100644 --- a/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts +++ b/src/vs/workbench/contrib/editSessions/browser/editSessions.contribution.ts @@ -158,7 +158,11 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo this.shouldShowViewsContext = EDIT_SESSIONS_SHOW_VIEW.bindTo(this.contextKeyService); this._register(this.fileService.registerProvider(EditSessionsFileSystemProvider.SCHEMA, new EditSessionsFileSystemProvider(this.editSessionsStorageService))); - this.lifecycleService.onWillShutdown((e) => e.join(this.autoStoreEditSession(), { id: 'autoStoreWorkingChanges', label: localize('autoStoreWorkingChanges', 'Storing current working changes...') })); + this.lifecycleService.onWillShutdown((e) => { + if (this.configurationService.getValue('workbench.experimental.cloudChanges.autoStore') === 'onShutdown' && !isWeb) { + e.join(this.autoStoreEditSession(), { id: 'autoStoreWorkingChanges', label: localize('autoStoreWorkingChanges', 'Storing current working changes...') }); + } + }); this._register(this.editSessionsStorageService.onDidSignIn(() => this.updateAccountsMenuBadge())); this._register(this.editSessionsStorageService.onDidSignOut(() => this.updateAccountsMenuBadge())); } @@ -223,17 +227,15 @@ export class EditSessionsContribution extends Disposable implements IWorkbenchCo } private async autoStoreEditSession() { - if (this.configurationService.getValue('workbench.experimental.cloudChanges.autoStore') === 'onShutdown' && !isWeb) { - const cancellationTokenSource = new CancellationTokenSource(); - await this.progressService.withProgress({ - location: ProgressLocation.Window, - type: 'syncing', - title: localize('store working changes', 'Storing working changes...') - }, async () => this.storeEditSession(false, cancellationTokenSource.token), () => { - cancellationTokenSource.cancel(); - cancellationTokenSource.dispose(); - }); - } + const cancellationTokenSource = new CancellationTokenSource(); + await this.progressService.withProgress({ + location: ProgressLocation.Window, + type: 'syncing', + title: localize('store working changes', 'Storing working changes...') + }, async () => this.storeEditSession(false, cancellationTokenSource.token), () => { + cancellationTokenSource.cancel(); + cancellationTokenSource.dispose(); + }); } private registerViews() {