Skip to content

Commit 2df2965

Browse files
authored
1 parent 15af44e commit 2df2965

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.ts

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ import { IClipboardService } from 'vs/platform/clipboard/common/clipboardService
5858
import { IURLHandler, IURLService } from 'vs/platform/url/common/url';
5959
import { asText, IRequestService } from 'vs/platform/request/common/request';
6060
import { IProductService } from 'vs/platform/product/common/productService';
61-
import { isUndefined } from 'vs/base/common/types';
61+
import { Mutable, isUndefined } from 'vs/base/common/types';
6262
import { Action, ActionRunner, IAction, IActionRunner } from 'vs/base/common/actions';
6363
import { isWeb } from 'vs/base/common/platform';
6464
import { Action2, MenuId, registerAction2 } from 'vs/platform/actions/common/actions';
@@ -204,7 +204,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
204204
location: ProgressLocation.Window,
205205
command: showWindowLogActionId,
206206
title: localize('resolving uri', "{0}: Resolving profile content...", options?.mode ? localize('preview profile', "Preview Profile") : localize('import profile', "Create Profile")),
207-
}, () => this.resolveProfileTemplate(uri));
207+
}, () => this.resolveProfileTemplate(uri, options));
208208
if (!profileTemplate) {
209209
return;
210210
}
@@ -348,17 +348,21 @@ export class UserDataProfileImportExportService extends Disposable implements IU
348348
}
349349
}
350350

351-
private async resolveProfileTemplate(uri: URI): Promise<IUserDataProfileTemplate | null> {
351+
private async resolveProfileTemplate(uri: URI, options?: IProfileImportOptions): Promise<IUserDataProfileTemplate | null> {
352352
const profileContent = await this.resolveProfileContent(uri);
353353
if (profileContent === null) {
354354
return null;
355355
}
356356

357-
const profileTemplate: IUserDataProfileTemplate = JSON.parse(profileContent);
357+
const profileTemplate: Mutable<IUserDataProfileTemplate> = JSON.parse(profileContent);
358358
if (!isUserDataProfileTemplate(profileTemplate)) {
359359
throw new Error('Invalid profile content.');
360360
}
361361

362+
if (options?.name) {
363+
profileTemplate.name = options.name;
364+
}
365+
362366
return profileTemplate;
363367
}
364368

0 commit comments

Comments
 (0)