diff --git a/src/vs/platform/userDataSync/common/abstractSynchronizer.ts b/src/vs/platform/userDataSync/common/abstractSynchronizer.ts index 6377afae63c..a14c3d62297 100644 --- a/src/vs/platform/userDataSync/common/abstractSynchronizer.ts +++ b/src/vs/platform/userDataSync/common/abstractSynchronizer.ts @@ -4,10 +4,10 @@ *--------------------------------------------------------------------------------------------*/ import { Disposable } from 'vs/base/common/lifecycle'; -import { IFileService, IFileContent } from 'vs/platform/files/common/files'; +import { IFileService, IFileContent, FileChangesEvent, FileSystemProviderError, FileSystemProviderErrorCode, FileOperationResult, FileOperationError } from 'vs/platform/files/common/files'; import { VSBuffer } from 'vs/base/common/buffer'; import { URI } from 'vs/base/common/uri'; -import { SyncSource, SyncStatus, IUserData, IUserDataSyncStoreService } from 'vs/platform/userDataSync/common/userDataSync'; +import { SyncSource, SyncStatus, IUserData, IUserDataSyncStoreService, UserDataSyncErrorCode, UserDataSyncError } from 'vs/platform/userDataSync/common/userDataSync'; import { IEnvironmentService } from 'vs/platform/environment/common/environment'; import { joinPath, dirname } from 'vs/base/common/resources'; import { toLocalISOString } from 'vs/base/common/date'; @@ -116,6 +116,7 @@ export abstract class AbstractSynchroniser extends Disposable { } } + protected abstract readonly enabled: boolean; protected abstract getRemoteDataResourceKey(): string; } @@ -131,7 +132,7 @@ export abstract class AbstractFileSynchroniser extends AbstractSynchroniser { ) { super(source, fileService, environmentService, userDataSyncStoreService, telemetryService); this._register(this.fileService.watch(dirname(file))); - this._register(Event.filter(this.fileService.onFileChanges, e => e.contains(file))(() => this._onDidChangeLocal.fire())); + this._register(this.fileService.onFileChanges(e => this.onFileChanges(e))); } protected async getLocalFileContent(): Promise { @@ -143,14 +144,44 @@ export abstract class AbstractFileSynchroniser extends AbstractSynchroniser { } protected async updateLocalFileContent(newContent: string, oldContent: IFileContent | null): Promise { - if (oldContent) { - // file exists already - await this.backupLocal(oldContent.value); - await this.fileService.writeFile(this.file, VSBuffer.fromString(newContent), oldContent); - } else { - // file does not exist - await this.fileService.createFile(this.file, VSBuffer.fromString(newContent), { overwrite: false }); + try { + if (oldContent) { + // file exists already + await this.backupLocal(oldContent.value); + await this.fileService.writeFile(this.file, VSBuffer.fromString(newContent), oldContent); + } else { + // file does not exist + await this.fileService.createFile(this.file, VSBuffer.fromString(newContent), { overwrite: false }); + } + } catch (e) { + if ((e instanceof FileSystemProviderError && e.code === FileSystemProviderErrorCode.FileExists) || + (e instanceof FileOperationError && e.fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE)) { + throw new UserDataSyncError(e.message, UserDataSyncErrorCode.NewLocal); + } else { + throw e; + } } } + private onFileChanges(e: FileChangesEvent): void { + if (!e.contains(this.file)) { + return; + } + if (!this.enabled) { + return; + } + // Sync again if local file has changed and current status is in conflicts + if (this.status === SyncStatus.HasConflicts) { + this.cancel(); + this.doSync(); + } + // Otherwise fire change event + else { + this._onDidChangeLocal.fire(); + } + + } + + protected abstract cancel(): void; + protected abstract doSync(): Promise; } diff --git a/src/vs/platform/userDataSync/common/extensionsSync.ts b/src/vs/platform/userDataSync/common/extensionsSync.ts index c732720838d..5fcafebec70 100644 --- a/src/vs/platform/userDataSync/common/extensionsSync.ts +++ b/src/vs/platform/userDataSync/common/extensionsSync.ts @@ -33,6 +33,8 @@ interface ILastSyncUserData extends IUserData { export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUserDataSynchroniser { + protected get enabled(): boolean { return this.configurationService.getValue('sync.enableExtensions') === true; } + constructor( @IEnvironmentService environmentService: IEnvironmentService, @IFileService fileService: IFileService, @@ -57,7 +59,7 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse protected getRemoteDataResourceKey(): string { return 'extensions'; } async pull(): Promise { - if (!this.configurationService.getValue('sync.enableExtensions')) { + if (!this.enabled) { this.logService.info('Extensions: Skipped pulling extensions as it is disabled.'); return; } @@ -90,7 +92,7 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse } async push(): Promise { - if (!this.configurationService.getValue('sync.enableExtensions')) { + if (!this.enabled) { this.logService.info('Extensions: Skipped pushing extensions as it is disabled.'); return; } @@ -115,7 +117,7 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse } async sync(): Promise { - if (!this.configurationService.getValue('sync.enableExtensions')) { + if (!this.enabled) { this.logService.info('Extensions: Skipping synchronizing extensions as it is disabled.'); return; } @@ -150,10 +152,6 @@ export class ExtensionsSynchroniser extends AbstractSynchroniser implements IUse async stop(): Promise { } - async restart(): Promise { - throw new Error('Extensions: Conflicts should not occur'); - } - 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 e8b73b53b5d..ec3bf3580e1 100644 --- a/src/vs/platform/userDataSync/common/globalStateSync.ts +++ b/src/vs/platform/userDataSync/common/globalStateSync.ts @@ -28,6 +28,8 @@ interface ISyncPreviewResult { export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUserDataSynchroniser { + protected get enabled(): boolean { return this.configurationService.getValue('sync.enableUIState') === true; } + constructor( @IFileService fileService: IFileService, @IUserDataSyncStoreService userDataSyncStoreService: IUserDataSyncStoreService, @@ -44,7 +46,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs protected getRemoteDataResourceKey(): string { return 'globalState'; } async pull(): Promise { - if (!this.configurationService.getValue('sync.enableUIState')) { + if (!this.enabled) { this.logService.info('UI State: Skipped pulling ui state as it is disabled.'); return; } @@ -75,7 +77,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs } async push(): Promise { - if (!this.configurationService.getValue('sync.enableUIState')) { + if (!this.enabled) { this.logService.info('UI State: Skipped pushing UI State as it is disabled.'); return; } @@ -99,7 +101,7 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs } async sync(): Promise { - if (!this.configurationService.getValue('sync.enableUIState')) { + if (!this.enabled) { this.logService.info('UI State: Skipping synchronizing UI state as it is disabled.'); return; } @@ -130,10 +132,6 @@ export class GlobalStateSynchroniser extends AbstractSynchroniser implements IUs async stop(): Promise { } - async restart(): Promise { - throw new Error('UI State: Conflicts should not occur'); - } - 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 9f56513c80c..fea4731eedf 100644 --- a/src/vs/platform/userDataSync/common/keybindingsSync.ts +++ b/src/vs/platform/userDataSync/common/keybindingsSync.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IFileService, FileSystemProviderErrorCode, FileSystemProviderError, IFileContent, FileOperationError, FileOperationResult } from 'vs/platform/files/common/files'; +import { IFileService, IFileContent, FileOperationError, FileOperationResult } from 'vs/platform/files/common/files'; import { IUserData, UserDataSyncError, UserDataSyncErrorCode, SyncStatus, IUserDataSyncStoreService, IUserDataSyncLogService, IUserDataSyncUtilService, SyncSource, IUserDataSynchroniser } from 'vs/platform/userDataSync/common/userDataSync'; import { merge } from 'vs/platform/userDataSync/common/keybindingsMerge'; import { VSBuffer } from 'vs/base/common/buffer'; @@ -39,6 +39,7 @@ interface ISyncPreviewResult { export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements IUserDataSynchroniser { private syncPreviewResultPromise: CancelablePromise | null = null; + protected get enabled(): boolean { return this.configurationService.getValue('sync.enableKeybindings') === true; } constructor( @IUserDataSyncStoreService userDataSyncStoreService: IUserDataSyncStoreService, @@ -54,8 +55,15 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements protected getRemoteDataResourceKey(): string { return 'keybindings'; } + protected cancel(): void { + if (this.syncPreviewResultPromise) { + this.syncPreviewResultPromise.cancel(); + this.syncPreviewResultPromise = null; + } + } + async pull(): Promise { - if (!this.configurationService.getValue('sync.enableKeybindings')) { + if (!this.enabled) { this.logService.info('Keybindings: Skipped pulling keybindings as it is disabled.'); return; } @@ -97,7 +105,7 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements } async push(): Promise { - if (!this.configurationService.getValue('sync.enableKeybindings')) { + if (!this.enabled) { this.logService.info('Keybindings: Skipped pushing keybindings as it is disabled.'); return; } @@ -138,7 +146,7 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements } async sync(): Promise { - if (!this.configurationService.getValue('sync.enableKeybindings')) { + if (!this.enabled) { this.logService.info('Keybindings: Skipping synchronizing keybindings as it is disabled.'); return; } @@ -153,35 +161,16 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements } async stop(): Promise { - if (this.syncPreviewResultPromise) { - this.syncPreviewResultPromise.cancel(); - this.syncPreviewResultPromise = null; - this.logService.trace('Keybindings: Stopped synchronizing keybindings.'); - } + this.cancel(); + this.logService.trace('Keybindings: Stopped synchronizing keybindings.'); await this.fileService.del(this.environmentService.keybindingsSyncPreviewResource); this.setStatus(SyncStatus.Idle); } - async restart(): Promise { - if (this.status === SyncStatus.HasConflicts) { - this.syncPreviewResultPromise!.cancel(); - this.syncPreviewResultPromise = null; - await this.doSync(); - } - } - async accept(content: string): Promise { if (this.status === SyncStatus.HasConflicts) { - try { - await this.apply(content, true); - this.setStatus(SyncStatus.Idle); - } catch (e) { - if ((e instanceof FileSystemProviderError && e.code === FileSystemProviderErrorCode.FileExists) || - (e instanceof FileOperationError && e.fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE)) { - throw new UserDataSyncError('Failed to resolve conflicts as there is a new local version available.', UserDataSyncErrorCode.NewLocal); - } - throw e; - } + await this.apply(content, true); + this.setStatus(SyncStatus.Idle); } } @@ -215,7 +204,7 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements return content ? this.getKeybindingsContentFromSyncContent(content) : null; } - private async doSync(): Promise { + protected async doSync(): Promise { try { const result = await this.getPreview(); if (result.hasConflicts) { @@ -232,16 +221,17 @@ export class KeybindingsSynchroniser extends AbstractFileSynchroniser implements } catch (e) { this.syncPreviewResultPromise = null; this.setStatus(SyncStatus.Idle); - if (e instanceof UserDataSyncError && e.code === UserDataSyncErrorCode.Rejected) { - // Rejected as there is a new remote version. Syncing again, - this.logService.info('Keybindings: Failed to synchronize keybindings as there is a new remote version available. Synchronizing again...'); - return this.sync(); - } - if ((e instanceof FileSystemProviderError && e.code === FileSystemProviderErrorCode.FileExists) || - (e instanceof FileOperationError && e.fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE)) { - // Rejected as there is a new local version. Syncing again. - this.logService.info('Keybindings: Failed to synchronize keybindings as there is a new local version available. Synchronizing again...'); - return this.sync(); + if (e instanceof UserDataSyncError) { + switch (e.code) { + case UserDataSyncErrorCode.Rejected: + // Rejected as there is a new remote version. Syncing again, + this.logService.info('Keybindings: Failed to synchronize keybindings as there is a new remote version available. Synchronizing again...'); + return this.sync(); + case UserDataSyncErrorCode.NewLocal: + // Rejected as there is a new local version. Syncing again. + this.logService.info('Keybindings: Failed to synchronize keybindings as there is a new local version available. Synchronizing again...'); + return this.sync(); + } } throw e; } diff --git a/src/vs/platform/userDataSync/common/settingsSync.ts b/src/vs/platform/userDataSync/common/settingsSync.ts index 17ca8153c80..c688cb0be38 100644 --- a/src/vs/platform/userDataSync/common/settingsSync.ts +++ b/src/vs/platform/userDataSync/common/settingsSync.ts @@ -3,7 +3,7 @@ * Licensed under the MIT License. See License.txt in the project root for license information. *--------------------------------------------------------------------------------------------*/ -import { IFileService, FileSystemProviderErrorCode, FileSystemProviderError, IFileContent, FileOperationError, FileOperationResult } from 'vs/platform/files/common/files'; +import { IFileService, IFileContent, FileOperationError, FileOperationResult } from 'vs/platform/files/common/files'; import { IUserData, UserDataSyncError, UserDataSyncErrorCode, SyncStatus, IUserDataSyncStoreService, IUserDataSyncLogService, IUserDataSyncUtilService, IConflictSetting, ISettingsSyncService, CONFIGURATION_SYNC_STORE_KEY, SyncSource } from 'vs/platform/userDataSync/common/userDataSync'; import { VSBuffer } from 'vs/base/common/buffer'; import { parse, ParseError } from 'vs/base/common/json'; @@ -44,6 +44,8 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS private _onDidChangeConflicts: Emitter = this._register(new Emitter()); readonly onDidChangeConflicts: Event = this._onDidChangeConflicts.event; + protected get enabled(): boolean { return this.configurationService.getValue('sync.enableSettings') === true; } + constructor( @IFileService fileService: IFileService, @IEnvironmentService private readonly environmentService: IEnvironmentService, @@ -65,6 +67,13 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } } + protected cancel(): void { + if (this.syncPreviewResultPromise) { + this.syncPreviewResultPromise.cancel(); + this.syncPreviewResultPromise = null; + } + } + private setConflicts(conflicts: IConflictSetting[]): void { if (!arrays.equals(this.conflicts, conflicts, (a, b) => a.key === b.key && objects.equals(a.localValue, b.localValue) && objects.equals(a.remoteValue, b.remoteValue)) @@ -75,7 +84,7 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } async pull(): Promise { - if (!this.configurationService.getValue('sync.enableSettings')) { + if (!this.enabled) { this.logService.info('Settings: Skipped pulling settings as it is disabled.'); return; } @@ -120,7 +129,7 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } async push(): Promise { - if (!this.configurationService.getValue('sync.enableSettings')) { + if (!this.enabled) { this.logService.info('Settings: Skipped pushing settings as it is disabled.'); return; } @@ -166,7 +175,7 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } async sync(): Promise { - if (!this.configurationService.getValue('sync.enableSettings')) { + if (!this.enabled) { this.logService.info('Settings: Skipping synchronizing settings as it is disabled.'); return; } @@ -181,11 +190,8 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } async stop(): Promise { - if (this.syncPreviewResultPromise) { - this.syncPreviewResultPromise.cancel(); - this.syncPreviewResultPromise = null; - this.logService.trace('Settings: Stopped synchronizing settings.'); - } + this.cancel(); + this.logService.trace('Settings: Stopped synchronizing settings.'); await this.fileService.del(this.environmentService.settingsSyncPreviewResource); this.setStatus(SyncStatus.Idle); } @@ -227,43 +233,26 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS return content !== undefined ? content : null; } - async restart(): Promise { - if (this.status === SyncStatus.HasConflicts) { - this.syncPreviewResultPromise!.cancel(); - this.syncPreviewResultPromise = null; - await this.doSync([]); - } - } - async accept(content: string): Promise { if (this.status === SyncStatus.HasConflicts) { - try { - 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) { - if ((e instanceof FileSystemProviderError && e.code === FileSystemProviderErrorCode.FileExists) || - (e instanceof FileOperationError && e.fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE)) { - throw new UserDataSyncError('Failed to resolve conflicts as there is a new local version available.', UserDataSyncErrorCode.NewLocal); - } - throw e; - } + 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); } } async resolveSettingsConflicts(resolvedConflicts: { key: string, value: any | undefined }[]): Promise { if (this.status === SyncStatus.HasConflicts) { - this.syncPreviewResultPromise!.cancel(); - this.syncPreviewResultPromise = null; + this.cancel(); await this.doSync(resolvedConflicts); } } - private async doSync(resolvedConflicts: { key: string, value: any | undefined }[]): Promise { + protected async doSync(resolvedConflicts: { key: string, value: any | undefined }[] = []): Promise { try { const result = await this.getPreview(resolvedConflicts); if (result.hasConflicts) { @@ -280,16 +269,17 @@ export class SettingsSynchroniser extends AbstractFileSynchroniser implements IS } catch (e) { this.syncPreviewResultPromise = null; this.setStatus(SyncStatus.Idle); - if (e instanceof UserDataSyncError && e.code === UserDataSyncErrorCode.Rejected) { - // Rejected as there is a new remote version. Syncing again, - this.logService.info('Settings: Failed to synchronize settings as there is a new remote version available. Synchronizing again...'); - return this.sync(); - } - if ((e instanceof FileSystemProviderError && e.code === FileSystemProviderErrorCode.FileExists) || - (e instanceof FileOperationError && e.fileOperationResult === FileOperationResult.FILE_MODIFIED_SINCE)) { - // Rejected as there is a new local version. Syncing again. - this.logService.info('Settings: Failed to synchronize settings as there is a new local version available. Synchronizing again...'); - return this.sync(); + if (e instanceof UserDataSyncError) { + switch (e.code) { + case UserDataSyncErrorCode.Rejected: + // Rejected as there is a new remote version. Syncing again, + this.logService.info('Settings: Failed to synchronize settings as there is a new remote version available. Synchronizing again...'); + return this.sync(); + case UserDataSyncErrorCode.NewLocal: + // Rejected as there is a new local version. Syncing again. + this.logService.info('Settings: Failed to synchronize settings as there is a new local version available. Synchronizing again...'); + return this.sync(); + } } throw e; } diff --git a/src/vs/platform/userDataSync/common/userDataSync.ts b/src/vs/platform/userDataSync/common/userDataSync.ts index ad1825c7f91..2b2f9e6314e 100644 --- a/src/vs/platform/userDataSync/common/userDataSync.ts +++ b/src/vs/platform/userDataSync/common/userDataSync.ts @@ -219,7 +219,6 @@ export interface IUserDataSynchroniser extends ISynchroniser { readonly source: SyncSource; getRemoteContent(preivew?: boolean): Promise; accept(content: string): Promise; - restart(): Promise; } export const IUserDataSyncService = createDecorator('IUserDataSyncService'); @@ -232,7 +231,6 @@ export interface IUserDataSyncService extends ISynchroniser { resetLocal(): Promise; getRemoteContent(source: SyncSource, preview: boolean): Promise; accept(source: SyncSource, content: string): Promise; - restart(source: SyncSource): 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 245d4b19923..a41a0ed7b7c 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncIpc.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncIpc.ts @@ -31,7 +31,6 @@ export class UserDataSyncChannel implements IServerChannel { case 'pull': return this.service.pull(); case 'push': return this.service.push(); case 'stop': this.service.stop(); return Promise.resolve(); - case 'restart': return this.service.restart(args[0]).then(() => this.service.status); case 'reset': return this.service.reset(); case 'resetLocal': return this.service.resetLocal(); case 'hasPreviouslySynced': return this.service.hasPreviouslySynced(); @@ -63,7 +62,6 @@ export class SettingsSyncChannel implements IServerChannel { 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); case '_getInitialStatus': return Promise.resolve(this.service.status); case '_getInitialConflicts': return Promise.resolve(this.service.conflicts); case 'stop': this.service.stop(); return Promise.resolve(); diff --git a/src/vs/platform/userDataSync/common/userDataSyncService.ts b/src/vs/platform/userDataSync/common/userDataSyncService.ts index 9a3ad776b1c..25a4e08288c 100644 --- a/src/vs/platform/userDataSync/common/userDataSyncService.ts +++ b/src/vs/platform/userDataSync/common/userDataSyncService.ts @@ -123,11 +123,6 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ } } - async restart(source: SyncSource): Promise { - const synchroniser = this.getSynchroniser(source); - await synchroniser.restart(); - } - async accept(source: SyncSource, content: string): Promise { const synchroniser = this.getSynchroniser(source); return synchroniser.accept(content); diff --git a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts index f1453252aba..28f18e5a8aa 100644 --- a/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts +++ b/src/vs/workbench/contrib/userDataSync/browser/userDataSync.ts @@ -835,11 +835,9 @@ class AcceptChangesContribution extends Disposable implements IEditorContributio await this.userDataSyncService.accept(conflictsSource, model.getValue()); } catch (e) { if (e instanceof UserDataSyncError && e.code === UserDataSyncErrorCode.NewLocal) { - this.userDataSyncService.restart(conflictsSource).then(() => { - if (this.userDataSyncService.conflictsSources.indexOf(conflictsSource) !== -1) { - this.notificationService.warn(localize('update conflicts', "Could not resolve conflicts as there is new local version available. Please try again.")); - } - }); + if (this.userDataSyncService.conflictsSources.indexOf(conflictsSource) !== -1) { + this.notificationService.warn(localize('update conflicts', "Could not resolve conflicts as there is new local version available. Please try again.")); + } } else { this.notificationService.error(e); } diff --git a/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts b/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts index bdce1889a7e..79f40e72b5d 100644 --- a/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts +++ b/src/vs/workbench/services/userDataSync/electron-browser/settingsSyncService.ts @@ -63,11 +63,6 @@ export class SettingsSyncService extends Disposable implements ISettingsSyncServ return this.channel.call('stop'); } - async restart(): Promise { - const status = await this.channel.call('restart'); - await this.updateStatus(status); - } - resetLocal(): Promise { return this.channel.call('resetLocal'); } diff --git a/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts b/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts index c07c027291e..b633f233998 100644 --- a/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts +++ b/src/vs/workbench/services/userDataSync/electron-browser/userDataSyncService.ts @@ -79,11 +79,6 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ return this.channel.call('stop'); } - async restart(source: SyncSource): Promise { - const status = await this.channel.call('restart', [source]); - await this.updateStatus(status); - } - hasPreviouslySynced(): Promise { return this.channel.call('hasPreviouslySynced'); }