467
468
private async updateRemotePrompts(resourcePreviews: IPromptsAcceptedResourcePreview[], remoteUserData: IRemoteUserData, forcePush: boolean): Promise<IRemoteUserData> {
469
>
const currentPrompts: IStringDictionary<string> = remoteUserData.syncData ? this.parsePrompts(remoteUserData.syncData) : {};
promptsSync.ts
470
>
const newPrompts: IStringDictionary<string> = deepClone(currentPrompts);
471
>
472
>
for (const { acceptResult, localResource, remoteResource, remoteChange } of resourcePreviews) {
473
>
if (remoteChange !== Change.None) {
474
>
const key = localResource ? this.extUri.basename(localResource) : this.extUri.basename(remoteResource);
475
>
if (remoteChange === Change.Deleted) {
476
delete newPrompts[key];
478
>
newPrompts[key] = acceptResult.content!;
479
>
}
480
>
}
481
>
}
482
>
483
>
if (!areSame(currentPrompts, newPrompts)) {
484
>
// update remote
485
>
this.logService.trace(`${this.syncResourceLogLabel}: Updating remote prompts...`);
486
>
remoteUserData = await this.updateRemoteUserData(JSON.stringify(newPrompts), forcePush ? null : remoteUserData.ref);
487
>
this.logService.info(`${this.syncResourceLogLabel}: Updated remote prompts`);
488
>
}
489
>
return remoteUserData;
490
>
}
491
492
private parsePrompts(syncData: ISyncData): IStringDictionary<string> {