From 6fb482dca116ff15146ad5620e6595b3cada226a Mon Sep 17 00:00:00 2001 From: Sandeep Somavarapu Date: Wed, 5 Feb 2020 20:21:03 +0100 Subject: [PATCH] Fix #89610 --- .../userDataSync/common/extensionsSync.ts | 2 +- .../userDataSync/common/globalStateSync.ts | 2 +- .../userDataSync/common/keybindingsSync.ts | 2 +- .../userDataSync/common/settingsSync.ts | 108 +++++++++--------- .../userDataSync/common/userDataSync.ts | 8 +- .../userDataSync/common/userDataSyncIpc.ts | 8 +- .../common/userDataSyncService.ts | 22 ++-- .../userDataSync/browser/userDataSync.ts | 51 +++++---- .../electron-browser/settingsSyncService.ts | 8 +- .../electron-browser/userDataSyncService.ts | 8 +- 10 files changed, 112 insertions(+), 107 deletions(-) diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index cfd1668c471..5724540aa1f 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -152,7 +152,7 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse throw new Error('Extensions: Conflicts should not occur'); } - resolveConflicts(content: string, remote: boolean): Promise { + accept(content: string): Promise { throw new Error('Extensions: Conflicts should not occur'); } diff --git a/src/vs/platform/userDataSync/common/globalStateSync.ts b/src/vs/platform/userDataSync/common/globalStateSync.ts index 6556d7539c3..c20024d1f20 100644 --- a/src/vs/platform/userDataSync/common/globalStateSync.ts +++ b/src/vs/platform/userDataSync/common/globalStateSync.ts @@ -133,7 +133,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs throw new Error('UI State: Conflicts should not occur'); } - resolveConflicts(content: string, remote: boolean): Promise { + accept(content: string): Promise { throw new Error('UI State: Conflicts should not occur'); } diff --git a/src/vs/platform/userDataSync/common/keybindingsSync.ts b/src/vs/platform/userDataSync/common/keybindingsSync.ts index b1df87e1c73..76083e2a537 100644 --- a/src/vs/platform/userDataSync/common/keybindingsSync.ts +++ b/src/vs/platform/userDataSync/common/keybindingsSync.ts @@ -170,7 +170,7 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements } } - async resolveConflicts(content: string, remote: boolean): Promise { + async accept(content: string): Promise { if (this.status === SyncStatus.HasConflicts) { try { await this.apply(content, true); diff --git a/src/vs/platform/userDataSync/common/settingsSync.ts b/src/vs/platform/userDataSync/common/settingsSync.ts index cc43d787469..bd702546688 100644 --- a/src/vs/platform/userDataSync/common/settingsSync.ts +++ b/src/vs/platform/userDataSync/common/settingsSync.ts @@ -17,7 +17,7 @@ import { updateIgnoredSettings, merge, getIgnoredSettings } from 'vs/platform/us import { FormattingOptions } from 'vs/base/common/jsonFormatter'; import * as arrays from 'vs/base/common/arrays'; import * as objects from 'vs/base/common/objects'; -import { isEmptyObject } from 'vs/base/common/types'; +import { isEmptyObject, isUndefinedOrNull } from 'vs/base/common/types'; import { edit } from 'vs/platform/userDataSync/common/content'; import { AbstractFileSynchroniser } from 'vs/platform/userDataSync/common/abstractSynchronizer'; @@ -25,8 +25,9 @@ interface ISyncPreviewResult { readonly fileContent: IFileContent | null; readonly remoteUserData: IUserData; readonly lastSyncUserData: IUserData | null; - readonly localContent: string | null; - readonly remoteContent: string | null; + readonly content: string | null; + readonly hasLocalChanged: boolean; + readonly hasRemoteChanged: boolean; readonly hasConflicts: boolean; readonly conflictSettings: IConflictSetting[]; } @@ -89,18 +90,17 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS if (remoteUserData.content !== null) { const fileContent = await this.getLocalFileContent(); const formatUtils = await this.getFormattingOptions(); - // Update ignored settings - const localContent = updateIgnoredSettings(remoteUserData.content, fileContent ? fileContent.value.toString() : '{}', getIgnoredSettings(this.configurationService), formatUtils); - await this.fileService.writeFile(this.environmentService.settingsSyncPreviewResource, VSBuffer.fromString(localContent)); - + // Update ignored settings from local file content + const content = updateIgnoredSettings(remoteUserData.content, fileContent ? fileContent.value.toString() : '{}', getIgnoredSettings(this.configurationService), formatUtils); this.syncPreviewResultPromise = createCancelablePromise(() => Promise.resolve({ - hasConflicts: false, - conflictSettings: [], fileContent, - localContent, - remoteContent: null, remoteUserData, lastSyncUserData, + content, + hasLocalChanged: true, + hasRemoteChanged: false, + hasConflicts: false, + conflictSettings: [], })); await this.apply(); @@ -135,21 +135,21 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS const formatUtils = await this.getFormattingOptions(); // Remove ignored settings const content = updateIgnoredSettings(fileContent.value.toString(), '{}', getIgnoredSettings(this.configurationService), formatUtils); - await this.fileService.writeFile(this.environmentService.settingsSyncPreviewResource, VSBuffer.fromString(content)); const lastSyncUserData = await this.getLastSyncUserData(); const remoteUserData = await this.getRemoteUserData(lastSyncUserData); this.syncPreviewResultPromise = createCancelablePromise(() => Promise.resolve({ - conflictSettings: [], - hasConflicts: false, fileContent, - localContent: null, - remoteContent: content, remoteUserData, lastSyncUserData, + content, + hasRemoteChanged: true, + hasLocalChanged: false, + hasConflicts: false, + conflictSettings: [], })); - await this.apply(undefined, true); + await this.apply(true); } // No local exists to push @@ -208,7 +208,7 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS return false; } - async getRemoteContent(): Promise { + async getRemoteContent(preview?: boolean): Promise { let content: string | null | undefined = null; if (this.syncPreviewResultPromise) { const preview = await this.syncPreviewResultPromise; @@ -218,6 +218,11 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS const remoteUserData = await this.getRemoteUserData(lastSyncData); content = remoteUserData.content; } + if (preview && !isUndefinedOrNull(content)) { + const formatUtils = await this.getFormattingOptions(); + // remove ignored settings from the remote content for preview + content = updateIgnoredSettings(content, '{}', getIgnoredSettings(this.configurationService), formatUtils); + } return content !== undefined ? content : null; } @@ -229,16 +234,15 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } } - async resolveConflicts(content: string, remote: boolean): Promise { + async accept(content: string): Promise { if (this.status === SyncStatus.HasConflicts) { try { - if (remote) { - const { fileContent } = await this.syncPreviewResultPromise!; - const formatUtils = await this.getFormattingOptions(); - // Update ignored settings - content = updateIgnoredSettings(content, fileContent ? fileContent.value.toString() : '{}', getIgnoredSettings(this.configurationService), formatUtils); - } - await this.apply(content, true); + const preview = await this.syncPreviewResultPromise!; + const formatUtils = await this.getFormattingOptions(); + // Add ignored settings from local file content + content = updateIgnoredSettings(content, preview.fileContent ? preview.fileContent.value.toString() : '{}', getIgnoredSettings(this.configurationService), formatUtils); + this.syncPreviewResultPromise = createCancelablePromise(async () => ({ ...preview, content })); + await this.apply(true); this.setStatus(SyncStatus.Idle); } catch (e) { this.logService.error(e); @@ -291,21 +295,14 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } } - private async apply(content?: string, forcePush?: boolean): Promise { + private async apply(forcePush?: boolean): Promise { if (!this.syncPreviewResultPromise) { return; } - let { fileContent, remoteUserData, lastSyncUserData, localContent, remoteContent } = await this.syncPreviewResultPromise; + let { fileContent, remoteUserData, lastSyncUserData, content, hasLocalChanged, hasRemoteChanged } = await this.syncPreviewResultPromise; - if (content === undefined) { - if (await this.fileService.exists(this.environmentService.settingsSyncPreviewResource)) { - const settingsPreivew = await this.fileService.readFile(this.environmentService.settingsSyncPreviewResource); - content = settingsPreivew.value.toString(); - } - } - - if (content !== undefined) { + if (content !== null) { if (this.hasErrors(content)) { const error = new Error(localize('errorInvalidSettings', "Unable to sync settings. Please resolve conflicts without any errors/warnings and try again.")); @@ -313,15 +310,13 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS throw error; } - if (localContent === null && remoteContent === null) { - this.logService.trace('Settings: No changes found during synchronizing settings.'); - } - if (localContent !== null) { + if (hasLocalChanged) { this.logService.info('Settings: Updating local settings'); await this.updateLocalFileContent(content, fileContent); } - if (remoteContent !== null) { + if (hasRemoteChanged) { const formatUtils = await this.getFormattingOptions(); + // Update ignored settings from remote content = updateIgnoredSettings(content, remoteUserData.content || '{}', getIgnoredSettings(this.configurationService, content), formatUtils); this.logService.info('Settings: Updating remote settings'); const ref = await this.updateRemoteUserData(content, forcePush ? null : remoteUserData.ref); @@ -360,45 +355,48 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS const remoteUserData = await this.getRemoteUserData(lastSyncUserData); // Get file content last to get the latest const fileContent = await this.getLocalFileContent(); - let localContent: string | null = null; - let remoteContent: string | null = null; + const formatUtils = await this.getFormattingOptions(); + + let content: string | null = null; + let hasLocalChanged: boolean = false; + let hasRemoteChanged: boolean = false; let hasConflicts: boolean = false; let conflictSettings: IConflictSetting[] = []; - let previewContent: string | null = null; if (remoteUserData.content) { - const content: string = fileContent ? fileContent.value.toString() : '{}'; + const localContent: string = fileContent ? fileContent.value.toString() : '{}'; // No action when there are errors - if (this.hasErrors(content)) { + if (this.hasErrors(localContent)) { this.logService.error('Settings: Unable to sync settings as there are errors/warning in settings file.'); } else { this.logService.trace('Settings: Merging remote settings with local settings...'); - const formatUtils = await this.getFormattingOptions(); - const result = merge(content, remoteUserData.content, lastSyncUserData ? lastSyncUserData.content : null, getIgnoredSettings(this.configurationService), resolvedConflicts, formatUtils); + const result = merge(localContent, remoteUserData.content, lastSyncUserData ? lastSyncUserData.content : null, getIgnoredSettings(this.configurationService), resolvedConflicts, formatUtils); + content = result.localContent || result.remoteContent; + hasLocalChanged = result.localContent !== null; + hasRemoteChanged = result.remoteContent !== null; hasConflicts = result.hasConflicts; conflictSettings = result.conflictsSettings; - localContent = result.localContent; - remoteContent = result.remoteContent; - previewContent = result.localContent || result.remoteContent; } } // First time syncing to remote else if (fileContent) { this.logService.trace('Settings: Remote settings does not exist. Synchronizing settings for the first time.'); - previewContent = fileContent.value.toString(); - remoteContent = fileContent.value.toString(); + content = fileContent.value.toString(); + hasRemoteChanged = true; } - if (previewContent && !token.isCancellationRequested) { + if (content && !token.isCancellationRequested) { + // Remove the ignored settings from the preview. + const previewContent = updateIgnoredSettings(content, '{}', getIgnoredSettings(this.configurationService), formatUtils); await this.fileService.writeFile(this.environmentService.settingsSyncPreviewResource, VSBuffer.fromString(previewContent)); } this.setConflicts(conflictSettings); - return { fileContent, remoteUserData, lastSyncUserData, remoteContent, localContent, conflictSettings, hasConflicts }; + return { fileContent, remoteUserData, lastSyncUserData, content, hasLocalChanged, hasRemoteChanged, conflictSettings, hasConflicts }; } private _formattingOptions: Promise | undefined = undefined; diff --git a/src/vs/platform/userDataSync/common/userDataSync.ts b/src/vs/platform/userDataSync/common/userDataSync.ts index e6ada97aafd..8fae77dfaf7 100644 --- a/src/vs/platform/userDataSync/common/userDataSync.ts +++ b/src/vs/platform/userDataSync/common/userDataSync.ts @@ -204,8 +204,8 @@ export interface ISynchroniser { export interface IUserDataSynchroniser extends ISynchroniser { readonly source: SyncSource; - getRemoteContent(): Promise; - resolveConflicts(content: string, remote: boolean): Promise; + getRemoteContent(preivew?: boolean): Promise; + accept(content: string): Promise; } export const IUserDataSyncService = createDecorator('IUserDataSyncService'); @@ -215,8 +215,8 @@ export interface IUserDataSyncService extends ISynchroniser { isFirstTimeSyncAndHasUserData(): Promise; reset(): Promise; resetLocal(): Promise; - getRemoteContent(source: SyncSource): Promise; - resolveConflictsAndContinueSync(content: string, remote: boolean): Promise; + getRemoteContent(source: SyncSource, preview: boolean): Promise; + accept(source: SyncSource, content: string): Promise; } export const IUserDataAutoSyncService = createDecorator('IUserDataAutoSyncService'); diff --git a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts index e60d4530646..f8d3414a198 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts @@ -25,7 +25,7 @@ export class UserDataSyncChannel implements IServerChannel { call(context: any, command: string, args?: any): Promise { switch (command) { case 'sync': return this.service.sync(); - case 'resolveConflictsAndContinueSync': return this.service.resolveConflictsAndContinueSync(args[0], args[1]); + case 'accept': return this.service.accept(args[0], args[1]); case 'pull': return this.service.pull(); case 'push': return this.service.push(); case '_getInitialStatus': return Promise.resolve(this.service.status); @@ -37,7 +37,7 @@ export class UserDataSyncChannel implements IServerChannel { case 'hasPreviouslySynced': return this.service.hasPreviouslySynced(); case 'hasRemoteData': return this.service.hasRemoteData(); case 'hasLocalData': return this.service.hasLocalData(); - case 'getRemoteContent': return this.service.getRemoteContent(args[0]); + case 'getRemoteContent': return this.service.getRemoteContent(args[0], args[1]); case 'isFirstTimeSyncAndHasUserData': return this.service.isFirstTimeSyncAndHasUserData(); } throw new Error('Invalid call'); @@ -60,7 +60,7 @@ export class SettingsSyncChannel implements IServerChannel { call(context: any, command: string, args?: any): Promise { switch (command) { case 'sync': return this.service.sync(); - case 'resolveConflicts': return this.service.resolveConflicts(args[0], args[1]); + case 'accept': return this.service.accept(args[0]); case 'pull': return this.service.pull(); case 'push': return this.service.push(); case 'restart': return this.service.restart().then(() => this.service.status); @@ -72,7 +72,7 @@ export class SettingsSyncChannel implements IServerChannel { case 'hasRemoteData': return this.service.hasRemoteData(); case 'hasLocalData': return this.service.hasLocalData(); case 'resolveSettingsConflicts': return this.service.resolveSettingsConflicts(args[0]); - case 'getRemoteContent': return this.service.getRemoteContent(); + case 'getRemoteContent': return this.service.getRemoteContent(args[0]); } throw new Error('Invalid call'); } diff --git a/src/vs/platform/userDataSync/common/userDataSyncService.ts b/src/vs/platform/userDataSync/common/userDataSyncService.ts index 688c11d1813..9d67caea8bb 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncService.ts @@ -123,12 +123,9 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ this.logService.trace(`Finished Syncing. Took ${new Date().getTime() - startTime}ms`); } - async resolveConflictsAndContinueSync(content: string, remote: boolean): Promise { - const synchroniser = this.getSynchroniserInConflicts(); - if (!synchroniser) { - throw new Error(localize('no synchroniser with conflicts', "No conflicts detected.")); - } - await synchroniser.resolveConflicts(content, remote); + async accept(source: SyncSource, content: string): Promise { + const synchroniser = this.getSynchroniser(source); + await synchroniser.accept(content); if (synchroniser.status !== SyncStatus.HasConflicts) { await this.sync(); } @@ -199,10 +196,10 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ return false; } - async getRemoteContent(source: SyncSource): Promise { + async getRemoteContent(source: SyncSource, preview: boolean): Promise { for (const synchroniser of this.synchronisers) { if (synchroniser.source === source) { - return synchroniser.getRemoteContent(); + return synchroniser.getRemoteContent(preview); } } return null; @@ -313,6 +310,15 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ return SyncSource.GlobalState; } + private getSynchroniser(source: SyncSource): IUserDataSynchroniser { + switch (source) { + case SyncSource.Settings: return this.settingsSynchroniser; + case SyncSource.Keybindings: return this.keybindingsSynchroniser; + case SyncSource.Extensions: return this.extensionsSynchroniser; + case SyncSource.GlobalState: return this.globalStateSynchroniser; + } + } + private onDidChangeAuthTokenStatus(token: string | undefined): void { if (!token) { this.stop(); diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index 06bb75cbc76..e32e4a9f64c 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -688,10 +688,10 @@ class UserDataRemoteContentProvider implements ITextModelContentProvider { provideTextContent(uri: URI): Promise | null { let promise: Promise | undefined; if (isEqual(uri, toRemoteContentResource(SyncSource.Settings))) { - promise = this.userDataSyncService.getRemoteContent(SyncSource.Settings); + promise = this.userDataSyncService.getRemoteContent(SyncSource.Settings, true); } if (isEqual(uri, toRemoteContentResource(SyncSource.Keybindings))) { - promise = this.userDataSyncService.getRemoteContent(SyncSource.Keybindings); + promise = this.userDataSyncService.getRemoteContent(SyncSource.Keybindings, true); } if (promise) { return promise.then(content => this.modelService.createModel(content || '', this.modeService.create('jsonc'), uri)); @@ -776,36 +776,37 @@ class AcceptChangesContribution extends Disposable implements IEditorContributio private createAcceptChangesWidgetRenderer(): void { if (!this.acceptChangesButton) { - const replaceLabel = localize('accept remote', "Replace (Overwrite Local)"); - const applyLabel = localize('accept local', "Apply"); - this.acceptChangesButton = this.instantiationService.createInstance(FloatingClickWidget, this.editor, getSyncSourceFromRemoteContentResource(this.editor.getModel()!.uri) !== undefined ? replaceLabel : applyLabel, null); + const acceptRemoteLabel = localize('accept remote', "Accept Remote"); + const acceptLocalLabel = localize('accept local', "Accept Local"); + this.acceptChangesButton = this.instantiationService.createInstance(FloatingClickWidget, this.editor, getSyncSourceFromRemoteContentResource(this.editor.getModel()!.uri) !== undefined ? acceptRemoteLabel : acceptLocalLabel, null); this._register(this.acceptChangesButton.onClick(async () => { const model = this.editor.getModel(); if (model) { const conflictsSource = this.userDataSyncService.conflictsSource; const syncSource = getSyncSourceFromRemoteContentResource(model.uri); - this.telemetryService.publicLog2<{ source: string, action: string }, SyncConflictsClassification>('sync/handleConflicts', { source: conflictsSource!, action: syncSource !== undefined ? 'replaceLocal' : 'apply' }); - if (syncSource !== undefined) { - const syncAreaLabel = getSyncAreaLabel(syncSource); - const result = await this.dialogService.confirm({ - type: 'info', - title: localize('Sync overwrite local', "Sync: {0}", replaceLabel), - message: localize('confirm replace and overwrite local', "Would you like to replace Local {0} with Remote {1}?", syncAreaLabel, syncAreaLabel), - primaryButton: replaceLabel - }); - if (!result.confirmed) { - return; + this.telemetryService.publicLog2<{ source: string, action: string }, SyncConflictsClassification>('sync/handleConflicts', { source: conflictsSource!, action: syncSource !== undefined ? 'acceptRemote' : 'acceptLocal' }); + const syncAreaLabel = getSyncAreaLabel(conflictsSource!); + const result = await this.dialogService.confirm({ + type: 'info', + title: syncSource !== undefined + ? localize('Sync accept remote', "Sync: {0}", acceptRemoteLabel) + : localize('Sync accept local', "Sync: {0}", acceptLocalLabel), + message: syncSource !== undefined + ? localize('confirm replace and overwrite local', "Would you like to accept Remote {0} and replace Local {1}?", syncAreaLabel, syncAreaLabel) + : localize('confirm replace and overwrite remote', "Would you like to accept Local {0} and replace Remote {1}?", syncAreaLabel, syncAreaLabel), + primaryButton: syncSource !== undefined ? acceptRemoteLabel : acceptLocalLabel + }); + if (result.confirmed) { + try { + await this.userDataSyncService.accept(conflictsSource!, model.getValue()); + } catch (e) { + this.userDataSyncService.restart().then(() => { + if (conflictsSource === this.userDataSyncService.conflictsSource) { + this.notificationService.warn(localize('update conflicts', "Could not resolve conflicts as there is new local version available. Please try again.")); + } + }); } } - try { - await this.userDataSyncService.resolveConflictsAndContinueSync(model.getValue(), syncSource !== undefined); - } catch (e) { - this.userDataSyncService.restart().then(() => { - if (conflictsSource === this.userDataSyncService.conflictsSource) { - this.notificationService.warn(localize('update conflicts', "Could not resolve conflicts as there is new local version available. Please try again.")); - } - }); - } } })); diff --git a/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts b/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts index 9b7f7dc0a44..bdce1889a7e 100644 --- a/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts +++ b/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts @@ -84,16 +84,16 @@ export class SettingsSyncService extends Disposable implements ISettingsSyncServ return this.channel.call('hasLocalData'); } - resolveConflicts(content: string, remote: boolean): Promise { - return this.channel.call('resolveConflicts', [content, remote]); + accept(content: string): Promise { + return this.channel.call('accept', [content]); } resolveSettingsConflicts(conflicts: { key: string, value: any | undefined }[]): Promise { return this.channel.call('resolveConflicts', [conflicts]); } - getRemoteContent(): Promise { - return this.channel.call('getRemoteContent'); + getRemoteContent(preview?: boolean): Promise { + return this.channel.call('getRemoteContent', [!!preview]); } private async updateStatus(status: SyncStatus): Promise { diff --git a/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts b/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts index 37403a6f7a3..09f62bc9082 100644 --- a/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts +++ b/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts @@ -49,8 +49,8 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ return this.channel.call('sync'); } - resolveConflictsAndContinueSync(content: string, remote: boolean): Promise { - return this.channel.call('resolveConflictsAndContinueSync', [content, remote]); + accept(source: SyncSource, content: string): Promise { + return this.channel.call('accept', [source, content]); } reset(): Promise { @@ -82,8 +82,8 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ return this.channel.call('hasLocalData'); } - getRemoteContent(source: SyncSource): Promise { - return this.channel.call('getRemoteContent', [source]); + getRemoteContent(source: SyncSource, preview: boolean): Promise { + return this.channel.call('getRemoteContent', [source, preview]); } isFirstTimeSyncAndHasUserData(): Promise {