mirror of
https://github.com/microsoft/vscode.git
synced 2026-04-26 11:38:51 +01:00
- do not block sync if there are conflicts in one area
- allow confilicts in multiple areas
This commit is contained in:
@@ -24,8 +24,10 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
|
||||
get onDidChangeLocal(): Event<void> { return this.channel.listen('onDidChangeLocal'); }
|
||||
|
||||
private _conflictsSource: SyncSource | null = null;
|
||||
get conflictsSource(): SyncSource | null { return this._conflictsSource; }
|
||||
private _conflictsSources: SyncSource[] = [];
|
||||
get conflictsSources(): SyncSource[] { return this._conflictsSources; }
|
||||
private _onDidChangeConflicts: Emitter<SyncSource[]> = this._register(new Emitter<SyncSource[]>());
|
||||
readonly onDidChangeConflicts: Event<SyncSource[]> = this._onDidChangeConflicts.event;
|
||||
|
||||
constructor(
|
||||
@ISharedProcessService sharedProcessService: ISharedProcessService
|
||||
@@ -41,10 +43,12 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
return userDataSyncChannel.listen(event, arg);
|
||||
}
|
||||
};
|
||||
this.channel.call<SyncStatus>('_getInitialStatus').then(status => {
|
||||
this.channel.call<[SyncStatus, SyncSource[]]>('_getInitialData').then(([status, conflicts]) => {
|
||||
this.updateStatus(status);
|
||||
this.updateConflicts(conflicts);
|
||||
this._register(this.channel.listen<SyncStatus>('onDidChangeStatus')(status => this.updateStatus(status)));
|
||||
});
|
||||
this._register(this.channel.listen<SyncSource[]>('onDidChangeConflicts')(conflicts => this.updateConflicts(conflicts)));
|
||||
}
|
||||
|
||||
pull(): Promise<void> {
|
||||
@@ -75,8 +79,8 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
return this.channel.call('stop');
|
||||
}
|
||||
|
||||
async restart(): Promise<void> {
|
||||
const status = await this.channel.call<SyncStatus>('restart');
|
||||
async restart(source: SyncSource): Promise<void> {
|
||||
const status = await this.channel.call<SyncStatus>('restart', [source]);
|
||||
await this.updateStatus(status);
|
||||
}
|
||||
|
||||
@@ -101,11 +105,15 @@ export class UserDataSyncService extends Disposable implements IUserDataSyncServ
|
||||
}
|
||||
|
||||
private async updateStatus(status: SyncStatus): Promise<void> {
|
||||
this._conflictsSource = await this.channel.call<SyncSource>('getConflictsSource');
|
||||
this._status = status;
|
||||
this._onDidChangeStatus.fire(status);
|
||||
}
|
||||
|
||||
private async updateConflicts(conflicts: SyncSource[]): Promise<void> {
|
||||
this._conflictsSources = conflicts;
|
||||
this._onDidChangeConflicts.fire(conflicts);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
registerSingleton(IUserDataSyncService, UserDataSyncService);
|
||||
|
||||
Reference in New Issue
Block a user