483
484
async removeProfile(profileToRemove: IUserDataProfile): Promise<void> {
486
throw new Error('Cannot remove default profile');
487
}
488
>
const profile = this.profiles.find(p => p.id === profileToRemove.id);
userDataProfile.ts
489
>
if (!profile) {
490
throw new Error(`Profile '${profileToRemove.name}' does not exist`);
491
}
493
>
const joiners: Promise<void>[] = [];
494
>
this._onWillRemoveProfile.fire({
495
>
profile,
496
>
join(promise) {
497
joiners.push(promise);
498
}
500
>
501
>
try {
502
>
await Promise.allSettled(joiners);
503
>
} catch (error) {
504
this.logService.error(error);
505
}
507
>
this.updateProfiles([], [profile], []);
508
>
509
>
try {
510
>
await this.fileService.del(profile.cacheHome, { recursive: true });
511
>
} catch (error) {
512
>
if (toFileOperationResult(error) !== FileOperationResult.FILE_NOT_FOUND) {
513
this.logService.error(error);
514
}
516
>
}
517
518
async setProfileForWorkspace(workspaceIdentifier: IAnyWorkspaceIdentifier, profileToSet: IUserDataProfile): Promise<void> {