@codingame/monaco-vscode-user-data-profile-service-override 7.1.0 → 8.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/base/browser/ui/radio/radio.css.js +6 -0
- package/vscode/src/vs/base/browser/ui/radio/radio.js +69 -0
- package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +5 -8
- package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +28 -11
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +96 -60
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +13 -15
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +744 -349
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +114 -70
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +7 -9
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +4 -6
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +2 -3
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +93 -130
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +12 -16
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +2 -2
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
|
|
2
2
|
import './media/userDataProfileView.css.js';
|
|
3
|
-
import {
|
|
3
|
+
import { localize } from 'vscode/vscode/vs/nls';
|
|
4
4
|
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
5
5
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
6
6
|
import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
|
|
@@ -83,7 +83,6 @@ import { IAccessibleViewInformationService } from 'vscode/vscode/vs/workbench/se
|
|
|
83
83
|
import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
|
|
84
84
|
|
|
85
85
|
var UserDataProfileImportExportService_1;
|
|
86
|
-
const _moduleId = "vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService";
|
|
87
86
|
function isUserDataProfileTemplate(thing) {
|
|
88
87
|
const candidate = thing;
|
|
89
88
|
return !!(candidate && typeof candidate === 'object'
|
|
@@ -146,7 +145,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
146
145
|
await this.importProfile(uri);
|
|
147
146
|
}
|
|
148
147
|
catch (error) {
|
|
149
|
-
this.notificationService.error((
|
|
148
|
+
this.notificationService.error(( localize(3183, "Error while importing profile: {0}", getErrorMessage(error))));
|
|
150
149
|
}
|
|
151
150
|
return true;
|
|
152
151
|
}
|
|
@@ -182,12 +181,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
182
181
|
const profileTemplate = await this.progressService.withProgress({
|
|
183
182
|
location: ProgressLocation.Window,
|
|
184
183
|
command: showWindowLogActionId,
|
|
185
|
-
title: (
|
|
186
|
-
_moduleId,
|
|
187
|
-
1,
|
|
188
|
-
"{0}: Resolving profile content...",
|
|
189
|
-
options?.mode ? ( localizeWithPath(_moduleId, 2, "Preview Profile")) : ( localizeWithPath(_moduleId, 3, "Create Profile"))
|
|
190
|
-
)),
|
|
184
|
+
title: ( localize(3184, "{0}: Resolving profile content...", options?.mode ? ( localize(3185, "Preview Profile")) : ( localize(3186, "Create Profile")))),
|
|
191
185
|
}, () => this.resolveProfileTemplate(uri, options));
|
|
192
186
|
if (!profileTemplate) {
|
|
193
187
|
return;
|
|
@@ -196,7 +190,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
196
190
|
await this.previewProfile(profileTemplate, options);
|
|
197
191
|
}
|
|
198
192
|
else if (mode === 'apply') {
|
|
199
|
-
await this.createAndSwitch(profileTemplate, !!options?.transient, true, options, (
|
|
193
|
+
await this.createAndSwitch(profileTemplate, !!options?.transient, true, options, ( localize(3187, "Create Profile")));
|
|
200
194
|
}
|
|
201
195
|
else if (mode === 'both') {
|
|
202
196
|
await this.importAndPreviewProfile(uri, profileTemplate, options);
|
|
@@ -223,7 +217,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
223
217
|
sticky: true,
|
|
224
218
|
cancellable: true,
|
|
225
219
|
}, async (progress) => {
|
|
226
|
-
const reportProgress = (message) => progress.report({ message: (
|
|
220
|
+
const reportProgress = (message) => progress.report({ message: ( localize(3188, "Create Profile: {0}", message)) });
|
|
227
221
|
creationPromise = createCancelablePromise(async (token) => {
|
|
228
222
|
const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, from, { ...options?.resourceTypeFlags, extensions: false }));
|
|
229
223
|
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(options.name ?? from.name, options?.icon);
|
|
@@ -239,7 +233,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
239
233
|
try {
|
|
240
234
|
await creationPromise;
|
|
241
235
|
if (profile && (options?.resourceTypeFlags?.extensions ?? true)) {
|
|
242
|
-
reportProgress((
|
|
236
|
+
reportProgress(( localize(3189, "Installing Extensions...")));
|
|
243
237
|
await this.instantiationService.createInstance(ExtensionsResource).copy(from, profile, false);
|
|
244
238
|
}
|
|
245
239
|
}
|
|
@@ -263,7 +257,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
263
257
|
sticky: true,
|
|
264
258
|
cancellable: true,
|
|
265
259
|
}, async (progress) => {
|
|
266
|
-
const reportProgress = (message) => progress.report({ message: (
|
|
260
|
+
const reportProgress = (message) => progress.report({ message: ( localize(3189, "Create Profile: {0}", message)) });
|
|
267
261
|
creationPromise = createCancelablePromise(async (token) => {
|
|
268
262
|
profile = await this.getProfileToImport({ ...profileTemplate, name: options.name ?? profileTemplate.name }, !!options.transient, options);
|
|
269
263
|
if (!profile) {
|
|
@@ -288,42 +282,42 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
288
282
|
}
|
|
289
283
|
async applyProfileTemplate(profileTemplate, profile, options, reportProgress, token) {
|
|
290
284
|
if (profileTemplate.settings && (options.resourceTypeFlags?.settings ?? true) && !profile.useDefaultFlags?.settings) {
|
|
291
|
-
reportProgress((
|
|
285
|
+
reportProgress(( localize(3190, "Creating Settings...")));
|
|
292
286
|
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
293
287
|
}
|
|
294
288
|
if (token.isCancellationRequested) {
|
|
295
289
|
return;
|
|
296
290
|
}
|
|
297
291
|
if (profileTemplate.keybindings && (options.resourceTypeFlags?.keybindings ?? true) && !profile.useDefaultFlags?.keybindings) {
|
|
298
|
-
reportProgress((
|
|
292
|
+
reportProgress(( localize(3191, "Creating Keyboard Shortcuts...")));
|
|
299
293
|
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
300
294
|
}
|
|
301
295
|
if (token.isCancellationRequested) {
|
|
302
296
|
return;
|
|
303
297
|
}
|
|
304
298
|
if (profileTemplate.tasks && (options.resourceTypeFlags?.tasks ?? true) && !profile.useDefaultFlags?.tasks) {
|
|
305
|
-
reportProgress((
|
|
299
|
+
reportProgress(( localize(3192, "Creating Tasks...")));
|
|
306
300
|
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
307
301
|
}
|
|
308
302
|
if (token.isCancellationRequested) {
|
|
309
303
|
return;
|
|
310
304
|
}
|
|
311
305
|
if (profileTemplate.snippets && (options.resourceTypeFlags?.snippets ?? true) && !profile.useDefaultFlags?.snippets) {
|
|
312
|
-
reportProgress((
|
|
306
|
+
reportProgress(( localize(3193, "Creating Snippets...")));
|
|
313
307
|
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
314
308
|
}
|
|
315
309
|
if (token.isCancellationRequested) {
|
|
316
310
|
return;
|
|
317
311
|
}
|
|
318
312
|
if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
|
|
319
|
-
reportProgress((
|
|
313
|
+
reportProgress(( localize(3194, "Applying UI State...")));
|
|
320
314
|
await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
|
|
321
315
|
}
|
|
322
316
|
if (token.isCancellationRequested) {
|
|
323
317
|
return;
|
|
324
318
|
}
|
|
325
319
|
if (profileTemplate.extensions && (options.resourceTypeFlags?.extensions ?? true) && !profile.useDefaultFlags?.extensions) {
|
|
326
|
-
reportProgress((
|
|
320
|
+
reportProgress(( localize(3194, "Installing Extensions...")));
|
|
327
321
|
await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile, reportProgress, token);
|
|
328
322
|
}
|
|
329
323
|
}
|
|
@@ -336,16 +330,16 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
336
330
|
this.telemetryService.publicLog2('userDataProfile.startCreate', createProfileTelemetryData);
|
|
337
331
|
}
|
|
338
332
|
const disposables = ( (new DisposableStore()));
|
|
339
|
-
const title = profile ? (
|
|
340
|
-
const settings = { id: ProfileResourceType.Settings, label: (
|
|
341
|
-
const keybindings = { id: ProfileResourceType.Keybindings, label: (
|
|
342
|
-
const snippets = { id: ProfileResourceType.Snippets, label: (
|
|
343
|
-
const tasks = { id: ProfileResourceType.Tasks, label: (
|
|
344
|
-
const extensions = { id: ProfileResourceType.Extensions, label: (
|
|
333
|
+
const title = profile ? ( localize(3195, "Edit {0} Profile...", profile.name)) : ( localize(3196, "Create New Profile..."));
|
|
334
|
+
const settings = { id: ProfileResourceType.Settings, label: ( localize(3197, "Settings")), picked: !profile?.useDefaultFlags?.settings };
|
|
335
|
+
const keybindings = { id: ProfileResourceType.Keybindings, label: ( localize(3198, "Keyboard Shortcuts")), picked: !profile?.useDefaultFlags?.keybindings };
|
|
336
|
+
const snippets = { id: ProfileResourceType.Snippets, label: ( localize(3199, "Snippets")), picked: !profile?.useDefaultFlags?.snippets };
|
|
337
|
+
const tasks = { id: ProfileResourceType.Tasks, label: ( localize(3200, "Tasks")), picked: !profile?.useDefaultFlags?.tasks };
|
|
338
|
+
const extensions = { id: ProfileResourceType.Extensions, label: ( localize(3201, "Extensions")), picked: !profile?.useDefaultFlags?.extensions };
|
|
345
339
|
const resources = [settings, keybindings, snippets, tasks, extensions];
|
|
346
340
|
const quickPick = this.quickInputService.createQuickPick();
|
|
347
341
|
quickPick.title = title;
|
|
348
|
-
quickPick.placeholder = (
|
|
342
|
+
quickPick.placeholder = ( localize(3202, "Profile name"));
|
|
349
343
|
quickPick.value = profile?.name ?? (isUserDataProfileTemplate(source) ? this.generateProfileName(source.name) : '');
|
|
350
344
|
quickPick.canSelectMany = true;
|
|
351
345
|
quickPick.matchOnDescription = false;
|
|
@@ -357,8 +351,8 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
357
351
|
quickPick.customButton = true;
|
|
358
352
|
quickPick.hideCheckAll = true;
|
|
359
353
|
quickPick.ignoreFocusOut = true;
|
|
360
|
-
quickPick.customLabel = profile ? (
|
|
361
|
-
quickPick.description = (
|
|
354
|
+
quickPick.customLabel = profile ? ( localize(3203, "Save")) : ( localize(3204, "Create"));
|
|
355
|
+
quickPick.description = ( localize(3205, "Choose what to configure in your Profile:"));
|
|
362
356
|
quickPick.items = [...resources];
|
|
363
357
|
const update = () => {
|
|
364
358
|
quickPick.items = resources;
|
|
@@ -367,12 +361,12 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
367
361
|
update();
|
|
368
362
|
const validate = () => {
|
|
369
363
|
if (!profile && ( (this.userDataProfilesService.profiles.some(p => p.name === quickPick.value)))) {
|
|
370
|
-
quickPick.validationMessage = (
|
|
364
|
+
quickPick.validationMessage = ( localize(3206, "Profile with name {0} already exists.", quickPick.value));
|
|
371
365
|
quickPick.severity = Severity$1.Warning;
|
|
372
366
|
return;
|
|
373
367
|
}
|
|
374
368
|
if (resources.every(resource => !resource.picked)) {
|
|
375
|
-
quickPick.validationMessage = (
|
|
369
|
+
quickPick.validationMessage = ( localize(3207, "The profile should contain at least one configuration."));
|
|
376
370
|
quickPick.severity = Severity$1.Warning;
|
|
377
371
|
return;
|
|
378
372
|
}
|
|
@@ -383,7 +377,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
383
377
|
let needUpdate = false;
|
|
384
378
|
for (const resource of resources) {
|
|
385
379
|
resource.picked = items.includes(resource);
|
|
386
|
-
const description = resource.picked ? undefined : (
|
|
380
|
+
const description = resource.picked ? undefined : ( localize(3208, "Using Default Profile"));
|
|
387
381
|
if (resource.description !== description) {
|
|
388
382
|
resource.description = description;
|
|
389
383
|
needUpdate = true;
|
|
@@ -409,7 +403,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
409
403
|
disposables.add(Event.any(quickPick.onDidCustom, quickPick.onDidAccept)(() => {
|
|
410
404
|
const name = quickPick.value.trim();
|
|
411
405
|
if (!name) {
|
|
412
|
-
quickPick.validationMessage = (
|
|
406
|
+
quickPick.validationMessage = ( localize(3209, "Profile name is required and must be a non-empty value."));
|
|
413
407
|
quickPick.severity = Severity$1.Error;
|
|
414
408
|
}
|
|
415
409
|
if (quickPick.validationMessage) {
|
|
@@ -422,11 +416,11 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
422
416
|
}));
|
|
423
417
|
const domNode = $('.profile-edit-widget');
|
|
424
418
|
const profileIconContainer = $('.profile-icon-container');
|
|
425
|
-
append(profileIconContainer, $('.profile-icon-label', undefined, (
|
|
419
|
+
append(profileIconContainer, $('.profile-icon-label', undefined, ( localize(3210, "Icon:"))));
|
|
426
420
|
const profileIconElement = append(profileIconContainer, $(`.profile-icon${ThemeIcon.asCSSSelector(icon)}`));
|
|
427
421
|
profileIconElement.tabIndex = 0;
|
|
428
422
|
profileIconElement.role = 'button';
|
|
429
|
-
profileIconElement.ariaLabel = (
|
|
423
|
+
profileIconElement.ariaLabel = ( localize(3211, "Icon: {0}", icon.id));
|
|
430
424
|
const iconSelectBox = disposables.add(this.instantiationService.createInstance(WorkbenchIconSelectBox, { icons: ICONS, inputBoxStyles: defaultInputBoxStyles }));
|
|
431
425
|
const dimension = new Dimension(486, 260);
|
|
432
426
|
iconSelectBox.layout(dimension);
|
|
@@ -434,7 +428,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
434
428
|
const updateIcon = (updated) => {
|
|
435
429
|
icon = updated ?? DEFAULT_ICON;
|
|
436
430
|
profileIconElement.className = `profile-icon ${ThemeIcon.asClassName(icon)}`;
|
|
437
|
-
profileIconElement.ariaLabel = (
|
|
431
|
+
profileIconElement.ariaLabel = ( localize(3211, "Icon: {0}", icon.id));
|
|
438
432
|
};
|
|
439
433
|
disposables.add(iconSelectBox.onDidSelect(selectedIcon => {
|
|
440
434
|
if (icon.id !== selectedIcon.id) {
|
|
@@ -485,18 +479,18 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
485
479
|
}));
|
|
486
480
|
if (!profile && !isUserDataProfileTemplate(source)) {
|
|
487
481
|
const profileTypeContainer = append(domNode, $('.profile-type-container'));
|
|
488
|
-
append(profileTypeContainer, $('.profile-type-create-label', undefined, (
|
|
482
|
+
append(profileTypeContainer, $('.profile-type-create-label', undefined, ( localize(3212, "Copy from:"))));
|
|
489
483
|
const separator = { text: '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500', isDisabled: true };
|
|
490
484
|
const profileOptions = [];
|
|
491
|
-
profileOptions.push({ text: (
|
|
485
|
+
profileOptions.push({ text: ( localize(3213, "None")) });
|
|
492
486
|
const templates = await this.userDataProfileManagementService.getBuiltinProfileTemplates();
|
|
493
487
|
if (templates.length) {
|
|
494
|
-
profileOptions.push({ ...separator, decoratorRight: (
|
|
488
|
+
profileOptions.push({ ...separator, decoratorRight: ( localize(3214, "Profile Templates")) });
|
|
495
489
|
for (const template of templates) {
|
|
496
490
|
profileOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
|
|
497
491
|
}
|
|
498
492
|
}
|
|
499
|
-
profileOptions.push({ ...separator, decoratorRight: (
|
|
493
|
+
profileOptions.push({ ...separator, decoratorRight: ( localize(3215, "Existing Profiles")) });
|
|
500
494
|
for (const profile of this.userDataProfilesService.profiles) {
|
|
501
495
|
profileOptions.push({ text: profile.name, id: profile.id, source: profile });
|
|
502
496
|
}
|
|
@@ -515,7 +509,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
515
509
|
const initialIndex = findOptionIndex();
|
|
516
510
|
const selectBox = disposables.add(this.instantiationService.createInstance(SelectBox, profileOptions, initialIndex, this.contextViewService, defaultSelectBoxStyles, {
|
|
517
511
|
useCustomDrawn: true,
|
|
518
|
-
ariaLabel: (
|
|
512
|
+
ariaLabel: ( localize(3216, "Copy profile from")),
|
|
519
513
|
}));
|
|
520
514
|
selectBox.render(append(profileTypeContainer, $('.profile-type-select-container')));
|
|
521
515
|
if (profileOptions[initialIndex].source) {
|
|
@@ -578,7 +572,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
578
572
|
else if (isUserDataProfileTemplate(source)) {
|
|
579
573
|
source.name = result.name;
|
|
580
574
|
this.telemetryService.publicLog2('userDataProfile.createFromExternalTemplate', createProfileTelemetryData);
|
|
581
|
-
await this.createAndSwitch(source, false, true, { useDefaultFlags, icon: result.icon ? result.icon : undefined }, (
|
|
575
|
+
await this.createAndSwitch(source, false, true, { useDefaultFlags, icon: result.icon ? result.icon : undefined }, ( localize(3216, "Create Profile")));
|
|
582
576
|
}
|
|
583
577
|
else {
|
|
584
578
|
this.telemetryService.publicLog2('userDataProfile.createEmptyProfile', createProfileTelemetryData);
|
|
@@ -600,7 +594,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
600
594
|
try {
|
|
601
595
|
const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, this.userDataProfileService.currentProfile, undefined));
|
|
602
596
|
const barrier = ( (new Barrier()));
|
|
603
|
-
const exportAction = ( (new BarrierAction(barrier, (new Action('export', (
|
|
597
|
+
const exportAction = ( (new BarrierAction(barrier, (new Action('export', ( localize(3217, "Export")), undefined, true, async () => {
|
|
604
598
|
exportAction.enabled = false;
|
|
605
599
|
try {
|
|
606
600
|
await this.doExportProfile(userDataProfilesExportState, EXPORT_PROFILE_PREVIEW_VIEW);
|
|
@@ -611,7 +605,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
611
605
|
throw error;
|
|
612
606
|
}
|
|
613
607
|
})), this.notificationService)));
|
|
614
|
-
const closeAction = ( (new BarrierAction(barrier, (new Action('close', (
|
|
608
|
+
const closeAction = ( (new BarrierAction(barrier, (new Action('close', ( localize(3218, "Close")))), this.notificationService)));
|
|
615
609
|
await this.showProfilePreviewView(EXPORT_PROFILE_PREVIEW_VIEW, userDataProfilesExportState.profile.name, exportAction, closeAction, true, userDataProfilesExportState);
|
|
616
610
|
disposables.add(this.userDataProfileService.onDidChangeCurrentProfile(e => barrier.open()));
|
|
617
611
|
await barrier.wait();
|
|
@@ -640,14 +634,14 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
640
634
|
delay: 500,
|
|
641
635
|
sticky: true,
|
|
642
636
|
}, async (progress) => {
|
|
643
|
-
const reportProgress = (message) => progress.report({ message: (
|
|
637
|
+
const reportProgress = (message) => progress.report({ message: ( localize(3218, "Create Profile: {0}", message)) });
|
|
644
638
|
const createdProfile = await this.doCreateProfile(profileTemplate, false, false, { useDefaultFlags: options?.useDefaultFlags, icon: options?.icon, transient: options?.transient }, reportProgress);
|
|
645
639
|
if (createdProfile) {
|
|
646
640
|
if (options?.resourceTypeFlags?.extensions ?? true) {
|
|
647
|
-
reportProgress((
|
|
641
|
+
reportProgress(( localize(3219, "Applying Extensions...")));
|
|
648
642
|
await this.instantiationService.createInstance(ExtensionsResource).copy(profile, createdProfile, false);
|
|
649
643
|
}
|
|
650
|
-
reportProgress((
|
|
644
|
+
reportProgress(( localize(3220, "Switching Profile...")));
|
|
651
645
|
await this.userDataProfileManagementService.switchProfile(createdProfile);
|
|
652
646
|
}
|
|
653
647
|
});
|
|
@@ -659,18 +653,18 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
659
653
|
async createTroubleshootProfile() {
|
|
660
654
|
const userDataProfilesExportState = this.instantiationService.createInstance(UserDataProfileExportState, this.userDataProfileService.currentProfile, undefined);
|
|
661
655
|
try {
|
|
662
|
-
const profileTemplate = await userDataProfilesExportState.getProfileTemplate((
|
|
656
|
+
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(3221, "Troubleshoot Issue")), undefined);
|
|
663
657
|
await this.progressService.withProgress({
|
|
664
658
|
location: ProgressLocation.Notification,
|
|
665
659
|
delay: 1000,
|
|
666
660
|
sticky: true,
|
|
667
661
|
}, async (progress) => {
|
|
668
|
-
const reportProgress = (message) => progress.report({ message: (
|
|
662
|
+
const reportProgress = (message) => progress.report({ message: ( localize(3222, "Setting up Troubleshoot Profile: {0}", message)) });
|
|
669
663
|
const profile = await this.doCreateProfile(profileTemplate, true, false, { useDefaultFlags: this.userDataProfileService.currentProfile.useDefaultFlags }, reportProgress);
|
|
670
664
|
if (profile) {
|
|
671
|
-
reportProgress((
|
|
665
|
+
reportProgress(( localize(3222, "Applying Extensions...")));
|
|
672
666
|
await this.instantiationService.createInstance(ExtensionsResource).copy(this.userDataProfileService.currentProfile, profile, true);
|
|
673
|
-
reportProgress((
|
|
667
|
+
reportProgress(( localize(3222, "Switching Profile...")));
|
|
674
668
|
await this.userDataProfileManagementService.switchProfile(profile);
|
|
675
669
|
}
|
|
676
670
|
});
|
|
@@ -690,7 +684,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
690
684
|
try {
|
|
691
685
|
await this.progressService.withProgress({
|
|
692
686
|
location,
|
|
693
|
-
title: (
|
|
687
|
+
title: ( localize(3223, "{0}: Exporting...", PROFILES_CATEGORY.value)),
|
|
694
688
|
}, async (progress) => {
|
|
695
689
|
const id = await this.pickProfileContentHandler(profile.name);
|
|
696
690
|
if (!id) {
|
|
@@ -704,17 +698,17 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
704
698
|
if (!saveResult) {
|
|
705
699
|
return;
|
|
706
700
|
}
|
|
707
|
-
const message = (
|
|
701
|
+
const message = ( localize(3224, "Profile '{0}' was exported successfully.", profile.name));
|
|
708
702
|
if (profileContentHandler.extensionId) {
|
|
709
703
|
const buttons = [];
|
|
710
704
|
const link = this.productService.webUrl ? `${this.productService.webUrl}/${PROFILE_URL_AUTHORITY}/${id}/${saveResult.id}` : ( (toUserDataProfileUri(`/${id}/${saveResult.id}`, this.productService).toString()));
|
|
711
705
|
buttons.push({
|
|
712
|
-
label: (
|
|
706
|
+
label: ( localize(3225, "&&Copy Link")),
|
|
713
707
|
run: () => this.clipboardService.writeText(link)
|
|
714
708
|
});
|
|
715
709
|
if (this.productService.webUrl) {
|
|
716
710
|
buttons.push({
|
|
717
|
-
label: (
|
|
711
|
+
label: ( localize(3226, "&&Open Link")),
|
|
718
712
|
run: async () => {
|
|
719
713
|
await this.openerService.open(link);
|
|
720
714
|
}
|
|
@@ -722,7 +716,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
722
716
|
}
|
|
723
717
|
else {
|
|
724
718
|
buttons.push({
|
|
725
|
-
label: (
|
|
719
|
+
label: ( localize(3227, "&&Open in {0}", profileContentHandler.name)),
|
|
726
720
|
run: async () => {
|
|
727
721
|
await this.openerService.open(( (saveResult.link.toString())));
|
|
728
722
|
}
|
|
@@ -732,7 +726,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
732
726
|
type: Severity$1.Info,
|
|
733
727
|
message,
|
|
734
728
|
buttons,
|
|
735
|
-
cancelButton: (
|
|
729
|
+
cancelButton: ( localize(3227, "Close"))
|
|
736
730
|
});
|
|
737
731
|
}
|
|
738
732
|
else {
|
|
@@ -749,9 +743,15 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
749
743
|
if (profileContent === null) {
|
|
750
744
|
return null;
|
|
751
745
|
}
|
|
752
|
-
|
|
746
|
+
let profileTemplate;
|
|
747
|
+
try {
|
|
748
|
+
profileTemplate = JSON.parse(profileContent);
|
|
749
|
+
}
|
|
750
|
+
catch (error) {
|
|
751
|
+
throw ( (new Error(localize(3228, "This profile is not valid."))));
|
|
752
|
+
}
|
|
753
753
|
if (!isUserDataProfileTemplate(profileTemplate)) {
|
|
754
|
-
throw ( (new Error(
|
|
754
|
+
throw ( (new Error(localize(3228, "This profile is not valid."))));
|
|
755
755
|
}
|
|
756
756
|
if (options?.name) {
|
|
757
757
|
profileTemplate.name = options.name;
|
|
@@ -784,33 +784,32 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
784
784
|
try {
|
|
785
785
|
const userDataProfileImportState = disposables.add(this.instantiationService.createInstance(UserDataProfileImportState, profileTemplate));
|
|
786
786
|
profileTemplate = await userDataProfileImportState.getProfileTemplateToImport();
|
|
787
|
-
const importedProfile = await this.createAndSwitch(profileTemplate, true, false, options, (
|
|
787
|
+
const importedProfile = await this.createAndSwitch(profileTemplate, true, false, options, ( localize(3228, "Preview Profile")));
|
|
788
788
|
if (!importedProfile) {
|
|
789
789
|
return;
|
|
790
790
|
}
|
|
791
791
|
const barrier = ( (new Barrier()));
|
|
792
792
|
const importAction = this.getCreateAction(barrier, userDataProfileImportState);
|
|
793
793
|
const primaryAction = isWeb
|
|
794
|
-
? ( (new Action('importInDesktop', (
|
|
794
|
+
? ( (new Action('importInDesktop', ( localize(3229, "Create Profile in {0}", this.productService.nameLong)), undefined, true, async () => this.openerService.open(uri, { openExternal: true }))))
|
|
795
795
|
: importAction;
|
|
796
796
|
const secondaryAction = isWeb
|
|
797
797
|
? importAction
|
|
798
|
-
: ( (new BarrierAction(barrier, (new Action('close', (
|
|
798
|
+
: ( (new BarrierAction(barrier, (new Action('close', ( localize(3229, "Close")))), this.notificationService)));
|
|
799
799
|
const view = await this.showProfilePreviewView(IMPORT_PROFILE_PREVIEW_VIEW, importedProfile.name, primaryAction, secondaryAction, false, userDataProfileImportState);
|
|
800
800
|
const message = ( (new MarkdownString()));
|
|
801
|
-
message.appendMarkdown((
|
|
802
|
-
|
|
803
|
-
46,
|
|
801
|
+
message.appendMarkdown(( localize(
|
|
802
|
+
3230,
|
|
804
803
|
"By default, extensions aren't installed when previewing a profile on the web. You can still install them manually before importing the profile. "
|
|
805
804
|
)));
|
|
806
|
-
message.appendMarkdown(`[${(
|
|
805
|
+
message.appendMarkdown(`[${( localize(3231, "Learn more"))}](https://aka.ms/vscode-extension-marketplace#_can-i-trust-extensions-from-the-marketplace).`);
|
|
807
806
|
view.setMessage(message);
|
|
808
807
|
const that = this;
|
|
809
808
|
const disposable = disposables.add(registerAction2(class extends Action2 {
|
|
810
809
|
constructor() {
|
|
811
810
|
super({
|
|
812
811
|
id: 'previewProfile.installExtensions',
|
|
813
|
-
title: (
|
|
812
|
+
title: ( localize(3232, "Install Extensions")),
|
|
814
813
|
icon: Codicon.cloudDownload,
|
|
815
814
|
menu: {
|
|
816
815
|
id: MenuId.ViewItemContext,
|
|
@@ -857,11 +856,11 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
857
856
|
try {
|
|
858
857
|
const userDataProfileImportState = disposables.add(this.instantiationService.createInstance(UserDataProfileImportState, profileTemplate));
|
|
859
858
|
if (userDataProfileImportState.isEmpty()) {
|
|
860
|
-
await this.createAndSwitch(profileTemplate, false, true, options, (
|
|
859
|
+
await this.createAndSwitch(profileTemplate, false, true, options, ( localize(3232, "Create Profile")));
|
|
861
860
|
}
|
|
862
861
|
else {
|
|
863
862
|
const barrier = ( (new Barrier()));
|
|
864
|
-
const cancelAction = ( (new BarrierAction(barrier, (new Action('cancel', (
|
|
863
|
+
const cancelAction = ( (new BarrierAction(barrier, (new Action('cancel', ( localize(3233, "Cancel")))), this.notificationService)));
|
|
865
864
|
const importAction = this.getCreateAction(barrier, userDataProfileImportState, cancelAction);
|
|
866
865
|
await this.showProfilePreviewView(IMPORT_PROFILE_PREVIEW_VIEW, profileTemplate.name, importAction, cancelAction, false, userDataProfileImportState);
|
|
867
866
|
await barrier.wait();
|
|
@@ -873,7 +872,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
873
872
|
}
|
|
874
873
|
}
|
|
875
874
|
getCreateAction(barrier, userDataProfileImportState, cancelAction) {
|
|
876
|
-
const importAction = ( (new BarrierAction(barrier, (new Action('title', (
|
|
875
|
+
const importAction = ( (new BarrierAction(barrier, (new Action('title', ( localize(3234, "Create Profile")), undefined, true, async () => {
|
|
877
876
|
importAction.enabled = false;
|
|
878
877
|
if (cancelAction) {
|
|
879
878
|
cancelAction.enabled = false;
|
|
@@ -894,7 +893,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
894
893
|
const reportProgress = (message) => progress.report({ message: `${title}: ${message}` });
|
|
895
894
|
const profile = await this.doCreateProfile(profileTemplate, temporaryProfile, extensions, options, reportProgress);
|
|
896
895
|
if (profile) {
|
|
897
|
-
reportProgress((
|
|
896
|
+
reportProgress(( localize(3234, "Switching Profile...")));
|
|
898
897
|
await this.userDataProfileManagementService.switchProfile(profile);
|
|
899
898
|
}
|
|
900
899
|
return profile;
|
|
@@ -906,27 +905,27 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
906
905
|
return undefined;
|
|
907
906
|
}
|
|
908
907
|
if (profileTemplate.settings && !profile.useDefaultFlags?.settings) {
|
|
909
|
-
progress((
|
|
908
|
+
progress(( localize(3235, "Applying Settings...")));
|
|
910
909
|
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
911
910
|
}
|
|
912
911
|
if (profileTemplate.keybindings && !profile.useDefaultFlags?.keybindings) {
|
|
913
|
-
progress((
|
|
912
|
+
progress(( localize(3236, "Applying Keyboard Shortcuts...")));
|
|
914
913
|
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
915
914
|
}
|
|
916
915
|
if (profileTemplate.tasks && !profile.useDefaultFlags?.tasks) {
|
|
917
|
-
progress((
|
|
916
|
+
progress(( localize(3237, "Applying Tasks...")));
|
|
918
917
|
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
919
918
|
}
|
|
920
919
|
if (profileTemplate.snippets && !profile.useDefaultFlags?.snippets) {
|
|
921
|
-
progress((
|
|
920
|
+
progress(( localize(3238, "Applying Snippets...")));
|
|
922
921
|
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
923
922
|
}
|
|
924
923
|
if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
|
|
925
|
-
progress((
|
|
924
|
+
progress(( localize(3239, "Applying State...")));
|
|
926
925
|
await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
|
|
927
926
|
}
|
|
928
927
|
if (profileTemplate.extensions && extensions && !profile.useDefaultFlags?.extensions) {
|
|
929
|
-
progress((
|
|
928
|
+
progress(( localize(3239, "Applying Extensions...")));
|
|
930
929
|
await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile);
|
|
931
930
|
}
|
|
932
931
|
return profile;
|
|
@@ -979,7 +978,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
979
978
|
options.push({ id, label: profileContentHandler.name, description: profileContentHandler.description });
|
|
980
979
|
}
|
|
981
980
|
const result = await this.quickInputService.pick(options.reverse(), {
|
|
982
|
-
title: (
|
|
981
|
+
title: ( localize(3240, "Export '{0}' profile as...", name)),
|
|
983
982
|
hideInput: true
|
|
984
983
|
});
|
|
985
984
|
return result?.id;
|
|
@@ -991,55 +990,19 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
991
990
|
if (temp) {
|
|
992
991
|
return this.userDataProfilesService.createNamedProfile(`${profileName} ${this.getProfileNameIndex(profileName)}`, { ...options, transient: temp });
|
|
993
992
|
}
|
|
994
|
-
|
|
995
|
-
( ((function(ImportProfileChoice) {
|
|
996
|
-
ImportProfileChoice[ImportProfileChoice["Overwrite"] = 0] = "Overwrite";
|
|
997
|
-
ImportProfileChoice[ImportProfileChoice["CreateNew"] = 1] = "CreateNew";
|
|
998
|
-
ImportProfileChoice[ImportProfileChoice["Cancel"] = 2] = "Cancel";
|
|
999
|
-
})(ImportProfileChoice || (ImportProfileChoice = {}))));
|
|
1000
|
-
const { result } = await this.dialogService.prompt({
|
|
993
|
+
const { confirmed } = await this.dialogService.confirm({
|
|
1001
994
|
type: Severity$1.Info,
|
|
1002
|
-
message: (
|
|
1003
|
-
|
|
1004
|
-
|
|
1005
|
-
"Profile with name '{0}' already exists. Do you want to overwrite it?",
|
|
995
|
+
message: ( localize(
|
|
996
|
+
3241,
|
|
997
|
+
"Profile with name '{0}' already exists. Do you want to replace its contents?",
|
|
1006
998
|
profileName
|
|
1007
999
|
)),
|
|
1008
|
-
|
|
1009
|
-
{
|
|
1010
|
-
label: ( localizeWithPath(_moduleId, 58, "&&Overwrite")),
|
|
1011
|
-
run: () => ImportProfileChoice.Overwrite
|
|
1012
|
-
},
|
|
1013
|
-
{
|
|
1014
|
-
label: ( localizeWithPath(_moduleId, 59, "&&Create New Profile")),
|
|
1015
|
-
run: () => ImportProfileChoice.CreateNew
|
|
1016
|
-
},
|
|
1017
|
-
],
|
|
1018
|
-
cancelButton: {
|
|
1019
|
-
run: () => ImportProfileChoice.Cancel
|
|
1020
|
-
}
|
|
1000
|
+
primaryButton: ( localize(3242, "&&Replace"))
|
|
1021
1001
|
});
|
|
1022
|
-
if (
|
|
1023
|
-
return profile;
|
|
1024
|
-
}
|
|
1025
|
-
if (result === ImportProfileChoice.Cancel) {
|
|
1026
|
-
return undefined;
|
|
1027
|
-
}
|
|
1028
|
-
const name = await this.quickInputService.input({
|
|
1029
|
-
placeHolder: ( localizeWithPath(_moduleId, 60, "Profile name")),
|
|
1030
|
-
title: ( localizeWithPath(_moduleId, 61, "Create New Profile")),
|
|
1031
|
-
value: `${profileName} ${this.getProfileNameIndex(profileName)}`,
|
|
1032
|
-
validateInput: async (value) => {
|
|
1033
|
-
if (( (this.userDataProfilesService.profiles.some(p => p.name === value)))) {
|
|
1034
|
-
return ( localizeWithPath(_moduleId, 23, "Profile with name {0} already exists.", value));
|
|
1035
|
-
}
|
|
1036
|
-
return undefined;
|
|
1037
|
-
}
|
|
1038
|
-
});
|
|
1039
|
-
if (!name) {
|
|
1002
|
+
if (!confirmed) {
|
|
1040
1003
|
return undefined;
|
|
1041
1004
|
}
|
|
1042
|
-
return this.userDataProfilesService.
|
|
1005
|
+
return profile.isDefault ? profile : this.userDataProfilesService.updateProfile(profile, options);
|
|
1043
1006
|
}
|
|
1044
1007
|
else {
|
|
1045
1008
|
return this.userDataProfilesService.createNamedProfile(profileName, { ...options, transient: temp });
|
|
@@ -1128,12 +1091,12 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
|
|
|
1128
1091
|
this.uriIdentityService = uriIdentityService;
|
|
1129
1092
|
this.fileService = fileService;
|
|
1130
1093
|
this.textFileService = textFileService;
|
|
1131
|
-
this.name = (
|
|
1132
|
-
this.description = (
|
|
1094
|
+
this.name = ( localize(3243, "Local"));
|
|
1095
|
+
this.description = ( localize(3244, "file"));
|
|
1133
1096
|
}
|
|
1134
1097
|
async saveProfile(name, content, token) {
|
|
1135
1098
|
const link = await this.fileDialogService.showSaveDialog({
|
|
1136
|
-
title: (
|
|
1099
|
+
title: ( localize(3245, "Save Profile")),
|
|
1137
1100
|
filters: PROFILE_FILTER,
|
|
1138
1101
|
defaultUri: this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(), `${name}.${PROFILE_EXTENSION}`),
|
|
1139
1102
|
});
|
|
@@ -1160,7 +1123,7 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
|
|
|
1160
1123
|
canSelectFiles: true,
|
|
1161
1124
|
canSelectMany: false,
|
|
1162
1125
|
filters: PROFILE_FILTER,
|
|
1163
|
-
title: (
|
|
1126
|
+
title: ( localize(3246, "Select Profile")),
|
|
1164
1127
|
});
|
|
1165
1128
|
return profileLocation ? profileLocation[0] : null;
|
|
1166
1129
|
}
|
|
@@ -1317,13 +1280,13 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
1317
1280
|
for (const root of this.roots) {
|
|
1318
1281
|
root.checkbox = {
|
|
1319
1282
|
isChecked: !root.isFromDefaultProfile(),
|
|
1320
|
-
tooltip: (
|
|
1283
|
+
tooltip: ( localize(3247, "Select {0}", root.label.label)),
|
|
1321
1284
|
accessibilityInformation: {
|
|
1322
|
-
label: (
|
|
1285
|
+
label: ( localize(3247, "Select {0}", root.label.label)),
|
|
1323
1286
|
}
|
|
1324
1287
|
};
|
|
1325
1288
|
if (root.isFromDefaultProfile()) {
|
|
1326
|
-
root.description = (
|
|
1289
|
+
root.description = ( localize(3248, "From Default Profile"));
|
|
1327
1290
|
}
|
|
1328
1291
|
}
|
|
1329
1292
|
return this.roots;
|
|
@@ -1486,11 +1449,11 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
1486
1449
|
let name = this.profile.name;
|
|
1487
1450
|
if (this.profile.isDefault) {
|
|
1488
1451
|
name = await this.quickInputService.input({
|
|
1489
|
-
placeHolder: (
|
|
1490
|
-
title: (
|
|
1452
|
+
placeHolder: ( localize(3249, "Name the profile")),
|
|
1453
|
+
title: ( localize(3250, "Export Profile")),
|
|
1491
1454
|
async validateInput(input) {
|
|
1492
1455
|
if (!input.trim()) {
|
|
1493
|
-
return (
|
|
1456
|
+
return ( localize(3251, "Profile name must be provided."));
|
|
1494
1457
|
}
|
|
1495
1458
|
return undefined;
|
|
1496
1459
|
},
|