@@ -13,7 +13,7 @@ import { IStringDictionary } from 'vs/base/common/collections';
1313import { edit } from 'vs/platform/userDataSync/common/content' ;
1414import { merge } from 'vs/platform/userDataSync/common/globalStateMerge' ;
1515import { parse } from 'vs/base/common/json' ;
16- import { AbstractSynchroniser , IRemoteUserData } from 'vs/platform/userDataSync/common/abstractSynchronizer' ;
16+ import { AbstractSynchroniser , IRemoteUserData , ISyncData } from 'vs/platform/userDataSync/common/abstractSynchronizer' ;
1717import { ITelemetryService } from 'vs/platform/telemetry/common/telemetry' ;
1818import { IConfigurationService } from 'vs/platform/configuration/common/configuration' ;
1919import { URI } from 'vs/base/common/uri' ;
@@ -200,6 +200,18 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs
200200 return SyncStatus . Idle ;
201201 }
202202
203+ protected async performReplace ( syncData : ISyncData , remoteUserData : IRemoteUserData , lastSyncUserData : ILastSyncUserData | null ) : Promise < void > {
204+ const localUserData = await this . getLocalGlobalState ( ) ;
205+ const syncGlobalState : IGlobalState = JSON . parse ( syncData . content ) ;
206+ const { local, skipped } = merge ( localUserData . storage , syncGlobalState . storage , localUserData . storage , this . getSyncStorageKeys ( ) , lastSyncUserData ?. skippedStorageKeys || [ ] , this . logService ) ;
207+ await this . apply ( {
208+ local, remote : syncGlobalState . storage , remoteUserData, localUserData, lastSyncUserData,
209+ skippedStorageKeys : skipped ,
210+ hasLocalChanged : Object . keys ( local . added ) . length > 0 || Object . keys ( local . updated ) . length > 0 || local . removed . length > 0 ,
211+ hasRemoteChanged : true
212+ } ) ;
213+ }
214+
203215 protected async generatePreview ( remoteUserData : IRemoteUserData , lastSyncUserData : ILastSyncUserData | null ) : Promise < IGlobalSyncPreviewResult > {
204216 const remoteGlobalState : IGlobalState = remoteUserData . syncData ? JSON . parse ( remoteUserData . syncData . content ) : null ;
205217 const lastSyncGlobalState : IGlobalState = lastSyncUserData && lastSyncUserData . syncData ? JSON . parse ( lastSyncUserData . syncData . content ) : null ;
0 commit comments