@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.
Files changed (19) hide show
  1. package/package.json +2 -2
  2. package/vscode/src/vs/base/browser/ui/radio/radio.css.js +6 -0
  3. package/vscode/src/vs/base/browser/ui/radio/radio.js +69 -0
  4. package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +5 -8
  5. package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +28 -11
  6. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
  7. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +96 -60
  8. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +13 -15
  9. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +744 -349
  10. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +114 -70
  11. package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +7 -9
  12. package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +2 -3
  13. package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +2 -3
  14. package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +2 -3
  15. package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +4 -6
  16. package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +2 -3
  17. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +93 -130
  18. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +12 -16
  19. package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +2 -2
@@ -1,10 +1,10 @@
1
1
  import { __decorate, __param } from 'vscode/external/tslib/tslib.es6.js';
2
2
  import './media/userDataProfilesEditor.css.js';
3
- import { append, $, Dimension, trackFocus, addDisposableListener, EventType, EventHelper } from 'vscode/vscode/vs/base/browser/dom';
3
+ import { append, $, Dimension, trackFocus, addDisposableListener, EventType, EventHelper, clearNode } from 'vscode/vscode/vs/base/browser/dom';
4
4
  import { SubmenuAction, Separator, Action } from 'vscode/vscode/vs/base/common/actions';
5
- import { Event } from 'vscode/vscode/vs/base/common/event';
5
+ import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
6
6
  import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
7
- import { localizeWithPath } from 'vscode/vscode/vs/nls';
7
+ import { localize } from 'vscode/vscode/vs/nls';
8
8
  import { IContextMenuService, IContextViewService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
9
9
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
10
10
  import { IStorageService } from 'vscode/vscode/vs/platform/storage/common/storage.service';
@@ -15,14 +15,13 @@ import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProf
15
15
  import { EditorPane } from 'vscode/vscode/vs/workbench/browser/parts/editor/editorPane';
16
16
  import { EditorInput } from 'vscode/vscode/vs/workbench/common/editor/editorInput';
17
17
  import { PROFILE_FILTER, defaultUserDataProfileIcon } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
18
- import { IUserDataProfileManagementService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
19
18
  import { SplitView, Sizing } from 'vscode/vscode/vs/base/browser/ui/splitview/splitview';
20
19
  import { ButtonWithDropdown, Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
21
- import { defaultButtonStyles, defaultInputBoxStyles, defaultSelectBoxStyles, defaultCheckboxStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
20
+ import { getListStyles, defaultButtonStyles, getInputBoxStyle, defaultInputBoxStyles, defaultCheckboxStyles, defaultSelectBoxStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
22
21
  import { registerColor } from 'vscode/vscode/vs/platform/theme/common/colorUtils';
23
- import 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
22
+ import { foreground } from 'vscode/vscode/vs/platform/theme/common/colors/baseColors';
24
23
  import 'vscode/vscode/vs/platform/theme/common/colors/chartsColors';
25
- import 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
24
+ import { editorBackground } from 'vscode/vscode/vs/platform/theme/common/colors/editorColors';
26
25
  import 'vscode/vscode/vs/platform/theme/common/colors/inputColors';
27
26
  import 'vscode/vscode/vs/platform/theme/common/colors/listColors';
28
27
  import 'vscode/vscode/vs/platform/theme/common/colors/menuColors';
@@ -32,7 +31,8 @@ import 'vscode/vscode/vs/platform/theme/common/colors/quickpickColors';
32
31
  import 'vscode/vscode/vs/platform/theme/common/colors/searchColors';
33
32
  import { PANEL_BORDER } from 'vscode/vscode/vs/workbench/common/theme';
34
33
  import { WorkbenchList, WorkbenchAsyncDataTree } from 'vscode/vscode/vs/platform/list/browser/listService';
35
- import { DisposableStore, Disposable, MutableDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
34
+ import { CachedListVirtualDelegate } from 'vscode/vscode/vs/base/browser/ui/list/list';
35
+ import { DisposableStore, Disposable, MutableDisposable, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
36
36
  import { InputBox, MessageType } from 'vscode/vscode/vs/base/browser/ui/inputbox/inputBox';
37
37
  import { Checkbox } from 'vscode/vscode/vs/base/browser/ui/toggle/toggle';
38
38
  import { DEFAULT_ICON, ICONS } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfileIcons';
@@ -45,32 +45,52 @@ import { HoverPosition } from 'vscode/vscode/vs/base/browser/ui/hover/hoverWidge
45
45
  import { SelectBox } from 'vscode/vscode/vs/base/browser/ui/selectBox/selectBox';
46
46
  import { URI } from 'vscode/vscode/vs/base/common/uri';
47
47
  import { IEditorProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
48
- import { isUndefined } from 'vscode/vscode/vs/base/common/types';
48
+ import { isUndefined, isString } from 'vscode/vscode/vs/base/common/types';
49
49
  import { basename } from 'vscode/vscode/vs/base/common/resources';
50
50
  import { RenderIndentGuides } from 'vscode/vscode/vs/base/browser/ui/tree/abstractTree';
51
51
  import { ResourceLabels, DEFAULT_LABELS_CONTAINER } from 'vscode/vscode/vs/workbench/browser/labels';
52
52
  import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
53
53
  import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
54
54
  import { UserDataProfileElement, AbstractUserDataProfileElement, NewProfileElement, isProfileResourceTypeElement, isProfileResourceChildElement, UserDataProfilesEditorModel } from './userDataProfilesEditorModel.js';
55
- import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
56
55
  import { WorkbenchToolBar } from 'vscode/vscode/vs/platform/actions/browser/toolbar';
57
56
  import { createInstantHoverDelegate } from 'vscode/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
57
+ import { Codicon } from 'vscode/vscode/vs/base/common/codicons';
58
+ import { Radio } from '../../../../base/browser/ui/radio/radio.js';
59
+ import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
60
+ import { settingsTextInputBorder } from 'vscode/vscode/vs/workbench/contrib/preferences/common/settingsEditorColorRegistry';
61
+ import { renderMarkdown } from 'vscode/vscode/vs/base/browser/markdownRenderer';
62
+ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
58
63
  import { Orientation } from 'vscode/vscode/vs/base/browser/ui/sash/sash';
59
64
 
60
65
  var UserDataProfilesEditor_1, ExistingProfileResourceTreeRenderer_1, NewProfileResourceTreeRenderer_1, ProfileResourceChildTreeItemRenderer_1, UserDataProfilesEditorInput_1;
61
- const _moduleId = "vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor";
62
- const profilesSashBorder = registerColor('profiles.sashBorder', PANEL_BORDER, ( localizeWithPath(_moduleId, 0, "The color of the Profiles editor splitview sash border.")));
66
+ const profilesSashBorder = registerColor('profiles.sashBorder', PANEL_BORDER, ( localize(10908, "The color of the Profiles editor splitview sash border.")));
67
+ const listStyles = getListStyles({
68
+ listActiveSelectionBackground: editorBackground,
69
+ listActiveSelectionForeground: foreground,
70
+ listFocusAndSelectionBackground: editorBackground,
71
+ listFocusAndSelectionForeground: foreground,
72
+ listFocusBackground: editorBackground,
73
+ listFocusForeground: foreground,
74
+ listHoverForeground: foreground,
75
+ listHoverBackground: editorBackground,
76
+ listHoverOutline: editorBackground,
77
+ listFocusOutline: editorBackground,
78
+ listInactiveSelectionBackground: editorBackground,
79
+ listInactiveSelectionForeground: foreground,
80
+ listInactiveFocusBackground: editorBackground,
81
+ listInactiveFocusOutline: editorBackground,
82
+ treeIndentGuidesStroke: undefined,
83
+ treeInactiveIndentGuidesStroke: undefined,
84
+ });
63
85
  let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
64
86
  static { UserDataProfilesEditor_1 = this; }
65
87
  static { this.ID = 'workbench.editor.userDataProfiles'; }
66
- constructor(group, telemetryService, themeService, storageService, userDataProfileManagementService, quickInputService, fileDialogService, contextMenuService, instantiationService) {
88
+ constructor(group, telemetryService, themeService, storageService, quickInputService, fileDialogService, contextMenuService, instantiationService) {
67
89
  super(UserDataProfilesEditor_1.ID, group, telemetryService, themeService, storageService);
68
- this.userDataProfileManagementService = userDataProfileManagementService;
69
90
  this.quickInputService = quickInputService;
70
91
  this.fileDialogService = fileDialogService;
71
92
  this.contextMenuService = contextMenuService;
72
93
  this.instantiationService = instantiationService;
73
- this.templates = [];
74
94
  }
75
95
  layout(dimension, position) {
76
96
  if (this.container && this.splitView) {
@@ -119,10 +139,6 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
119
139
  }, Sizing.Distribute, undefined, true);
120
140
  this.registerListeners();
121
141
  this.updateStyles();
122
- this.userDataProfileManagementService.getBuiltinProfileTemplates().then(templates => {
123
- this.templates = templates;
124
- this.profileWidget.templates = templates;
125
- });
126
142
  }
127
143
  updateStyles() {
128
144
  const borderColor = this.theme.getColor(profilesSashBorder);
@@ -141,7 +157,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
141
157
  return profileElement?.name ?? '';
142
158
  },
143
159
  getWidgetAriaLabel() {
144
- return ( localizeWithPath(_moduleId, 1, "Profiles"));
160
+ return ( localize(10909, "Profiles"));
145
161
  }
146
162
  },
147
163
  openOnSingleClick: true,
@@ -152,7 +168,8 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
152
168
  }
153
169
  return e.name;
154
170
  }
155
- }
171
+ },
172
+ alwaysConsumeMouseWheel: false,
156
173
  }));
157
174
  }
158
175
  renderNewProfileButton(parent) {
@@ -160,11 +177,11 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
160
177
  actions: {
161
178
  getActions: () => {
162
179
  const actions = [];
163
- if (this.templates.length) {
164
- actions.push(( (new SubmenuAction('from.template', ( localizeWithPath(_moduleId, 2, "From Template")), this.getCreateFromTemplateActions()))));
180
+ if (this.model?.templates.length) {
181
+ actions.push(( (new SubmenuAction('from.template', ( localize(10910, "From Template")), this.getCreateFromTemplateActions()))));
165
182
  actions.push(( (new Separator())));
166
183
  }
167
- actions.push(( (new Action('importProfile', ( localizeWithPath(_moduleId, 3, "Import Profile...")), undefined, true, () => this.importProfile()))));
184
+ actions.push(( (new Action('importProfile', ( localize(10911, "Import Profile...")), undefined, true, () => this.importProfile()))));
168
185
  return actions;
169
186
  }
170
187
  },
@@ -173,17 +190,19 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
173
190
  supportIcons: true,
174
191
  ...defaultButtonStyles
175
192
  }))));
176
- button.label = ( localizeWithPath(_moduleId, 4, "New Profile"));
193
+ button.label = ( localize(10912, "New Profile"));
177
194
  this._register(button.onDidClick(e => this.createNewProfile()));
178
195
  }
179
196
  getCreateFromTemplateActions() {
180
- return (
181
- (this.templates.map(
182
- template => ( (new Action(`template:${template.url}`, template.name, undefined, true, async () => {
183
- this.createNewProfile(( (URI.parse(template.url))));
184
- })))
185
- ))
186
- );
197
+ return this.model
198
+ ? ( (this.model.templates.map(template => ( (new Action(
199
+ `template:${template.url}`,
200
+ template.name,
201
+ undefined,
202
+ true,
203
+ () => this.createNewProfile(( (URI.parse(template.url))))
204
+ ))))))
205
+ : [];
187
206
  }
188
207
  registerListeners() {
189
208
  if (this.profilesList) {
@@ -218,13 +237,13 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
218
237
  }
219
238
  getTreeContextMenuActions() {
220
239
  const actions = [];
221
- actions.push(( (new Action('newProfile', ( localizeWithPath(_moduleId, 4, "New Profile")), undefined, true, () => this.createNewProfile()))));
240
+ actions.push(( (new Action('newProfile', ( localize(10912, "New Profile")), undefined, true, () => this.createNewProfile()))));
222
241
  const templateActions = this.getCreateFromTemplateActions();
223
242
  if (templateActions.length) {
224
- actions.push(( (new SubmenuAction('from.template', ( localizeWithPath(_moduleId, 5, "New Profile From Template")), templateActions))));
243
+ actions.push(( (new SubmenuAction('from.template', ( localize(10913, "New Profile From Template")), templateActions))));
225
244
  }
226
245
  actions.push(( (new Separator())));
227
- actions.push(( (new Action('importProfile', ( localizeWithPath(_moduleId, 3, "Import Profile...")), undefined, true, () => this.importProfile()))));
246
+ actions.push(( (new Action('importProfile', ( localize(10913, "Import Profile...")), undefined, true, () => this.importProfile()))));
228
247
  return actions;
229
248
  }
230
249
  async importProfile() {
@@ -233,13 +252,13 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
233
252
  const updateQuickPickItems = (value) => {
234
253
  const quickPickItems = [];
235
254
  if (value) {
236
- quickPickItems.push({ label: quickPick.value, description: ( localizeWithPath(_moduleId, 6, "Import from URL")) });
255
+ quickPickItems.push({ label: quickPick.value, description: ( localize(10914, "Import from URL")) });
237
256
  }
238
- quickPickItems.push({ label: ( localizeWithPath(_moduleId, 7, "Select File...")) });
257
+ quickPickItems.push({ label: ( localize(10915, "Select File...")) });
239
258
  quickPick.items = quickPickItems;
240
259
  };
241
- quickPick.title = ( localizeWithPath(_moduleId, 8, "Import from Profile Template..."));
242
- quickPick.placeholder = ( localizeWithPath(_moduleId, 9, "Provide Profile Template URL"));
260
+ quickPick.title = ( localize(10916, "Import from Profile Template..."));
261
+ quickPick.placeholder = ( localize(10917, "Provide Profile Template URL"));
243
262
  quickPick.ignoreFocusOut = true;
244
263
  disposables.add(quickPick.onDidChangeValue(updateQuickPickItems));
245
264
  updateQuickPickItems();
@@ -268,7 +287,7 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
268
287
  canSelectFiles: true,
269
288
  canSelectMany: false,
270
289
  filters: PROFILE_FILTER,
271
- title: ( localizeWithPath(_moduleId, 10, "Select Profile Template File")),
290
+ title: ( localize(10918, "Select Profile Template File")),
272
291
  });
273
292
  if (!profileLocation) {
274
293
  return null;
@@ -278,10 +297,11 @@ let UserDataProfilesEditor = class UserDataProfilesEditor extends EditorPane {
278
297
  async setInput(input, options, context, token) {
279
298
  await super.setInput(input, options, context, token);
280
299
  this.model = await input.resolve();
300
+ if (this.profileWidget) {
301
+ this.profileWidget.templates = this.model.templates;
302
+ }
281
303
  this.updateProfilesList();
282
- this._register(this.model.onDidChange((element) => {
283
- this.updateProfilesList(element);
284
- }));
304
+ this._register(this.model.onDidChange(element => this.updateProfilesList(element)));
285
305
  }
286
306
  focus() {
287
307
  super.focus();
@@ -317,11 +337,10 @@ UserDataProfilesEditor = UserDataProfilesEditor_1 = ( (__decorate([
317
337
  ( (__param(1, ITelemetryService))),
318
338
  ( (__param(2, IThemeService))),
319
339
  ( (__param(3, IStorageService))),
320
- ( (__param(4, IUserDataProfileManagementService))),
321
- ( (__param(5, IQuickInputService))),
322
- ( (__param(6, IFileDialogService))),
323
- ( (__param(7, IContextMenuService))),
324
- ( (__param(8, IInstantiationService)))
340
+ ( (__param(4, IQuickInputService))),
341
+ ( (__param(5, IFileDialogService))),
342
+ ( (__param(6, IContextMenuService))),
343
+ ( (__param(7, IInstantiationService)))
325
344
  ], UserDataProfilesEditor)));
326
345
  class ProfileElementDelegate {
327
346
  getHeight(element) {
@@ -340,21 +359,22 @@ let ProfileElementRenderer = class ProfileElementRenderer {
340
359
  container.classList.add('profile-list-item');
341
360
  const icon = append(container, $('.profile-list-item-icon'));
342
361
  const label = append(container, $('.profile-list-item-label'));
362
+ const dirty = append(container, $(`span${ThemeIcon.asCSSSelector(Codicon.circleFilled)}`));
343
363
  const description = append(container, $('.profile-list-item-description'));
344
- append(description, $(`span${ThemeIcon.asCSSSelector(Codicon.check)}`));
345
- append(description, $('span', undefined, ( localizeWithPath(_moduleId, 11, "In use"))));
364
+ append(description, $('span', undefined, ( localize(10919, "In use"))));
346
365
  const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
347
366
  const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
348
367
  hoverDelegate: disposables.add(createInstantHoverDelegate()),
349
368
  highlightToggledItems: true
350
369
  }));
351
- return { label, icon, description, actionBar, disposables, elementDisposables };
370
+ return { label, icon, dirty, description, actionBar, disposables, elementDisposables };
352
371
  }
353
372
  renderElement(element, index, templateData, height) {
354
373
  templateData.elementDisposables.clear();
355
374
  templateData.label.textContent = element.name;
356
375
  templateData.label.classList.toggle('new-profile', element instanceof NewProfileElement);
357
376
  templateData.icon.className = ThemeIcon.asClassName(element.icon ? ThemeIcon.fromId(element.icon) : DEFAULT_ICON);
377
+ templateData.dirty.classList.toggle('hide', !(element instanceof NewProfileElement));
358
378
  templateData.description.classList.toggle('hide', !element.active);
359
379
  if (element.onDidChange) {
360
380
  templateData.elementDisposables.add(element.onDidChange(e => {
@@ -374,7 +394,7 @@ let ProfileElementRenderer = class ProfileElementRenderer {
374
394
  }
375
395
  }));
376
396
  }
377
- templateData.actionBar.setActions(element.actions[0] ?? []);
397
+ templateData.actionBar.setActions([...element.actions[0]], [...element.actions[1]]);
378
398
  }
379
399
  disposeElement(element, index, templateData, height) {
380
400
  templateData.elementDisposables.clear();
@@ -389,111 +409,34 @@ ProfileElementRenderer = ( (__decorate([
389
409
  ], ProfileElementRenderer)));
390
410
  let ProfileWidget = class ProfileWidget extends Disposable {
391
411
  set templates(templates) {
392
- this._templates = templates;
393
- this.renderSelectBox();
412
+ this.copyFromProfileRenderer.setTemplates(templates);
413
+ this.profileTree.rerender();
394
414
  }
395
- constructor(parent, hoverService, userDataProfilesService, contextViewService, editorProgressService, instantiationService) {
415
+ constructor(parent, editorProgressService, instantiationService) {
396
416
  super();
397
- this.hoverService = hoverService;
398
- this.userDataProfilesService = userDataProfilesService;
399
- this.contextViewService = contextViewService;
400
417
  this.editorProgressService = editorProgressService;
401
418
  this.instantiationService = instantiationService;
402
- this.copyFromOptions = [];
403
- this._templates = [];
404
419
  this._profileElement = this._register(( (new MutableDisposable())));
405
420
  const header = append(parent, $('.profile-header'));
406
421
  const title = append(header, $('.profile-title-container'));
407
- this.iconElement = append(title, $(`${ThemeIcon.asCSSSelector(DEFAULT_ICON)}`, { 'tabindex': '0', 'role': 'button', 'aria-label': ( localizeWithPath(_moduleId, 12, "Profile Icon")) }));
408
- this.renderIconSelectBox(this.iconElement);
409
422
  this.profileTitle = append(title, $(''));
410
- this.nameInput = this._register(( (new InputBox(title, undefined, {
411
- inputBoxStyles: defaultInputBoxStyles,
412
- ariaLabel: ( localizeWithPath(_moduleId, 13, "Profile Name")),
413
- placeholder: ( localizeWithPath(_moduleId, 13, "Profile Name")),
414
- validationOptions: {
415
- validation: (value) => {
416
- if (!value) {
417
- return {
418
- content: ( localizeWithPath(_moduleId, 14, "Profile name is required and must be a non-empty value.")),
419
- type: MessageType.ERROR
420
- };
421
- }
422
- if (this._profileElement.value?.element.disabled) {
423
- return null;
424
- }
425
- const initialName = this._profileElement.value?.element.getInitialName();
426
- value = value.trim();
427
- if (initialName !== value && ( (this.userDataProfilesService.profiles.some(p => p.name === value)))) {
428
- return {
429
- content: ( localizeWithPath(_moduleId, 15, "Profile with name {0} already exists.", value)),
430
- type: MessageType.ERROR
431
- };
432
- }
433
- return null;
434
- }
435
- }
436
- }))));
437
- this.nameInput.onDidChange(value => {
438
- if (this._profileElement.value && value) {
439
- this._profileElement.value.element.name = value;
440
- }
441
- });
442
- const focusTracker = this._register(trackFocus(this.nameInput.inputElement));
443
- this._register(focusTracker.onDidBlur(() => {
444
- if (this._profileElement.value && !this.nameInput.value) {
445
- this.nameInput.value = this._profileElement.value.element.name;
446
- }
447
- }));
448
- const actionsContainer = append(header, $('.profile-actions-container'));
449
- this.buttonContainer = append(actionsContainer, $('.profile-button-container'));
450
- this.toolbar = this._register(instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
451
- hoverDelegate: this._register(createInstantHoverDelegate()),
452
- highlightToggledItems: true
453
- }));
454
423
  const body = append(parent, $('.profile-body'));
455
- this.copyFromContainer = append(body, $('.profile-copy-from-container'));
456
- append(this.copyFromContainer, $('.profile-copy-from-label', undefined, ( localizeWithPath(_moduleId, 16, "Copy from"))));
457
- this.copyFromSelectBox = this._register(this.instantiationService.createInstance(SelectBox, [], 0, this.contextViewService, defaultSelectBoxStyles, {
458
- useCustomDrawn: true,
459
- ariaLabel: ( localizeWithPath(_moduleId, 17, "Copy profile from")),
460
- }));
461
- this.copyFromSelectBox.render(append(this.copyFromContainer, $('.profile-select-container')));
462
- this.useAsDefaultProfileContainer = append(body, $('.profile-use-as-default-container'));
463
- const useAsDefaultProfileTitle = ( localizeWithPath(_moduleId, 18, "Use this profile as default for new windows"));
464
- this.useAsDefaultProfileCheckbox = this._register(( (new Checkbox(useAsDefaultProfileTitle, false, defaultCheckboxStyles))));
465
- append(this.useAsDefaultProfileContainer, this.useAsDefaultProfileCheckbox.domNode);
466
- const useAsDefaultProfileLabel = append(this.useAsDefaultProfileContainer, $('.profile-use-as-default-label', undefined, useAsDefaultProfileTitle));
467
- this._register(this.useAsDefaultProfileCheckbox.onChange(() => {
468
- if (this._profileElement.value?.element instanceof UserDataProfileElement) {
469
- this._profileElement.value.element.toggleNewWindowProfile();
470
- }
471
- }));
472
- this._register(addDisposableListener(useAsDefaultProfileLabel, EventType.CLICK, () => {
473
- if (this._profileElement.value?.element instanceof UserDataProfileElement) {
474
- this._profileElement.value.element.toggleNewWindowProfile();
475
- }
476
- }));
477
- this.contentsTreeHeader = append(body, $('.profile-content-tree-header'));
478
- this.inheritLabelElement = $('.inherit-label', undefined, ( localizeWithPath(_moduleId, 19, "Use Default Profile")));
479
- append(this.contentsTreeHeader, $(''), $(''), this.inheritLabelElement, $('.actions-label', undefined, ( localizeWithPath(_moduleId, 20, "Actions"))));
480
- const delegate = ( (new ProfileResourceTreeElementDelegate()));
481
- this.resourcesTree = this._register(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-ResourcesTree', append(body, $('.profile-content-tree.file-icon-themable-tree.show-file-icons')), delegate, [
482
- this.instantiationService.createInstance(ExistingProfileResourceTreeRenderer),
483
- this.instantiationService.createInstance(NewProfileResourceTreeRenderer),
484
- this.instantiationService.createInstance(ProfileResourceChildTreeItemRenderer),
485
- ], this.instantiationService.createInstance(ProfileResourceTreeDataSource), {
424
+ const delegate = ( (new ProfileTreeDelegate()));
425
+ const contentsRenderer = this._register(this.instantiationService.createInstance(ContentsProfileRenderer));
426
+ this.copyFromProfileRenderer = this._register(this.instantiationService.createInstance(CopyFromProfileRenderer));
427
+ this.profileTreeContainer = append(body, $('.profile-tree'));
428
+ this.profileTree = this._register(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-Tree', this.profileTreeContainer, delegate, [
429
+ this._register(this.instantiationService.createInstance(ProfileNameRenderer)),
430
+ this._register(this.instantiationService.createInstance(ProfileIconRenderer)),
431
+ this._register(this.instantiationService.createInstance(UseAsDefaultProfileRenderer)),
432
+ this.copyFromProfileRenderer,
433
+ contentsRenderer,
434
+ ], this.instantiationService.createInstance(ProfileTreeDataSource), {
486
435
  multipleSelectionSupport: false,
487
436
  horizontalScrolling: false,
488
437
  accessibilityProvider: {
489
438
  getAriaLabel(element) {
490
- if ((element?.element).resourceType) {
491
- return (element?.element).resourceType;
492
- }
493
- if ((element?.element).label) {
494
- return (element?.element).label;
495
- }
496
- return '';
439
+ return element?.element ?? '';
497
440
  },
498
441
  getWidgetAriaLabel() {
499
442
  return '';
@@ -501,114 +444,52 @@ let ProfileWidget = class ProfileWidget extends Disposable {
501
444
  },
502
445
  identityProvider: {
503
446
  getId(element) {
504
- if (element?.element.handle) {
505
- return element.element.handle;
506
- }
507
- return '';
447
+ return element.element;
508
448
  }
509
449
  },
510
450
  expandOnlyOnTwistieClick: true,
511
451
  renderIndentGuides: RenderIndentGuides.None,
512
452
  enableStickyScroll: false,
513
453
  openOnSingleClick: false,
454
+ setRowLineHeight: false,
455
+ supportDynamicHeights: true,
456
+ alwaysConsumeMouseWheel: false,
514
457
  }));
515
- this._register(this.resourcesTree.onDidOpen(async (e) => {
516
- if (!e.browserEvent) {
517
- return;
518
- }
519
- if (e.browserEvent.target && e.browserEvent.target.classList.contains(Checkbox.CLASS_NAME)) {
520
- return;
521
- }
522
- if (e.element?.element.action) {
523
- await e.element.element.action.run();
524
- }
525
- }));
526
- }
527
- renderIconSelectBox(iconContainer) {
528
- const iconSelectBox = this._register(this.instantiationService.createInstance(WorkbenchIconSelectBox, { icons: ICONS, inputBoxStyles: defaultInputBoxStyles }));
529
- let hoverWidget;
530
- const showIconSelectBox = () => {
531
- if (this._profileElement.value?.element instanceof UserDataProfileElement && this._profileElement.value.element.profile.isDefault) {
532
- return;
533
- }
534
- if (this._profileElement.value?.element.disabled) {
535
- return;
536
- }
537
- iconSelectBox.clearInput();
538
- hoverWidget = this.hoverService.showHover({
539
- content: iconSelectBox.domNode,
540
- target: iconContainer,
541
- position: {
542
- hoverPosition: HoverPosition.BELOW,
543
- },
544
- persistence: {
545
- sticky: true,
546
- },
547
- appearance: {
548
- showPointer: true,
549
- },
550
- }, true);
551
- if (hoverWidget) {
552
- iconSelectBox.layout(( (new Dimension(486, 260))));
553
- iconSelectBox.focus();
554
- }
555
- };
556
- this._register(addDisposableListener(iconContainer, EventType.CLICK, (e) => {
557
- EventHelper.stop(e, true);
558
- showIconSelectBox();
559
- }));
560
- this._register(addDisposableListener(iconContainer, EventType.KEY_DOWN, e => {
561
- const event = ( (new StandardKeyboardEvent(e)));
562
- if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
563
- EventHelper.stop(event, true);
564
- showIconSelectBox();
565
- }
566
- }));
567
- this._register(addDisposableListener(iconSelectBox.domNode, EventType.KEY_DOWN, e => {
568
- const event = ( (new StandardKeyboardEvent(e)));
569
- if (event.equals(KeyCode.Escape)) {
570
- EventHelper.stop(event, true);
571
- hoverWidget?.dispose();
572
- iconContainer.focus();
458
+ this.profileTree.style(listStyles);
459
+ this._register(contentsRenderer.onDidChangeContentHeight((e) => this.profileTree.updateElementHeight(e, undefined)));
460
+ this._register(contentsRenderer.onDidChangeSelection((e) => {
461
+ if (e.selected) {
462
+ this.profileTree.setFocus([]);
463
+ this.profileTree.setSelection([]);
573
464
  }
574
465
  }));
575
- this._register(iconSelectBox.onDidSelect(selectedIcon => {
576
- hoverWidget?.dispose();
577
- iconContainer.focus();
578
- if (this._profileElement.value) {
579
- this._profileElement.value.element.icon = selectedIcon.id;
466
+ this._register(this.profileTree.onDidChangeContentHeight((e) => {
467
+ if (this.dimension) {
468
+ this.layout(this.dimension);
580
469
  }
581
470
  }));
582
- }
583
- renderSelectBox() {
584
- this.copyFromSelectBox.setOptions(this.getCopyFromOptions());
585
- this._register(this.copyFromSelectBox.onDidSelect(option => {
586
- if (this._profileElement.value?.element instanceof NewProfileElement) {
587
- this._profileElement.value.element.copyFrom = this.copyFromOptions[option.index].source;
471
+ this._register(this.profileTree.onDidChangeSelection((e) => {
472
+ if (e.elements.length) {
473
+ contentsRenderer.clearSelection();
588
474
  }
589
475
  }));
476
+ this.buttonContainer = append(body, $('.profile-row-container.profile-button-container'));
590
477
  }
591
478
  layout(dimension) {
592
- this.resourcesTree.layout(dimension.height - 34 - 20 - 25 - 20, dimension.width);
479
+ this.dimension = dimension;
480
+ const treeContentHeight = this.profileTree.contentHeight;
481
+ const height = Math.min(treeContentHeight, dimension.height - (this._profileElement.value?.element instanceof NewProfileElement ? 116 : 54));
482
+ this.profileTreeContainer.style.height = `${height}px`;
483
+ this.profileTree.layout(height, dimension.width);
593
484
  }
594
485
  render(profileElement) {
595
- this.resourcesTree.setInput(profileElement);
486
+ this.profileTree.setInput(profileElement);
596
487
  const disposables = ( (new DisposableStore()));
597
488
  this._profileElement.value = { element: profileElement, dispose: () => disposables.dispose() };
598
- this.renderProfileElement(profileElement);
599
- disposables.add(profileElement.onDidChange(e => this.renderProfileElement(profileElement)));
600
- const profile = profileElement instanceof UserDataProfileElement ? profileElement.profile : undefined;
601
- this.profileTitle.classList.toggle('hide', !profile?.isDefault);
602
- this.nameInput.element.classList.toggle('hide', !!profile?.isDefault);
603
- this.iconElement.classList.toggle('disabled', !!profile?.isDefault);
604
- this.iconElement.setAttribute('tabindex', profile?.isDefault ? '' : '0');
489
+ this.profileTitle.textContent = profileElement.name;
605
490
  disposables.add(profileElement.onDidChange(e => {
606
- if (e.flags || e.copyFrom || e.copyFlags || e.disabled) {
607
- const viewState = this.resourcesTree.getViewState();
608
- this.resourcesTree.setInput(profileElement, {
609
- ...viewState,
610
- expanded: viewState.expanded?.map(e => e)
611
- });
491
+ if (e.name) {
492
+ this.profileTitle.textContent = profileElement.name;
612
493
  }
613
494
  }));
614
495
  const [primaryTitleButtons, secondatyTitleButtons] = profileElement.titleButtons;
@@ -627,6 +508,9 @@ let ProfileWidget = class ProfileWidget extends Disposable {
627
508
  if (!isUndefined(e.enabled)) {
628
509
  button.enabled = action.enabled;
629
510
  }
511
+ if (!isUndefined(e.label)) {
512
+ button.label = action.label;
513
+ }
630
514
  }));
631
515
  }
632
516
  }
@@ -642,6 +526,9 @@ let ProfileWidget = class ProfileWidget extends Disposable {
642
526
  if (!isUndefined(e.enabled)) {
643
527
  button.enabled = action.enabled;
644
528
  }
529
+ if (!isUndefined(e.label)) {
530
+ button.label = action.label;
531
+ }
645
532
  }));
646
533
  disposables.add(profileElement.onDidChange(e => {
647
534
  if (e.message) {
@@ -655,81 +542,67 @@ let ProfileWidget = class ProfileWidget extends Disposable {
655
542
  else {
656
543
  this.buttonContainer.classList.add('hide');
657
544
  }
658
- this.toolbar.setActions(profileElement.titleActions[0].slice(0), profileElement.titleActions[1].slice(0));
659
545
  if (profileElement instanceof NewProfileElement) {
660
- this.nameInput.focus();
661
- this.nameInput.select();
546
+ this.profileTree.focusFirst();
662
547
  }
663
- }
664
- renderProfileElement(profileElement) {
665
- this.profileTitle.textContent = profileElement.name;
666
- this.nameInput.value = profileElement.name;
667
- this.nameInput.validate();
668
- if (profileElement.disabled) {
669
- this.nameInput.disable();
548
+ if (this.dimension) {
549
+ this.layout(this.dimension);
670
550
  }
671
- else {
672
- this.nameInput.enable();
673
- }
674
- if (profileElement.icon) {
675
- this.iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(profileElement.icon));
676
- }
677
- else {
678
- this.iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(DEFAULT_ICON.id));
679
- }
680
- if (profileElement instanceof NewProfileElement) {
681
- this.contentsTreeHeader.classList.add('new-profile');
682
- this.inheritLabelElement.textContent = ( localizeWithPath(_moduleId, 21, "Options"));
683
- this.useAsDefaultProfileContainer.classList.add('hide');
684
- this.copyFromContainer.classList.remove('hide');
685
- this.copyFromOptions = this.getCopyFromOptions();
686
- const id = profileElement.copyFrom instanceof URI ? ( (profileElement.copyFrom.toString())) : profileElement.copyFrom?.id;
687
- const index = id
688
- ? this.copyFromOptions.findIndex(option => option.id === id)
689
- : 0;
690
- if (index !== -1) {
691
- this.copyFromSelectBox.setOptions(this.copyFromOptions);
692
- this.copyFromSelectBox.setEnabled(!profileElement.previewProfile && !profileElement.disabled);
693
- this.copyFromSelectBox.select(index);
694
- }
695
- else {
696
- this.copyFromSelectBox.setOptions([{ text: basename(profileElement.copyFrom) }]);
697
- this.copyFromSelectBox.setEnabled(false);
698
- }
699
- }
700
- else if (profileElement instanceof UserDataProfileElement) {
701
- this.contentsTreeHeader.classList.remove('new-profile');
702
- this.inheritLabelElement.textContent = profileElement.profile.isDefault ? '' : ( localizeWithPath(_moduleId, 19, "Use Default Profile"));
703
- this.useAsDefaultProfileContainer.classList.remove('hide');
704
- this.useAsDefaultProfileCheckbox.checked = profileElement.isNewWindowProfile;
705
- this.copyFromContainer.classList.add('hide');
551
+ }
552
+ };
553
+ ProfileWidget = ( (__decorate([
554
+ ( (__param(1, IEditorProgressService))),
555
+ ( (__param(2, IInstantiationService)))
556
+ ], ProfileWidget)));
557
+ class ProfileTreeDelegate extends CachedListVirtualDelegate {
558
+ getTemplateId({ element }) {
559
+ return element;
560
+ }
561
+ hasDynamicHeight({ element }) {
562
+ return element === 'contents';
563
+ }
564
+ estimateHeight({ element }) {
565
+ switch (element) {
566
+ case 'name':
567
+ return 72;
568
+ case 'icon':
569
+ return 68;
570
+ case 'copyFrom':
571
+ return 90;
572
+ case 'useAsDefault':
573
+ return 68;
574
+ case 'contents':
575
+ return 250;
706
576
  }
707
577
  }
708
- getCopyFromOptions() {
709
- const separator = { text: '\u2500\u2500\u2500\u2500\u2500\u2500', isDisabled: true };
710
- const copyFromOptions = [];
711
- copyFromOptions.push({ text: ( localizeWithPath(_moduleId, 22, "None")) });
712
- if (this._templates.length) {
713
- copyFromOptions.push({ ...separator, decoratorRight: ( localizeWithPath(_moduleId, 23, "Profile Templates")) });
714
- for (const template of this._templates) {
715
- copyFromOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
578
+ }
579
+ class ProfileTreeDataSource {
580
+ hasChildren(element) {
581
+ return element instanceof AbstractUserDataProfileElement;
582
+ }
583
+ async getChildren(element) {
584
+ if (element instanceof AbstractUserDataProfileElement) {
585
+ const children = [];
586
+ if (element instanceof NewProfileElement) {
587
+ children.push({ element: 'name', root: element });
588
+ children.push({ element: 'icon', root: element });
589
+ children.push({ element: 'copyFrom', root: element });
590
+ children.push({ element: 'contents', root: element });
716
591
  }
592
+ else if (element instanceof UserDataProfileElement) {
593
+ if (!element.profile.isDefault) {
594
+ children.push({ element: 'name', root: element });
595
+ children.push({ element: 'icon', root: element });
596
+ }
597
+ children.push({ element: 'useAsDefault', root: element });
598
+ children.push({ element: 'contents', root: element });
599
+ }
600
+ return children;
717
601
  }
718
- copyFromOptions.push({ ...separator, decoratorRight: ( localizeWithPath(_moduleId, 24, "Existing Profiles")) });
719
- for (const profile of this.userDataProfilesService.profiles) {
720
- copyFromOptions.push({ text: profile.name, id: profile.id, source: profile });
721
- }
722
- return copyFromOptions;
602
+ return [];
723
603
  }
724
- };
725
- ProfileWidget = ( (__decorate([
726
- ( (__param(1, IHoverService))),
727
- ( (__param(2, IUserDataProfilesService))),
728
- ( (__param(3, IContextViewService))),
729
- ( (__param(4, IEditorProgressService))),
730
- ( (__param(5, IInstantiationService)))
731
- ], ProfileWidget)));
732
- class ProfileResourceTreeElementDelegate {
604
+ }
605
+ class ProfileContentTreeElementDelegate {
733
606
  getTemplateId(element) {
734
607
  if (!element.element.resourceType) {
735
608
  return ProfileResourceChildTreeItemRenderer.TEMPLATE_ID;
@@ -740,7 +613,7 @@ class ProfileResourceTreeElementDelegate {
740
613
  return ExistingProfileResourceTreeRenderer.TEMPLATE_ID;
741
614
  }
742
615
  getHeight(element) {
743
- return 22;
616
+ return 24;
744
617
  }
745
618
  }
746
619
  let ProfileResourceTreeDataSource = class ProfileResourceTreeDataSource {
@@ -803,15 +676,15 @@ class AbstractProfileResourceTreeRenderer extends Disposable {
803
676
  getResourceTypeTitle(resourceType) {
804
677
  switch (resourceType) {
805
678
  case ProfileResourceType.Settings:
806
- return ( localizeWithPath(_moduleId, 25, "Settings"));
679
+ return ( localize(10920, "Settings"));
807
680
  case ProfileResourceType.Keybindings:
808
- return ( localizeWithPath(_moduleId, 26, "Keyboard Shortcuts"));
681
+ return ( localize(10921, "Keyboard Shortcuts"));
809
682
  case ProfileResourceType.Snippets:
810
- return ( localizeWithPath(_moduleId, 27, "User Snippets"));
683
+ return ( localize(10922, "Snippets"));
811
684
  case ProfileResourceType.Tasks:
812
- return ( localizeWithPath(_moduleId, 28, "User Tasks"));
685
+ return ( localize(10923, "Tasks"));
813
686
  case ProfileResourceType.Extensions:
814
- return ( localizeWithPath(_moduleId, 29, "Extensions"));
687
+ return ( localize(10924, "Extensions"));
815
688
  }
816
689
  return '';
817
690
  }
@@ -822,6 +695,485 @@ class AbstractProfileResourceTreeRenderer extends Disposable {
822
695
  templateData.disposables.dispose();
823
696
  }
824
697
  }
698
+ class ProfilePropertyRenderer extends AbstractProfileResourceTreeRenderer {
699
+ renderElement({ element }, index, templateData, height) {
700
+ templateData.elementDisposables.clear();
701
+ templateData.element = element;
702
+ }
703
+ }
704
+ let ProfileNameRenderer = class ProfileNameRenderer extends ProfilePropertyRenderer {
705
+ constructor(userDataProfilesService, contextViewService) {
706
+ super();
707
+ this.userDataProfilesService = userDataProfilesService;
708
+ this.contextViewService = contextViewService;
709
+ this.templateId = 'name';
710
+ }
711
+ renderTemplate(parent) {
712
+ const disposables = ( (new DisposableStore()));
713
+ const elementDisposables = disposables.add(( (new DisposableStore())));
714
+ let profileElement;
715
+ const nameContainer = append(parent, $('.profile-row-container'));
716
+ append(nameContainer, $('.profile-label-element', undefined, ( localize(10925, "Name"))));
717
+ const nameInput = disposables.add(( (new InputBox(nameContainer, this.contextViewService, {
718
+ inputBoxStyles: getInputBoxStyle({
719
+ inputBorder: settingsTextInputBorder
720
+ }),
721
+ ariaLabel: ( localize(10926, "Profile Name")),
722
+ placeholder: ( localize(10926, "Profile Name")),
723
+ validationOptions: {
724
+ validation: (value) => {
725
+ if (!value) {
726
+ return {
727
+ content: ( localize(10927, "Profile name is required and must be a non-empty value.")),
728
+ type: MessageType.WARNING
729
+ };
730
+ }
731
+ if (profileElement?.root.disabled) {
732
+ return null;
733
+ }
734
+ if (!profileElement?.root.shouldValidateName()) {
735
+ return null;
736
+ }
737
+ const initialName = profileElement?.root.getInitialName();
738
+ value = value.trim();
739
+ if (initialName !== value && ( (this.userDataProfilesService.profiles.some(p => p.name === value)))) {
740
+ return {
741
+ content: ( localize(10928, "Profile with name {0} already exists.", value)),
742
+ type: MessageType.WARNING
743
+ };
744
+ }
745
+ return null;
746
+ }
747
+ }
748
+ }))));
749
+ disposables.add(this.userDataProfilesService.onDidChangeProfiles(() => nameInput.validate()));
750
+ nameInput.onDidChange(value => {
751
+ if (profileElement && value) {
752
+ profileElement.root.name = value;
753
+ }
754
+ });
755
+ const focusTracker = disposables.add(trackFocus(nameInput.inputElement));
756
+ disposables.add(focusTracker.onDidBlur(() => {
757
+ if (profileElement && !nameInput.value) {
758
+ nameInput.value = profileElement.root.name;
759
+ }
760
+ }));
761
+ const renderName = (profileElement) => {
762
+ nameInput.value = profileElement.root.name;
763
+ nameInput.validate();
764
+ if (profileElement.root.disabled) {
765
+ nameInput.disable();
766
+ }
767
+ else {
768
+ nameInput.enable();
769
+ }
770
+ };
771
+ return {
772
+ set element(element) {
773
+ profileElement = element;
774
+ renderName(profileElement);
775
+ elementDisposables.add(profileElement.root.onDidChange(e => {
776
+ if (e.name || e.disabled) {
777
+ renderName(element);
778
+ }
779
+ }));
780
+ },
781
+ disposables,
782
+ elementDisposables
783
+ };
784
+ }
785
+ };
786
+ ProfileNameRenderer = ( (__decorate([
787
+ ( (__param(0, IUserDataProfilesService))),
788
+ ( (__param(1, IContextViewService)))
789
+ ], ProfileNameRenderer)));
790
+ let ProfileIconRenderer = class ProfileIconRenderer extends ProfilePropertyRenderer {
791
+ constructor(instantiationService, hoverService) {
792
+ super();
793
+ this.instantiationService = instantiationService;
794
+ this.hoverService = hoverService;
795
+ this.templateId = 'icon';
796
+ }
797
+ renderTemplate(parent) {
798
+ const disposables = ( (new DisposableStore()));
799
+ const elementDisposables = disposables.add(( (new DisposableStore())));
800
+ let profileElement;
801
+ const iconContainer = append(parent, $('.profile-row-container'));
802
+ append(iconContainer, $('.profile-label-element', undefined, ( localize(10929, "Icon"))));
803
+ const iconValueContainer = append(iconContainer, $('.profile-icon-container'));
804
+ const iconElement = append(iconValueContainer, $(`${ThemeIcon.asCSSSelector(DEFAULT_ICON)}`, { 'tabindex': '0', 'role': 'button', 'aria-label': ( localize(10930, "Profile Icon")) }));
805
+ const iconSelectBox = disposables.add(this.instantiationService.createInstance(WorkbenchIconSelectBox, { icons: ICONS, inputBoxStyles: defaultInputBoxStyles }));
806
+ let hoverWidget;
807
+ const showIconSelectBox = () => {
808
+ if (profileElement?.root instanceof UserDataProfileElement && profileElement.root.profile.isDefault) {
809
+ return;
810
+ }
811
+ if (profileElement?.root.disabled) {
812
+ return;
813
+ }
814
+ iconSelectBox.clearInput();
815
+ hoverWidget = this.hoverService.showHover({
816
+ content: iconSelectBox.domNode,
817
+ target: iconElement,
818
+ position: {
819
+ hoverPosition: HoverPosition.BELOW,
820
+ },
821
+ persistence: {
822
+ sticky: true,
823
+ },
824
+ appearance: {
825
+ showPointer: true,
826
+ },
827
+ }, true);
828
+ if (hoverWidget) {
829
+ iconSelectBox.layout(( (new Dimension(486, 260))));
830
+ iconSelectBox.focus();
831
+ }
832
+ };
833
+ disposables.add(addDisposableListener(iconElement, EventType.CLICK, (e) => {
834
+ EventHelper.stop(e, true);
835
+ showIconSelectBox();
836
+ }));
837
+ disposables.add(addDisposableListener(iconElement, EventType.KEY_DOWN, e => {
838
+ const event = ( (new StandardKeyboardEvent(e)));
839
+ if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
840
+ EventHelper.stop(event, true);
841
+ showIconSelectBox();
842
+ }
843
+ }));
844
+ disposables.add(addDisposableListener(iconSelectBox.domNode, EventType.KEY_DOWN, e => {
845
+ const event = ( (new StandardKeyboardEvent(e)));
846
+ if (event.equals(KeyCode.Escape)) {
847
+ EventHelper.stop(event, true);
848
+ hoverWidget?.dispose();
849
+ iconElement.focus();
850
+ }
851
+ }));
852
+ disposables.add(iconSelectBox.onDidSelect(selectedIcon => {
853
+ hoverWidget?.dispose();
854
+ iconElement.focus();
855
+ if (profileElement) {
856
+ profileElement.root.icon = selectedIcon.id;
857
+ }
858
+ }));
859
+ append(iconValueContainer, $('.profile-description-element', undefined, ( localize(10931, "Profile icon to be shown in the activity bar"))));
860
+ const renderIcon = (profileElement) => {
861
+ if (profileElement.root.icon) {
862
+ iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(profileElement.root.icon));
863
+ }
864
+ else {
865
+ iconElement.className = ThemeIcon.asClassName(ThemeIcon.fromId(DEFAULT_ICON.id));
866
+ }
867
+ };
868
+ return {
869
+ set element(element) {
870
+ profileElement = element;
871
+ renderIcon(profileElement);
872
+ elementDisposables.add(profileElement.root.onDidChange(e => {
873
+ if (e.icon) {
874
+ renderIcon(element);
875
+ }
876
+ }));
877
+ },
878
+ disposables,
879
+ elementDisposables
880
+ };
881
+ }
882
+ };
883
+ ProfileIconRenderer = ( (__decorate([
884
+ ( (__param(0, IInstantiationService))),
885
+ ( (__param(1, IHoverService)))
886
+ ], ProfileIconRenderer)));
887
+ class UseAsDefaultProfileRenderer extends ProfilePropertyRenderer {
888
+ constructor() {
889
+ super(...arguments);
890
+ this.templateId = 'useAsDefault';
891
+ }
892
+ renderTemplate(parent) {
893
+ const disposables = ( (new DisposableStore()));
894
+ const elementDisposables = disposables.add(( (new DisposableStore())));
895
+ let profileElement;
896
+ const useAsDefaultProfileContainer = append(parent, $('.profile-row-container'));
897
+ append(useAsDefaultProfileContainer, $('.profile-label-element', undefined, ( localize(10932, "Use as Default"))));
898
+ const useAsDefaultProfileValueContainer = append(useAsDefaultProfileContainer, $('.profile-use-as-default-container'));
899
+ const useAsDefaultProfileTitle = ( localize(10933, "Use this profile as the default for new windows"));
900
+ const useAsDefaultProfileCheckbox = disposables.add(( (new Checkbox(useAsDefaultProfileTitle, false, defaultCheckboxStyles))));
901
+ append(useAsDefaultProfileValueContainer, useAsDefaultProfileCheckbox.domNode);
902
+ const useAsDefaultProfileLabel = append(useAsDefaultProfileValueContainer, $('.profile-description-element', undefined, useAsDefaultProfileTitle));
903
+ disposables.add(useAsDefaultProfileCheckbox.onChange(() => {
904
+ if (profileElement?.root instanceof UserDataProfileElement) {
905
+ profileElement.root.toggleNewWindowProfile();
906
+ }
907
+ }));
908
+ disposables.add(addDisposableListener(useAsDefaultProfileLabel, EventType.CLICK, () => {
909
+ if (profileElement?.root instanceof UserDataProfileElement) {
910
+ profileElement.root.toggleNewWindowProfile();
911
+ }
912
+ }));
913
+ const renderUseAsDefault = (profileElement) => {
914
+ useAsDefaultProfileCheckbox.checked = profileElement.root instanceof UserDataProfileElement && profileElement.root.isNewWindowProfile;
915
+ };
916
+ return {
917
+ set element(element) {
918
+ profileElement = element;
919
+ renderUseAsDefault(profileElement);
920
+ elementDisposables.add(profileElement.root.onDidChange(e => {
921
+ if (e.newWindowProfile) {
922
+ renderUseAsDefault(element);
923
+ }
924
+ }));
925
+ },
926
+ disposables,
927
+ elementDisposables
928
+ };
929
+ }
930
+ }
931
+ let CopyFromProfileRenderer = class CopyFromProfileRenderer extends ProfilePropertyRenderer {
932
+ constructor(userDataProfilesService, instantiationService, uriIdentityService, contextViewService) {
933
+ super();
934
+ this.userDataProfilesService = userDataProfilesService;
935
+ this.instantiationService = instantiationService;
936
+ this.uriIdentityService = uriIdentityService;
937
+ this.contextViewService = contextViewService;
938
+ this.templateId = 'copyFrom';
939
+ this.templates = [];
940
+ }
941
+ renderTemplate(parent) {
942
+ const disposables = ( (new DisposableStore()));
943
+ const elementDisposables = disposables.add(( (new DisposableStore())));
944
+ let profileElement;
945
+ const copyFromContainer = append(parent, $('.profile-row-container.profile-copy-from-container'));
946
+ append(copyFromContainer, $('.profile-label-element', undefined, ( localize(10934, "Copy from"))));
947
+ append(copyFromContainer, $('.profile-description-element', undefined, ( localize(10935, "Select the profile source from which you want to copy contents"))));
948
+ const copyFromSelectBox = disposables.add(this.instantiationService.createInstance(SelectBox, [], 0, this.contextViewService, defaultSelectBoxStyles, {
949
+ useCustomDrawn: true,
950
+ ariaLabel: ( localize(10936, "Copy profile from")),
951
+ }));
952
+ copyFromSelectBox.render(append(copyFromContainer, $('.profile-select-container')));
953
+ const render = (profileElement, copyFromOptions) => {
954
+ copyFromSelectBox.setOptions(copyFromOptions);
955
+ const id = profileElement.copyFrom instanceof URI ? ( (profileElement.copyFrom.toString())) : profileElement.copyFrom?.id;
956
+ const index = id
957
+ ? copyFromOptions.findIndex(option => option.id === id)
958
+ : 0;
959
+ copyFromSelectBox.select(index);
960
+ };
961
+ const that = this;
962
+ return {
963
+ set element(element) {
964
+ profileElement = element;
965
+ if (profileElement.root instanceof NewProfileElement) {
966
+ const newProfileElement = profileElement.root;
967
+ let copyFromOptions = that.getCopyFromOptions(newProfileElement);
968
+ render(newProfileElement, copyFromOptions);
969
+ copyFromSelectBox.setEnabled(!newProfileElement.previewProfile && !newProfileElement.disabled);
970
+ elementDisposables.add(profileElement.root.onDidChange(e => {
971
+ if (e.copyFrom || e.copyFromInfo) {
972
+ copyFromOptions = that.getCopyFromOptions(newProfileElement);
973
+ render(newProfileElement, copyFromOptions);
974
+ }
975
+ if (e.preview || e.disabled) {
976
+ copyFromSelectBox.setEnabled(!newProfileElement.previewProfile && !newProfileElement.disabled);
977
+ }
978
+ }));
979
+ elementDisposables.add(copyFromSelectBox.onDidSelect(option => {
980
+ newProfileElement.copyFrom = copyFromOptions[option.index].source;
981
+ }));
982
+ }
983
+ },
984
+ disposables,
985
+ elementDisposables
986
+ };
987
+ }
988
+ setTemplates(templates) {
989
+ this.templates = templates;
990
+ }
991
+ getCopyFromOptions(profileElement) {
992
+ const separator = { text: '\u2500\u2500\u2500\u2500\u2500\u2500', isDisabled: true };
993
+ const copyFromOptions = [];
994
+ copyFromOptions.push({ text: ( localize(10937, "None")) });
995
+ for (const [copyFromTemplate, name] of profileElement.copyFromTemplates) {
996
+ if (!( (this.templates.some(
997
+ template => this.uriIdentityService.extUri.isEqual(( (URI.parse(template.url))), copyFromTemplate)
998
+ )))) {
999
+ copyFromOptions.push({ text: `${name} (${basename(copyFromTemplate)})`, id: ( (copyFromTemplate.toString())), source: copyFromTemplate });
1000
+ }
1001
+ }
1002
+ if (this.templates.length) {
1003
+ copyFromOptions.push({ ...separator, decoratorRight: ( localize(10938, "Profile Templates")) });
1004
+ for (const template of this.templates) {
1005
+ copyFromOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
1006
+ }
1007
+ }
1008
+ copyFromOptions.push({ ...separator, decoratorRight: ( localize(10939, "Existing Profiles")) });
1009
+ for (const profile of this.userDataProfilesService.profiles) {
1010
+ copyFromOptions.push({ text: profile.name, id: profile.id, source: profile });
1011
+ }
1012
+ return copyFromOptions;
1013
+ }
1014
+ };
1015
+ CopyFromProfileRenderer = ( (__decorate([
1016
+ ( (__param(0, IUserDataProfilesService))),
1017
+ ( (__param(1, IInstantiationService))),
1018
+ ( (__param(2, IUriIdentityService))),
1019
+ ( (__param(3, IContextViewService)))
1020
+ ], CopyFromProfileRenderer)));
1021
+ let ContentsProfileRenderer = class ContentsProfileRenderer extends ProfilePropertyRenderer {
1022
+ constructor(userDataProfilesService, instantiationService) {
1023
+ super();
1024
+ this.userDataProfilesService = userDataProfilesService;
1025
+ this.instantiationService = instantiationService;
1026
+ this.templateId = 'contents';
1027
+ this._onDidChangeContentHeight = this._register(( (new Emitter())));
1028
+ this.onDidChangeContentHeight = this._onDidChangeContentHeight.event;
1029
+ this._onDidChangeSelection = this._register(( (new Emitter())));
1030
+ this.onDidChangeSelection = this._onDidChangeSelection.event;
1031
+ }
1032
+ renderTemplate(parent) {
1033
+ const disposables = ( (new DisposableStore()));
1034
+ const elementDisposables = disposables.add(( (new DisposableStore())));
1035
+ let profileElement;
1036
+ const configureRowContainer = append(parent, $('.profile-row-container'));
1037
+ append(configureRowContainer, $('.profile-label-element', undefined, ( localize(10940, "Contents"))));
1038
+ const contentsDescriptionElement = append(configureRowContainer, $('.profile-description-element'));
1039
+ const contentsTreeHeader = append(configureRowContainer, $('.profile-content-tree-header'));
1040
+ const optionsLabel = $('.options-header', undefined, $('span', undefined, ( localize(10941, "Source"))));
1041
+ append(contentsTreeHeader, $(''), $('', undefined, ( localize(10941, "Contents"))), optionsLabel, $('.actions-header', undefined, ( localize(10942, "Actions"))));
1042
+ const delegate = ( (new ProfileContentTreeElementDelegate()));
1043
+ const profilesContentTree = this.profilesContentTree = disposables.add(this.instantiationService.createInstance((WorkbenchAsyncDataTree), 'ProfileEditor-ContentsTree', append(configureRowContainer, $('.profile-content-tree.file-icon-themable-tree.show-file-icons')), delegate, [
1044
+ this.instantiationService.createInstance(ExistingProfileResourceTreeRenderer),
1045
+ this.instantiationService.createInstance(NewProfileResourceTreeRenderer),
1046
+ this.instantiationService.createInstance(ProfileResourceChildTreeItemRenderer),
1047
+ ], this.instantiationService.createInstance(ProfileResourceTreeDataSource), {
1048
+ multipleSelectionSupport: false,
1049
+ horizontalScrolling: false,
1050
+ accessibilityProvider: {
1051
+ getAriaLabel(element) {
1052
+ if ((element?.element).resourceType) {
1053
+ return (element?.element).resourceType;
1054
+ }
1055
+ if ((element?.element).label) {
1056
+ return (element?.element).label;
1057
+ }
1058
+ return '';
1059
+ },
1060
+ getWidgetAriaLabel() {
1061
+ return '';
1062
+ },
1063
+ },
1064
+ identityProvider: {
1065
+ getId(element) {
1066
+ if (element?.element.handle) {
1067
+ return element.element.handle;
1068
+ }
1069
+ return '';
1070
+ }
1071
+ },
1072
+ expandOnlyOnTwistieClick: true,
1073
+ renderIndentGuides: RenderIndentGuides.None,
1074
+ enableStickyScroll: false,
1075
+ openOnSingleClick: false,
1076
+ alwaysConsumeMouseWheel: false,
1077
+ }));
1078
+ this.profilesContentTree.style(listStyles);
1079
+ disposables.add(toDisposable(() => this.profilesContentTree = undefined));
1080
+ disposables.add(this.profilesContentTree.onDidChangeContentHeight(height => {
1081
+ this.profilesContentTree?.layout(height);
1082
+ if (profileElement) {
1083
+ this._onDidChangeContentHeight.fire(profileElement);
1084
+ }
1085
+ }));
1086
+ disposables.add(this.profilesContentTree.onDidChangeSelection((e => {
1087
+ if (profileElement) {
1088
+ this._onDidChangeSelection.fire({ element: profileElement, selected: !!e.elements.length });
1089
+ }
1090
+ })));
1091
+ disposables.add(this.profilesContentTree.onDidOpen(async (e) => {
1092
+ if (!e.browserEvent) {
1093
+ return;
1094
+ }
1095
+ if (e.browserEvent.target && e.browserEvent.target.classList.contains(Checkbox.CLASS_NAME)) {
1096
+ return;
1097
+ }
1098
+ if (e.element?.element.action) {
1099
+ await e.element.element.action.run();
1100
+ }
1101
+ }));
1102
+ const updateDescription = (element) => {
1103
+ const defaultHelpInfo = ( localize(10943, "- *Default:* Use contents from the Default profile\n"));
1104
+ const markdown = ( (new MarkdownString()))
1105
+ .appendMarkdown(( localize(10944, "Configure source of contents for this profile\n")));
1106
+ clearNode(contentsDescriptionElement);
1107
+ if (element.root instanceof UserDataProfileElement && element.root.profile.isDefault) {
1108
+ return;
1109
+ }
1110
+ if (element.root instanceof NewProfileElement) {
1111
+ const copyFromName = element.root.getCopyFromName();
1112
+ const optionName = copyFromName === this.userDataProfilesService.defaultProfile.name
1113
+ ? ( localize(10945, "{0} (Copy)", copyFromName))
1114
+ : copyFromName;
1115
+ if (optionName) {
1116
+ markdown
1117
+ .appendMarkdown(( localize(
1118
+ 10946,
1119
+ "- *{0}:* Copy contents from the {1} profile\n",
1120
+ optionName,
1121
+ copyFromName
1122
+ )));
1123
+ }
1124
+ markdown
1125
+ .appendMarkdown(defaultHelpInfo)
1126
+ .appendMarkdown(( localize(10947, "- *None:* Create empty contents\n")));
1127
+ }
1128
+ else if (element.root instanceof UserDataProfileElement) {
1129
+ markdown
1130
+ .appendMarkdown(defaultHelpInfo)
1131
+ .appendMarkdown(( localize(
1132
+ 10948,
1133
+ "- *{1}:* Use contents from the {0} profile\n",
1134
+ element.root.profile.name,
1135
+ element.root.profile.name
1136
+ )));
1137
+ }
1138
+ append(contentsDescriptionElement, elementDisposables.add(renderMarkdown(markdown)).element);
1139
+ };
1140
+ const that = this;
1141
+ return {
1142
+ set element(element) {
1143
+ profileElement = element;
1144
+ updateDescription(element);
1145
+ if (element.root instanceof NewProfileElement) {
1146
+ contentsTreeHeader.classList.remove('default-profile');
1147
+ }
1148
+ else if (element.root instanceof UserDataProfileElement) {
1149
+ contentsTreeHeader.classList.toggle('default-profile', element.root.profile.isDefault);
1150
+ }
1151
+ profilesContentTree.setInput(profileElement.root);
1152
+ elementDisposables.add(profileElement.root.onDidChange(e => {
1153
+ if (e.copyFrom || e.copyFlags || e.flags) {
1154
+ profilesContentTree.updateChildren(element.root);
1155
+ }
1156
+ if (e.copyFromInfo) {
1157
+ updateDescription(element);
1158
+ that._onDidChangeContentHeight.fire(element);
1159
+ }
1160
+ }));
1161
+ },
1162
+ disposables,
1163
+ elementDisposables: ( (new DisposableStore()))
1164
+ };
1165
+ }
1166
+ clearSelection() {
1167
+ if (this.profilesContentTree) {
1168
+ this.profilesContentTree.setSelection([]);
1169
+ this.profilesContentTree.setFocus([]);
1170
+ }
1171
+ }
1172
+ };
1173
+ ContentsProfileRenderer = ( (__decorate([
1174
+ ( (__param(0, IUserDataProfilesService))),
1175
+ ( (__param(1, IInstantiationService)))
1176
+ ], ContentsProfileRenderer)));
825
1177
  let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
826
1178
  static { ExistingProfileResourceTreeRenderer_1 = this; }
827
1179
  static { this.TEMPLATE_ID = 'ExistingProfileResourceTemplate'; }
@@ -834,15 +1186,14 @@ let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRende
834
1186
  const disposables = ( (new DisposableStore()));
835
1187
  const container = append(parent, $('.profile-tree-item-container.existing-profile-resource-type-container'));
836
1188
  const label = append(container, $('.profile-resource-type-label'));
837
- const inheritContainer = append(container, $('.inherit-container'));
838
- const checkbox = disposables.add(( (new Checkbox('', false, defaultCheckboxStyles))));
839
- append(inheritContainer, checkbox.domNode);
840
- const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
1189
+ const radio = disposables.add(( (new Radio({ items: [] }))));
1190
+ append(append(container, $('.profile-resource-options-container')), radio.domNode);
1191
+ const actionsContainer = append(container, $('.profile-resource-actions-container'));
841
1192
  const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
842
1193
  hoverDelegate: disposables.add(createInstantHoverDelegate()),
843
1194
  highlightToggledItems: true
844
1195
  }));
845
- return { checkbox, label, inheritContainer, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
1196
+ return { label, radio, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
846
1197
  }
847
1198
  renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
848
1199
  templateData.elementDisposables.clear();
@@ -852,17 +1203,35 @@ let ExistingProfileResourceTreeRenderer = class ExistingProfileResourceTreeRende
852
1203
  'ExistingProfileResourceTreeRenderer can only render existing profile element'
853
1204
  )));
854
1205
  }
855
- if (!isProfileResourceTypeElement(element)) {
1206
+ if (isString(element) || !isProfileResourceTypeElement(element)) {
856
1207
  throw ( (new Error('Invalid profile resource element')));
857
1208
  }
858
- templateData.label.textContent = this.getResourceTypeTitle(element.resourceType);
1209
+ const updateRadioItems = () => {
1210
+ templateData.radio.setItems([{
1211
+ text: ( localize(10949, "Default")),
1212
+ tooltip: ( localize(10950, "Use {0} from the Default profile", resourceTypeTitle)),
1213
+ isActive: root.getFlag(element.resourceType)
1214
+ },
1215
+ {
1216
+ text: root.name,
1217
+ tooltip: ( localize(10951, "Use {0} from the {1} profile", resourceTypeTitle, root.name)),
1218
+ isActive: !root.getFlag(element.resourceType)
1219
+ }]);
1220
+ };
1221
+ const resourceTypeTitle = this.getResourceTypeTitle(element.resourceType);
1222
+ templateData.label.textContent = resourceTypeTitle;
859
1223
  if (root instanceof UserDataProfileElement && root.profile.isDefault) {
860
- templateData.checkbox.domNode.classList.add('hide');
1224
+ templateData.radio.domNode.classList.add('hide');
861
1225
  }
862
1226
  else {
863
- templateData.checkbox.domNode.classList.remove('hide');
864
- templateData.checkbox.checked = root.getFlag(element.resourceType);
865
- templateData.elementDisposables.add(templateData.checkbox.onChange(() => root.setFlag(element.resourceType, templateData.checkbox.checked)));
1227
+ templateData.radio.domNode.classList.remove('hide');
1228
+ updateRadioItems();
1229
+ templateData.elementDisposables.add(root.onDidChange(e => {
1230
+ if (e.name) {
1231
+ updateRadioItems();
1232
+ }
1233
+ }));
1234
+ templateData.elementDisposables.add(templateData.radio.onDidSelect((index) => root.setFlag(element.resourceType, index === 0)));
866
1235
  }
867
1236
  templateData.actionBar.setActions(element.action ? [element.action] : []);
868
1237
  }
@@ -873,9 +1242,9 @@ ExistingProfileResourceTreeRenderer = ExistingProfileResourceTreeRenderer_1 = (
873
1242
  let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extends AbstractProfileResourceTreeRenderer {
874
1243
  static { NewProfileResourceTreeRenderer_1 = this; }
875
1244
  static { this.TEMPLATE_ID = 'NewProfileResourceTemplate'; }
876
- constructor(contextViewService, instantiationService) {
1245
+ constructor(userDataProfilesService, instantiationService) {
877
1246
  super();
878
- this.contextViewService = contextViewService;
1247
+ this.userDataProfilesService = userDataProfilesService;
879
1248
  this.instantiationService = instantiationService;
880
1249
  this.templateId = NewProfileResourceTreeRenderer_1.TEMPLATE_ID;
881
1250
  }
@@ -884,17 +1253,14 @@ let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extend
884
1253
  const container = append(parent, $('.profile-tree-item-container.new-profile-resource-type-container'));
885
1254
  const labelContainer = append(container, $('.profile-resource-type-label-container'));
886
1255
  const label = append(labelContainer, $('span.profile-resource-type-label'));
887
- const selectBox = this._register(this.instantiationService.createInstance(SelectBox, [], 0, this.contextViewService, defaultSelectBoxStyles, {
888
- useCustomDrawn: true,
889
- }));
890
- const selectContainer = append(container, $('.profile-select-container'));
891
- selectBox.render(selectContainer);
892
- const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
1256
+ const radio = disposables.add(( (new Radio({ items: [] }))));
1257
+ append(append(container, $('.profile-resource-options-container')), radio.domNode);
1258
+ const actionsContainer = append(container, $('.profile-resource-actions-container'));
893
1259
  const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
894
1260
  hoverDelegate: disposables.add(createInstantHoverDelegate()),
895
1261
  highlightToggledItems: true
896
1262
  }));
897
- return { label, selectContainer, selectBox, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
1263
+ return { label, radio, actionBar, disposables, elementDisposables: disposables.add(( (new DisposableStore()))) };
898
1264
  }
899
1265
  renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
900
1266
  templateData.elementDisposables.clear();
@@ -902,39 +1268,65 @@ let NewProfileResourceTreeRenderer = class NewProfileResourceTreeRenderer extend
902
1268
  if (!(root instanceof NewProfileElement)) {
903
1269
  throw ( (new Error('NewProfileResourceTreeRenderer can only render new profile element')));
904
1270
  }
905
- if (!isProfileResourceTypeElement(element)) {
1271
+ if (isString(element) || !isProfileResourceTypeElement(element)) {
906
1272
  throw ( (new Error('Invalid profile resource element')));
907
1273
  }
908
- templateData.label.textContent = this.getResourceTypeTitle(element.resourceType);
909
- if (root.copyFrom && root.hasResource(element.resourceType)) {
1274
+ const resourceTypeTitle = this.getResourceTypeTitle(element.resourceType);
1275
+ templateData.label.textContent = resourceTypeTitle;
1276
+ const renderRadioItems = () => {
1277
+ const options = [{
1278
+ text: ( localize(10951, "Default")),
1279
+ tooltip: ( localize(10951, "Use {0} from the Default profile", resourceTypeTitle)),
1280
+ },
1281
+ {
1282
+ text: ( localize(10952, "None")),
1283
+ tooltip: ( localize(10953, "Create empty {0}", resourceTypeTitle))
1284
+ }];
910
1285
  const copyFromName = root.getCopyFromName();
911
- templateData.selectBox.setOptions([
912
- { text: ( localizeWithPath(_moduleId, 30, "Empty")) },
913
- { text: copyFromName ? ( localizeWithPath(_moduleId, 31, "Copy ({0})", copyFromName)) : ( localizeWithPath(_moduleId, 32, "Copy")) },
914
- { text: ( localizeWithPath(_moduleId, 33, "Use Default Profile")) }
915
- ]);
916
- templateData.selectBox.select(root.getCopyFlag(element.resourceType) ? 1 : root.getFlag(element.resourceType) ? 2 : 0);
917
- templateData.elementDisposables.add(templateData.selectBox.onDidSelect(option => {
918
- root.setFlag(element.resourceType, option.index === 2);
919
- root.setCopyFlag(element.resourceType, option.index === 1);
1286
+ const name = copyFromName === this.userDataProfilesService.defaultProfile.name
1287
+ ? ( localize(10953, "{0} (Copy)", copyFromName))
1288
+ : copyFromName;
1289
+ if (root.copyFrom && name) {
1290
+ templateData.radio.setItems([
1291
+ {
1292
+ text: name,
1293
+ tooltip: name ? ( localize(10954, "Copy {0} from the {1} profile", resourceTypeTitle, name)) : ( localize(10955, "Copy")),
1294
+ },
1295
+ ...options
1296
+ ]);
1297
+ templateData.radio.setActiveItem(root.getCopyFlag(element.resourceType) ? 0 : root.getFlag(element.resourceType) ? 1 : 2);
1298
+ }
1299
+ else {
1300
+ templateData.radio.setItems(options);
1301
+ templateData.radio.setActiveItem(root.getFlag(element.resourceType) ? 0 : 1);
1302
+ }
1303
+ };
1304
+ if (root.copyFrom) {
1305
+ templateData.elementDisposables.add(templateData.radio.onDidSelect(index => {
1306
+ root.setFlag(element.resourceType, index === 1);
1307
+ root.setCopyFlag(element.resourceType, index === 0);
920
1308
  }));
921
1309
  }
922
1310
  else {
923
- templateData.selectBox.setOptions([
924
- { text: ( localizeWithPath(_moduleId, 30, "Empty")) },
925
- { text: ( localizeWithPath(_moduleId, 33, "Use Default Profile")) }
926
- ]);
927
- templateData.selectBox.select(root.getFlag(element.resourceType) ? 1 : 0);
928
- templateData.elementDisposables.add(templateData.selectBox.onDidSelect(option => {
929
- root.setFlag(element.resourceType, option.index === 1);
1311
+ templateData.elementDisposables.add(templateData.radio.onDidSelect(index => {
1312
+ root.setFlag(element.resourceType, index === 0);
930
1313
  }));
931
1314
  }
932
- templateData.selectBox.setEnabled(!root.disabled);
1315
+ renderRadioItems();
1316
+ templateData.radio.setEnabled(!root.disabled);
1317
+ templateData.elementDisposables.add(root.onDidChange(e => {
1318
+ if (e.disabled) {
1319
+ templateData.radio.setEnabled(!root.disabled);
1320
+ }
1321
+ if (e.copyFrom || e.copyFromInfo) {
1322
+ renderRadioItems();
1323
+ }
1324
+ }));
933
1325
  templateData.actionBar.setActions(element.action ? [element.action] : []);
934
1326
  }
935
1327
  };
936
1328
  NewProfileResourceTreeRenderer = NewProfileResourceTreeRenderer_1 = ( (__decorate([
937
- ( (__param(0, IContextViewService))),
1329
+ ( (__param(0, IUserDataProfilesService))),
938
1330
  ( (__param(1, IInstantiationService)))
939
1331
  ], NewProfileResourceTreeRenderer)));
940
1332
  let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRenderer extends AbstractProfileResourceTreeRenderer {
@@ -953,7 +1345,7 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
953
1345
  const checkbox = disposables.add(( (new Checkbox('', false, defaultCheckboxStyles))));
954
1346
  append(container, checkbox.domNode);
955
1347
  const resourceLabel = disposables.add(this.labels.create(container, { hoverDelegate: this.hoverDelegate }));
956
- const actionsContainer = append(container, $('.profile-tree-item-actions-container'));
1348
+ const actionsContainer = append(container, $('.profile-resource-actions-container'));
957
1349
  const actionBar = disposables.add(this.instantiationService.createInstance(WorkbenchToolBar, actionsContainer, {
958
1350
  hoverDelegate: disposables.add(createInstantHoverDelegate()),
959
1351
  highlightToggledItems: true
@@ -963,10 +1355,11 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
963
1355
  renderElement({ element: profileResourceTreeElement }, index, templateData, height) {
964
1356
  templateData.elementDisposables.clear();
965
1357
  const { element } = profileResourceTreeElement;
966
- if (!isProfileResourceChildElement(element)) {
1358
+ if (isString(element) || !isProfileResourceChildElement(element)) {
967
1359
  throw ( (new Error('Invalid profile resource element')));
968
1360
  }
969
1361
  if (element.checkbox) {
1362
+ templateData.checkbox.domNode.setAttribute('tabindex', '0');
970
1363
  templateData.checkbox.domNode.classList.remove('hide');
971
1364
  templateData.checkbox.checked = element.checkbox.isChecked;
972
1365
  templateData.checkbox.domNode.ariaLabel = element.checkbox.accessibilityInformation?.label ?? '';
@@ -975,6 +1368,7 @@ let ProfileResourceChildTreeItemRenderer = class ProfileResourceChildTreeItemRen
975
1368
  }
976
1369
  }
977
1370
  else {
1371
+ templateData.checkbox.domNode.removeAttribute('tabindex');
978
1372
  templateData.checkbox.domNode.classList.add('hide');
979
1373
  }
980
1374
  templateData.resourceLabel.setResource({
@@ -1010,9 +1404,10 @@ let UserDataProfilesEditorInput = class UserDataProfilesEditorInput extends Edit
1010
1404
  this._register(this.model.onDidChange(e => this.dirty = ( (this.model.profiles.some(profile => profile instanceof NewProfileElement)))));
1011
1405
  }
1012
1406
  get typeId() { return UserDataProfilesEditorInput_1.ID; }
1013
- getName() { return ( localizeWithPath(_moduleId, 34, "Profiles")); }
1407
+ getName() { return ( localize(10956, "Profiles")); }
1014
1408
  getIcon() { return defaultUserDataProfileIcon; }
1015
1409
  async resolve() {
1410
+ await this.model.resolve();
1016
1411
  return this.model;
1017
1412
  }
1018
1413
  isDirty() {