@@ -149,9 +149,20 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
149149
150150 textModelResolverService . registerTextModelContentProvider ( USER_DATA_SYNC_SCHEME , instantiationService . createInstance ( UserDataRemoteContentProvider ) ) ;
151151 registerEditorContribution ( AcceptChangesContribution . ID , AcceptChangesContribution ) ;
152+
153+ this . _register ( Event . any ( userDataSyncService . onDidChangeStatus , userDataAutoSyncService . onDidChangeEnablement ) ( ( ) => this . turningOnSync = ! userDataAutoSyncService . isEnabled ( ) && userDataSyncService . status !== SyncStatus . Idle ) ) ;
152154 }
153155 }
154156
157+ private get turningOnSync ( ) : boolean {
158+ return ! ! this . turningOnSyncContext . get ( ) ;
159+ }
160+
161+ private set turningOnSync ( turningOn : boolean ) {
162+ this . turningOnSyncContext . set ( turningOn ) ;
163+ this . updateGlobalActivityBadge ( ) ;
164+ }
165+
155166 private readonly conflictsDisposables = new Map < SyncResource , IDisposable > ( ) ;
156167 private onDidChangeConflicts ( conflicts : [ SyncResource , IResourcePreview [ ] ] [ ] ) {
157168 if ( ! this . userDataAutoSyncService . isEnabled ( ) ) {
@@ -417,17 +428,7 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
417428 }
418429 }
419430
420- private get turningOnSync ( ) : boolean {
421- return ! ! this . turningOnSyncContext . get ( ) ;
422- }
423-
424- private set turningOnSync ( turningOn : boolean ) {
425- this . turningOnSyncContext . set ( turningOn ) ;
426- this . updateGlobalActivityBadge ( ) ;
427- }
428-
429431 private async turnOn ( ) : Promise < void > {
430- this . turningOnSync = true ;
431432 try {
432433 if ( ! this . storageService . getBoolean ( 'sync.donotAskPreviewConfirmation' , StorageScope . GLOBAL , false ) ) {
433434 if ( ! await this . askForConfirmation ( ) ) {
@@ -477,8 +478,6 @@ export class UserDataSyncWorkbenchContribution extends Disposable implements IWo
477478 }
478479 }
479480 this . notificationService . error ( localize ( 'turn on failed' , "Error while starting Sync: {0}" , toErrorMessage ( e ) ) ) ;
480- } finally {
481- this . turningOnSync = false ;
482481 }
483482 }
484483
0 commit comments