Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix 208710 #209343

Merged
merged 3 commits into from
Apr 2, 2024
Merged

fix 208710 #209343

Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/vs/platform/userDataProfile/common/userDataProfile.ts
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ export class UserDataProfilesService extends Disposable implements IUserDataProf
try {
const existing = this.profiles.find(p => p.name === name || p.id === id);
if (existing) {
return existing;
throw new Error(`Profile with ${name} name already exists`);
}

const profile = toUserDataProfile(id, name, joinPath(this.profilesHome, id), this.profilesCacheHome, options, this.defaultProfile);
Expand Down
38 changes: 15 additions & 23 deletions src/vs/platform/userDataSync/common/userDataProfilesManifestSync.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,34 +187,26 @@ export class UserDataProfilesManifestSynchroniser extends AbstractSynchroniser i

if (localChange !== Change.None) {
await this.backupLocal(stringifyLocalProfiles(this.getLocalUserDataProfiles(), false));
const promises: Promise<any>[] = [];
for (const profile of local.added) {
promises.push((async () => {
this.logService.trace(`${this.syncResourceLogLabel}: Creating '${profile.name}' profile...`);
await this.userDataProfilesService.createProfile(profile.id, profile.name, { shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
this.logService.info(`${this.syncResourceLogLabel}: Created profile '${profile.name}'.`);
})());
}
for (const profile of local.removed) {
promises.push((async () => {
this.logService.trace(`${this.syncResourceLogLabel}: Removing '${profile.name}' profile...`);
await this.userDataProfilesService.removeProfile(profile);
this.logService.info(`${this.syncResourceLogLabel}: Removed profile '${profile.name}'.`);
})());
}
for (const profile of local.updated) {
await Promise.all(local.removed.map(async profile => {
this.logService.trace(`${this.syncResourceLogLabel}: Removing '${profile.name}' profile...`);
await this.userDataProfilesService.removeProfile(profile);
this.logService.info(`${this.syncResourceLogLabel}: Removed profile '${profile.name}'.`);
}));
await Promise.all(local.added.map(async profile => {
this.logService.trace(`${this.syncResourceLogLabel}: Creating '${profile.name}' profile...`);
await this.userDataProfilesService.createProfile(profile.id, profile.name, { shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
this.logService.info(`${this.syncResourceLogLabel}: Created profile '${profile.name}'.`);
}));
await Promise.all(local.updated.map(async profile => {
const localProfile = this.userDataProfilesService.profiles.find(p => p.id === profile.id);
if (localProfile) {
promises.push((async () => {
this.logService.trace(`${this.syncResourceLogLabel}: Updating '${profile.name}' profile...`);
await this.userDataProfilesService.updateProfile(localProfile, { name: profile.name, shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
this.logService.info(`${this.syncResourceLogLabel}: Updated profile '${profile.name}'.`);
})());
this.logService.trace(`${this.syncResourceLogLabel}: Updating '${profile.name}' profile...`);
await this.userDataProfilesService.updateProfile(localProfile, { name: profile.name, shortName: profile.shortName, icon: profile.icon, useDefaultFlags: profile.useDefaultFlags });
this.logService.info(`${this.syncResourceLogLabel}: Updated profile '${profile.name}'.`);
} else {
this.logService.info(`${this.syncResourceLogLabel}: Could not find profile with id '${profile.id}' to update.`);
}
}
await Promise.all(promises);
}));
}

if (remoteChange !== Change.None) {
Expand Down
Loading