@codingame/monaco-vscode-user-data-profile-service-override 8.0.4 → 9.0.2

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.js +2 -2
  3. package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +2 -2
  4. package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +1 -1
  5. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
  6. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.js +1 -6
  7. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +73 -372
  8. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +6 -110
  9. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +151 -69
  10. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +93 -56
  11. package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +5 -5
  12. package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +2 -17
  13. package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +1 -1
  14. package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +1 -1
  15. package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +2 -2
  16. package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +1 -1
  17. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +67 -887
  18. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +8 -8
  19. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilePreview.js +0 -24
@@ -3,23 +3,19 @@ import { Disposable, MutableDisposable, DisposableStore } from 'vscode/vscode/vs
3
3
  import { isWeb } from 'vscode/vscode/vs/base/common/platform';
4
4
  import { localize, localize2 } from 'vscode/vscode/vs/nls';
5
5
  import { MenuId, MenuRegistry, registerAction2, Action2 } from 'vscode/vscode/vs/platform/actions/common/actions';
6
- import { IMenuService } from 'vscode/vscode/vs/platform/actions/common/actions.service';
7
6
  import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
8
7
  import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
9
8
  import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
10
9
  import { LifecyclePhase } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle';
11
10
  import { ILifecycleService } from 'vscode/vscode/vs/workbench/services/lifecycle/common/lifecycle.service';
12
- import { CURRENT_PROFILE_CONTEXT, PROFILES_ENABLEMENT_CONTEXT, IS_CURRENT_PROFILE_TRANSIENT_CONTEXT, HAS_PROFILES_CONTEXT, ProfilesMenu, PROFILES_CATEGORY, IS_PROFILE_EXPORT_IN_PROGRESS_CONTEXT, IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT, PROFILE_FILTER, PROFILES_TITLE } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
13
- import { IUserDataProfileImportExportService, IUserDataProfileService, IUserDataProfileManagementService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
11
+ import { CURRENT_PROFILE_CONTEXT, PROFILES_ENABLEMENT_CONTEXT, IS_CURRENT_PROFILE_TRANSIENT_CONTEXT, HAS_PROFILES_CONTEXT, isProfileURL, PROFILES_CATEGORY, PROFILES_TITLE } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
12
+ import { IUserDataProfileService, IUserDataProfileManagementService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
14
13
  import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
15
14
  import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
16
- import { IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
17
15
  import { URI } from 'vscode/vscode/vs/base/common/uri';
18
16
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
19
- import { WorkbenchState } from 'vscode/vscode/vs/platform/workspace/common/workspace';
20
17
  import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
21
18
  import { IWorkspaceTagsService } from 'vscode/vscode/vs/workbench/contrib/tags/common/workspaceTags.service';
22
- import { getErrorMessage } from 'vscode/vscode/vs/base/common/errors';
23
19
  import { Categories } from 'vscode/vscode/vs/platform/action/common/actionCommonCategories';
24
20
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
25
21
  import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
@@ -30,33 +26,25 @@ import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/d
30
26
  import { IEditorGroupsService } from 'vscode/vscode/vs/workbench/services/editor/common/editorGroupsService.service';
31
27
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
32
28
  import { IHostService } from 'vscode/vscode/vs/workbench/services/host/browser/host.service';
33
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
34
- import { Extensions, ConfigurationScope } from 'vscode/vscode/vs/platform/configuration/common/configurationRegistry';
35
- import { workbenchConfigurationNodeBase } from 'vscode/vscode/vs/workbench/common/configuration';
36
- import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
29
+ import { IURLService } from 'vscode/vscode/vs/platform/url/common/url.service';
30
+ import { IBrowserWorkbenchEnvironmentService } from 'vscode/vscode/vs/workbench/services/environment/browser/environmentService.service';
37
31
 
38
32
  const OpenProfileMenu = ( (new MenuId('OpenProfile')));
39
- const CONFIG_ENABLE_NEW_PROFILES_UI = 'workbench.experimental.enableNewProfilesUI';
40
- const CONTEXT_ENABLE_NEW_PROFILES_UI = ( (ContextKeyExpr.equals('config.workbench.experimental.enableNewProfilesUI', true)));
41
33
  let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContribution extends Disposable {
42
34
  static { this.ID = 'workbench.contrib.userDataProfiles'; }
43
- constructor(userDataProfileService, userDataProfilesService, userDataProfileManagementService, userDataProfileImportExportService, telemetryService, workspaceContextService, workspaceTagsService, contextKeyService, configurationService, editorGroupsService, instantiationService, productService, lifecycleService) {
35
+ constructor(userDataProfileService, userDataProfilesService, userDataProfileManagementService, telemetryService, workspaceContextService, workspaceTagsService, contextKeyService, editorGroupsService, instantiationService, lifecycleService, urlService, environmentService) {
44
36
  super();
45
37
  this.userDataProfileService = userDataProfileService;
46
38
  this.userDataProfilesService = userDataProfilesService;
47
39
  this.userDataProfileManagementService = userDataProfileManagementService;
48
- this.userDataProfileImportExportService = userDataProfileImportExportService;
49
40
  this.telemetryService = telemetryService;
50
41
  this.workspaceContextService = workspaceContextService;
51
42
  this.workspaceTagsService = workspaceTagsService;
52
- this.configurationService = configurationService;
53
43
  this.editorGroupsService = editorGroupsService;
54
44
  this.instantiationService = instantiationService;
55
- this.productService = productService;
56
45
  this.lifecycleService = lifecycleService;
57
- this.startTime = Date.now();
46
+ this.urlService = urlService;
58
47
  this.profilesDisposable = this._register(( (new MutableDisposable())));
59
- this.currentprofileActionsDisposable = this._register(( (new MutableDisposable())));
60
48
  this.currentProfileContext = CURRENT_PROFILE_CONTEXT.bindTo(contextKeyService);
61
49
  PROFILES_ENABLEMENT_CONTEXT.bindTo(contextKeyService).set(this.userDataProfilesService.isEnabled());
62
50
  this.isCurrentProfileTransientContext = IS_CURRENT_PROFILE_TRANSIENT_CONTEXT.bindTo(contextKeyService);
@@ -69,86 +57,53 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
69
57
  this.hasProfilesContext = HAS_PROFILES_CONTEXT.bindTo(contextKeyService);
70
58
  this.hasProfilesContext.set(this.userDataProfilesService.profiles.length > 1);
71
59
  this._register(this.userDataProfilesService.onDidChangeProfiles(e => this.hasProfilesContext.set(this.userDataProfilesService.profiles.length > 1)));
72
- this.registerConfiguration();
73
60
  this.registerEditor();
74
61
  this.registerActions();
62
+ this._register(this.urlService.registerHandler(this));
75
63
  if (isWeb) {
76
64
  lifecycleService.when(LifecyclePhase.Eventually).then(() => userDataProfilesService.cleanUp());
77
65
  }
78
66
  this.reportWorkspaceProfileInfo();
67
+ if (environmentService.options?.profileToPreview) {
68
+ lifecycleService.when(LifecyclePhase.Restored).then(() => this.handleURL(URI.revive(environmentService.options.profileToPreview)));
69
+ }
70
+ }
71
+ async handleURL(uri) {
72
+ if (isProfileURL(uri)) {
73
+ const editor = await this.openProfilesEditor();
74
+ if (editor) {
75
+ editor.createNewProfile(uri);
76
+ return true;
77
+ }
78
+ }
79
+ return false;
79
80
  }
80
81
  async openProfilesEditor() {
81
82
  const editor = await this.editorGroupsService.activeGroup.openEditor(( (new UserDataProfilesEditorInput(this.instantiationService))));
82
83
  return editor;
83
84
  }
84
- isNewProfilesUIEnabled() {
85
- return this.configurationService.getValue(CONFIG_ENABLE_NEW_PROFILES_UI) === true;
86
- }
87
- registerConfiguration() {
88
- ( (Registry.as(Extensions.Configuration)))
89
- .registerConfiguration({
90
- ...workbenchConfigurationNodeBase,
91
- properties: {
92
- [CONFIG_ENABLE_NEW_PROFILES_UI]: {
93
- type: 'boolean',
94
- description: ( localize(8813, "Enables the new profiles UI.")),
95
- default: this.productService.quality !== 'stable',
96
- scope: ConfigurationScope.APPLICATION,
97
- }
98
- }
99
- });
100
- }
101
85
  registerEditor() {
102
- ( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(UserDataProfilesEditor, UserDataProfilesEditor.ID, ( localize(8814, "Profiles Editor"))), [
86
+ ( (Registry.as(EditorExtensions.EditorPane))).registerEditorPane(EditorPaneDescriptor.create(UserDataProfilesEditor, UserDataProfilesEditor.ID, ( localize(8855, "Profiles Editor"))), [
103
87
  ( (new SyncDescriptor(UserDataProfilesEditorInput)))
104
88
  ]);
105
89
  ( (Registry.as(EditorExtensions.EditorFactory))).registerEditorSerializer(UserDataProfilesEditorInput.ID, UserDataProfilesEditorInputSerializer);
106
90
  }
107
91
  registerActions() {
108
- this.registerProfileSubMenu();
109
92
  this._register(this.registerManageProfilesAction());
110
93
  this._register(this.registerSwitchProfileAction());
111
94
  this.registerOpenProfileSubMenu();
112
95
  this.registerNewWindowWithProfileAction();
113
96
  this.registerProfilesActions();
114
97
  this._register(this.userDataProfilesService.onDidChangeProfiles(() => this.registerProfilesActions()));
115
- this.registerCurrentProfilesActions();
116
- this._register(this.userDataProfileService.onDidChangeCurrentProfile(() => this.registerCurrentProfilesActions()));
98
+ this._register(this.registerExportCurrentProfileAction());
117
99
  this.registerCreateFromCurrentProfileAction();
118
100
  this.registerNewProfileAction();
119
101
  this.registerDeleteProfileAction();
120
102
  this.registerHelpAction();
121
103
  }
122
- registerProfileSubMenu() {
123
- const getProfilesTitle = () => {
124
- return ( localize(8815, "Profile ({0})", this.userDataProfileService.currentProfile.name));
125
- };
126
- const when = ( (ContextKeyExpr.or(
127
- (CONTEXT_ENABLE_NEW_PROFILES_UI.negate()),
128
- HAS_PROFILES_CONTEXT
129
- )));
130
- MenuRegistry.appendMenuItem(MenuId.GlobalActivity, {
131
- get title() {
132
- return getProfilesTitle();
133
- },
134
- submenu: ProfilesMenu,
135
- group: '2_configuration',
136
- order: 1,
137
- when,
138
- });
139
- MenuRegistry.appendMenuItem(MenuId.MenubarPreferencesMenu, {
140
- get title() {
141
- return getProfilesTitle();
142
- },
143
- submenu: ProfilesMenu,
144
- group: '2_configuration',
145
- order: 1,
146
- when,
147
- });
148
- }
149
104
  registerOpenProfileSubMenu() {
150
105
  MenuRegistry.appendMenuItem(MenuId.MenubarFileMenu, {
151
- title: ( localize(8816, "New Window with Profile")),
106
+ title: ( localize(8856, "New Window with Profile")),
152
107
  submenu: OpenProfileMenu,
153
108
  group: '1_new',
154
109
  order: 4,
@@ -158,46 +113,16 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
158
113
  this.profilesDisposable.value = ( (new DisposableStore()));
159
114
  for (const profile of this.userDataProfilesService.profiles) {
160
115
  if (!profile.isTransient) {
161
- this.profilesDisposable.value.add(this.registerProfileEntryAction(profile));
162
116
  this.profilesDisposable.value.add(this.registerNewWindowAction(profile));
163
117
  }
164
118
  }
165
119
  }
166
- registerProfileEntryAction(profile) {
167
- const that = this;
168
- return registerAction2(class ProfileEntryAction extends Action2 {
169
- constructor() {
170
- super({
171
- id: `workbench.profiles.actions.profileEntry.${profile.id}`,
172
- title: profile.name,
173
- toggled: ( (ContextKeyExpr.equals(CURRENT_PROFILE_CONTEXT.key, profile.id))),
174
- menu: [
175
- {
176
- id: ProfilesMenu,
177
- group: '0_profiles',
178
- when: PROFILES_ENABLEMENT_CONTEXT,
179
- }
180
- ]
181
- });
182
- }
183
- async run(accessor) {
184
- if (that.userDataProfileService.currentProfile.id !== profile.id) {
185
- if (profile.isDefault && Date.now() - that.startTime < ((1000 * 20) )) {
186
- that.telemetryService.publicLog2('profiles:newwindowprofile', {
187
- emptyWindow: that.workspaceContextService.getWorkbenchState() === WorkbenchState.EMPTY
188
- });
189
- }
190
- return that.userDataProfileManagementService.switchProfile(profile);
191
- }
192
- }
193
- });
194
- }
195
120
  registerNewWindowWithProfileAction() {
196
121
  return registerAction2(class NewWindowWithProfileAction extends Action2 {
197
122
  constructor() {
198
123
  super({
199
124
  id: `workbench.profiles.actions.newWindowWithProfile`,
200
- title: ( localize2(8817, "New Window with Profile...")),
125
+ title: ( localize2(8857, "New Window with Profile...")),
201
126
  category: PROFILES_CATEGORY,
202
127
  precondition: HAS_PROFILES_CONTEXT,
203
128
  f1: true,
@@ -211,8 +136,8 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
211
136
  label: profile.name,
212
137
  profile
213
138
  })))), {
214
- title: ( localize(8818, "New Window with Profile")),
215
- placeHolder: ( localize(8819, "Select Profile")),
139
+ title: ( localize(8858, "New Window with Profile")),
140
+ placeHolder: ( localize(8859, "Select Profile")),
216
141
  canPickMany: false
217
142
  });
218
143
  if (pick) {
@@ -223,12 +148,12 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
223
148
  }
224
149
  registerNewWindowAction(profile) {
225
150
  const disposables = ( (new DisposableStore()));
226
- const id = `workbench.action.openProfile.${profile.name.toLowerCase().replace('/\s+/', '_')}`;
151
+ const id = `workbench.action.openProfile.${profile.name.replace('/\s+/', '_')}`;
227
152
  disposables.add(registerAction2(class NewWindowAction extends Action2 {
228
153
  constructor() {
229
154
  super({
230
155
  id,
231
- title: ( localize2(8820, "{0}", profile.name)),
156
+ title: ( localize2(8860, "{0}", profile.name)),
232
157
  menu: {
233
158
  id: OpenProfileMenu,
234
159
  group: '0_profiles',
@@ -245,18 +170,19 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
245
170
  command: {
246
171
  id,
247
172
  category: PROFILES_CATEGORY,
248
- title: ( localize2(8821, "Open {0} Profile", profile.name)),
173
+ title: ( localize2(8861, "Open {0} Profile", profile.name)),
249
174
  precondition: HAS_PROFILES_CONTEXT
250
175
  },
251
176
  }));
252
177
  return disposables;
253
178
  }
254
179
  registerSwitchProfileAction() {
180
+ const that = this;
255
181
  return registerAction2(class SwitchProfileAction extends Action2 {
256
182
  constructor() {
257
183
  super({
258
184
  id: `workbench.profiles.actions.switchProfile`,
259
- title: ( localize2(8822, 'Switch Profile...')),
185
+ title: ( localize2(8862, 'Switch Profile...')),
260
186
  category: PROFILES_CATEGORY,
261
187
  f1: true,
262
188
  precondition: PROFILES_ENABLEMENT_CONTEXT,
@@ -264,26 +190,23 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
264
190
  }
265
191
  async run(accessor) {
266
192
  const quickInputService = accessor.get(IQuickInputService);
267
- const menuService = accessor.get(IMenuService);
268
- const menu = menuService.getMenuActions(ProfilesMenu, accessor.get(IContextKeyService));
269
- const actions = menu.find(([group]) => group === '0_profiles')?.[1] ?? [];
270
- const result = await quickInputService.pick(( (actions.map(action => ({
271
- action,
272
- label: action.checked ? `$(check) ${action.label}` : action.label,
273
- })))), {
274
- placeHolder: ( localize(8823, "Select Profile"))
193
+ const items = [];
194
+ for (const profile of that.userDataProfilesService.profiles) {
195
+ items.push({
196
+ id: profile.id,
197
+ label: profile.id === that.userDataProfileService.currentProfile.id ? `$(check) ${profile.name}` : profile.name,
198
+ profile,
199
+ });
200
+ }
201
+ const result = await quickInputService.pick(items.sort((a, b) => a.profile.name.localeCompare(b.profile.name)), {
202
+ placeHolder: ( localize(8863, "Select Profile"))
275
203
  });
276
- await result?.action.run();
204
+ if (result) {
205
+ await that.userDataProfileManagementService.switchProfile(result.profile);
206
+ }
277
207
  }
278
208
  });
279
209
  }
280
- registerCurrentProfilesActions() {
281
- this.currentprofileActionsDisposable.value = ( (new DisposableStore()));
282
- this.currentprofileActionsDisposable.value.add(this.registerEditCurrentProfileAction());
283
- this.currentprofileActionsDisposable.value.add(this.registerShowCurrentProfileContentsAction());
284
- this.currentprofileActionsDisposable.value.add(this.registerExportCurrentProfileAction());
285
- this.currentprofileActionsDisposable.value.add(this.registerImportProfileAction());
286
- }
287
210
  registerManageProfilesAction() {
288
211
  const disposables = ( (new DisposableStore()));
289
212
  disposables.add(registerAction2(class ManageProfilesAction extends Action2 {
@@ -291,32 +214,19 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
291
214
  super({
292
215
  id: `workbench.profiles.actions.manageProfiles`,
293
216
  title: {
294
- ...( localize2(8824, "Profiles")),
295
- mnemonicTitle: ( localize(8825, "&&Profiles")),
217
+ ...( localize2(8864, "Profiles")),
218
+ mnemonicTitle: ( localize(8865, "&&Profiles")),
296
219
  },
297
220
  menu: [
298
221
  {
299
222
  id: MenuId.GlobalActivity,
300
223
  group: '2_configuration',
301
224
  order: 1,
302
- when: ( (ContextKeyExpr.and(
303
- CONTEXT_ENABLE_NEW_PROFILES_UI,
304
- (HAS_PROFILES_CONTEXT.negate())
305
- ))),
306
225
  },
307
226
  {
308
227
  id: MenuId.MenubarPreferencesMenu,
309
228
  group: '2_configuration',
310
229
  order: 1,
311
- when: ( (ContextKeyExpr.and(
312
- CONTEXT_ENABLE_NEW_PROFILES_UI,
313
- (HAS_PROFILES_CONTEXT.negate())
314
- ))),
315
- },
316
- {
317
- id: ProfilesMenu,
318
- group: '1_manage',
319
- when: ( (ContextKeyExpr.and(CONTEXT_ENABLE_NEW_PROFILES_UI, HAS_PROFILES_CONTEXT))),
320
230
  },
321
231
  ]
322
232
  });
@@ -331,69 +241,11 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
331
241
  command: {
332
242
  id: 'workbench.profiles.actions.manageProfiles',
333
243
  category: Categories.Preferences,
334
- title: ( localize2(8826, "Open Profiles (UI)")),
335
- precondition: CONTEXT_ENABLE_NEW_PROFILES_UI,
244
+ title: ( localize2(8866, "Open Profiles (UI)")),
336
245
  },
337
246
  }));
338
247
  return disposables;
339
248
  }
340
- registerEditCurrentProfileAction() {
341
- const that = this;
342
- return registerAction2(class RenameCurrentProfileAction extends Action2 {
343
- constructor() {
344
- const precondition = ( (ContextKeyExpr.and( (ContextKeyExpr.notEquals(
345
- CURRENT_PROFILE_CONTEXT.key,
346
- that.userDataProfilesService.defaultProfile.id
347
- )), (IS_CURRENT_PROFILE_TRANSIENT_CONTEXT.toNegated()))));
348
- super({
349
- id: `workbench.profiles.actions.editCurrentProfile`,
350
- title: ( localize2(8827, "Edit Profile...")),
351
- precondition,
352
- f1: true,
353
- menu: [
354
- {
355
- id: ProfilesMenu,
356
- group: '2_manage_current',
357
- when: ( (ContextKeyExpr.and(precondition, (CONTEXT_ENABLE_NEW_PROFILES_UI.negate())))),
358
- order: 2
359
- }
360
- ]
361
- });
362
- }
363
- run(accessor) {
364
- if (that.isNewProfilesUIEnabled()) {
365
- return that.openProfilesEditor();
366
- }
367
- else {
368
- return that.userDataProfileImportExportService.editProfile(that.userDataProfileService.currentProfile);
369
- }
370
- }
371
- });
372
- }
373
- registerShowCurrentProfileContentsAction() {
374
- const id = 'workbench.profiles.actions.showProfileContents';
375
- return registerAction2(class ShowProfileContentsAction extends Action2 {
376
- constructor() {
377
- super({
378
- id,
379
- title: ( localize2(8828, "Show Profile Contents")),
380
- category: PROFILES_CATEGORY,
381
- menu: [
382
- {
383
- id: ProfilesMenu,
384
- group: '2_manage_current',
385
- order: 3,
386
- when: ( (CONTEXT_ENABLE_NEW_PROFILES_UI.negate()))
387
- }
388
- ]
389
- });
390
- }
391
- async run(accessor) {
392
- const userDataProfileImportExportService = accessor.get(IUserDataProfileImportExportService);
393
- return userDataProfileImportExportService.showProfileContents();
394
- }
395
- });
396
- }
397
249
  registerExportCurrentProfileAction() {
398
250
  const that = this;
399
251
  const disposables = ( (new DisposableStore()));
@@ -402,35 +254,21 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
402
254
  constructor() {
403
255
  super({
404
256
  id,
405
- title: ( localize2(8829, "Export Profile...")),
257
+ title: ( localize2(8867, "Export Profile...")),
406
258
  category: PROFILES_CATEGORY,
407
- precondition: ( (IS_PROFILE_EXPORT_IN_PROGRESS_CONTEXT.toNegated())),
408
- menu: [
409
- {
410
- id: ProfilesMenu,
411
- group: '4_import_export_profiles',
412
- order: 1,
413
- when: ( (CONTEXT_ENABLE_NEW_PROFILES_UI.negate())),
414
- }, {
415
- id: MenuId.CommandPalette
416
- }
417
- ]
259
+ f1: true,
418
260
  });
419
261
  }
420
- async run(accessor) {
421
- if (that.isNewProfilesUIEnabled()) {
422
- return that.openProfilesEditor();
423
- }
424
- else {
425
- return that.userDataProfileImportExportService.exportProfile2();
426
- }
262
+ async run() {
263
+ const editor = await that.openProfilesEditor();
264
+ editor?.selectProfile(that.userDataProfileService.currentProfile);
427
265
  }
428
266
  }));
429
267
  disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarShare, {
430
268
  command: {
431
269
  id,
432
270
  title: ( localize2(
433
- 8830,
271
+ 8868,
434
272
  "Export Profile ({0})...",
435
273
  that.userDataProfileService.currentProfile.name
436
274
  )),
@@ -439,121 +277,21 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
439
277
  }));
440
278
  return disposables;
441
279
  }
442
- registerImportProfileAction() {
443
- const disposables = ( (new DisposableStore()));
444
- const id = 'workbench.profiles.actions.importProfile';
445
- const that = this;
446
- disposables.add(registerAction2(class ImportProfileAction extends Action2 {
447
- constructor() {
448
- super({
449
- id,
450
- title: ( localize2(8831, "Import Profile...")),
451
- category: PROFILES_CATEGORY,
452
- precondition: ( (IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT.toNegated())),
453
- menu: [
454
- {
455
- id: ProfilesMenu,
456
- group: '4_import_export_profiles',
457
- when: ( (ContextKeyExpr.and(
458
- PROFILES_ENABLEMENT_CONTEXT,
459
- (CONTEXT_ENABLE_NEW_PROFILES_UI.negate())
460
- ))),
461
- order: 2
462
- }, {
463
- id: MenuId.CommandPalette,
464
- when: PROFILES_ENABLEMENT_CONTEXT,
465
- }
466
- ]
467
- });
468
- }
469
- async run(accessor) {
470
- const fileDialogService = accessor.get(IFileDialogService);
471
- const quickInputService = accessor.get(IQuickInputService);
472
- const userDataProfileImportExportService = accessor.get(IUserDataProfileImportExportService);
473
- const notificationService = accessor.get(INotificationService);
474
- const disposables = ( (new DisposableStore()));
475
- const quickPick = disposables.add(quickInputService.createQuickPick());
476
- const profileTemplateQuickPickItems = await that.getProfileTemplatesQuickPickItems();
477
- const updateQuickPickItems = (value) => {
478
- const quickPickItems = [];
479
- if (value) {
480
- quickPickItems.push({ label: quickPick.value, description: ( localize(8832, "Import from URL")) });
481
- }
482
- quickPickItems.push({ label: ( localize(8833, "Select File...")) });
483
- if (profileTemplateQuickPickItems.length) {
484
- quickPickItems.push({
485
- type: 'separator',
486
- label: ( localize(8834, "Profile Templates"))
487
- }, ...profileTemplateQuickPickItems);
488
- }
489
- quickPick.items = quickPickItems;
490
- };
491
- quickPick.title = ( localize(8835, "Import from Profile Template..."));
492
- quickPick.placeholder = ( localize(8836, "Provide Profile Template URL"));
493
- quickPick.ignoreFocusOut = true;
494
- disposables.add(quickPick.onDidChangeValue(updateQuickPickItems));
495
- updateQuickPickItems();
496
- quickPick.matchOnLabel = false;
497
- quickPick.matchOnDescription = false;
498
- disposables.add(quickPick.onDidAccept(async () => {
499
- quickPick.hide();
500
- const selectedItem = quickPick.selectedItems[0];
501
- if (!selectedItem) {
502
- return;
503
- }
504
- try {
505
- if (selectedItem.url) {
506
- return await that.userDataProfileImportExportService.createProfile(( (URI.parse(selectedItem.url))));
507
- }
508
- const profile = selectedItem.label === quickPick.value ? ( (URI.parse(quickPick.value))) : await this.getProfileUriFromFileSystem(fileDialogService);
509
- if (profile) {
510
- await userDataProfileImportExportService.importProfile(profile);
511
- }
512
- }
513
- catch (error) {
514
- notificationService.error(( localize(8837, "Error while creating profile: {0}", getErrorMessage(error))));
515
- }
516
- }));
517
- disposables.add(quickPick.onDidHide(() => disposables.dispose()));
518
- quickPick.show();
519
- }
520
- async getProfileUriFromFileSystem(fileDialogService) {
521
- const profileLocation = await fileDialogService.showOpenDialog({
522
- canSelectFolders: false,
523
- canSelectFiles: true,
524
- canSelectMany: false,
525
- filters: PROFILE_FILTER,
526
- title: ( localize(8838, "Select Profile Template File")),
527
- });
528
- if (!profileLocation) {
529
- return null;
530
- }
531
- return profileLocation[0];
532
- }
533
- }));
534
- disposables.add(MenuRegistry.appendMenuItem(MenuId.MenubarShare, {
535
- command: {
536
- id,
537
- title: ( localize2(8839, "Import Profile...")),
538
- precondition: PROFILES_ENABLEMENT_CONTEXT,
539
- },
540
- }));
541
- return disposables;
542
- }
543
280
  registerCreateFromCurrentProfileAction() {
544
281
  const that = this;
545
282
  this._register(registerAction2(class CreateFromCurrentProfileAction extends Action2 {
546
283
  constructor() {
547
284
  super({
548
285
  id: 'workbench.profiles.actions.createFromCurrentProfile',
549
- title: ( localize2(8840, "Save Current Profile As...")),
286
+ title: ( localize2(8869, "Save Current Profile As...")),
550
287
  category: PROFILES_CATEGORY,
551
288
  f1: true,
552
289
  precondition: PROFILES_ENABLEMENT_CONTEXT
553
290
  });
554
291
  }
555
- run(accessor) {
556
- return that.userDataProfileImportExportService.createProfile(that.userDataProfileService.currentProfile);
292
+ async run() {
293
+ const editor = await that.openProfilesEditor();
294
+ editor?.createNewProfile(that.userDataProfileService.currentProfile);
557
295
  }
558
296
  }));
559
297
  }
@@ -563,20 +301,11 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
563
301
  constructor() {
564
302
  super({
565
303
  id: 'workbench.profiles.actions.createProfile',
566
- title: ( localize2(8841, "New Profile...")),
304
+ title: ( localize2(8870, "New Profile...")),
567
305
  category: PROFILES_CATEGORY,
568
306
  precondition: PROFILES_ENABLEMENT_CONTEXT,
569
307
  f1: true,
570
308
  menu: [
571
- {
572
- id: ProfilesMenu,
573
- group: '3_manage_profiles',
574
- when: ( (ContextKeyExpr.and(
575
- PROFILES_ENABLEMENT_CONTEXT,
576
- (CONTEXT_ENABLE_NEW_PROFILES_UI.negate())
577
- ))),
578
- order: 1
579
- },
580
309
  {
581
310
  id: OpenProfileMenu,
582
311
  group: '1_manage_profiles',
@@ -586,13 +315,8 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
586
315
  });
587
316
  }
588
317
  async run(accessor) {
589
- if (that.isNewProfilesUIEnabled()) {
590
- const editor = await that.openProfilesEditor();
591
- return editor?.createNewProfile();
592
- }
593
- else {
594
- return that.userDataProfileImportExportService.createProfile();
595
- }
318
+ const editor = await that.openProfilesEditor();
319
+ return editor?.createNewProfile();
596
320
  }
597
321
  }));
598
322
  }
@@ -601,21 +325,10 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
601
325
  constructor() {
602
326
  super({
603
327
  id: 'workbench.profiles.actions.deleteProfile',
604
- title: ( localize2(8842, "Delete Profile...")),
328
+ title: ( localize2(8871, "Delete Profile...")),
605
329
  category: PROFILES_CATEGORY,
606
330
  f1: true,
607
331
  precondition: ( (ContextKeyExpr.and(PROFILES_ENABLEMENT_CONTEXT, HAS_PROFILES_CONTEXT))),
608
- menu: [
609
- {
610
- id: ProfilesMenu,
611
- group: '3_manage_profiles',
612
- when: ( (ContextKeyExpr.and(
613
- PROFILES_ENABLEMENT_CONTEXT,
614
- (CONTEXT_ENABLE_NEW_PROFILES_UI.negate())
615
- ))),
616
- order: 2
617
- }
618
- ]
619
332
  });
620
333
  }
621
334
  async run(accessor) {
@@ -628,11 +341,11 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
628
341
  if (profiles.length) {
629
342
  const picks = await quickInputService.pick(( (profiles.map(profile => ({
630
343
  label: profile.name,
631
- description: profile.id === userDataProfileService.currentProfile.id ? ( localize(8843, "Current")) : undefined,
344
+ description: profile.id === userDataProfileService.currentProfile.id ? ( localize(8872, "Current")) : undefined,
632
345
  profile
633
346
  })))), {
634
- title: ( localize(8844, "Delete Profile...")),
635
- placeHolder: ( localize(8845, "Select Profiles to Delete")),
347
+ title: ( localize(8873, "Delete Profile...")),
348
+ placeHolder: ( localize(8874, "Select Profiles to Delete")),
636
349
  canPickMany: true
637
350
  });
638
351
  if (picks) {
@@ -664,17 +377,6 @@ let UserDataProfilesWorkbenchContribution = class UserDataProfilesWorkbenchContr
664
377
  }
665
378
  }));
666
379
  }
667
- async getProfileTemplatesQuickPickItems() {
668
- const quickPickItems = [];
669
- const profileTemplates = await this.userDataProfileManagementService.getBuiltinProfileTemplates();
670
- for (const template of profileTemplates) {
671
- quickPickItems.push({
672
- label: template.name,
673
- ...template
674
- });
675
- }
676
- return quickPickItems;
677
- }
678
380
  async reportWorkspaceProfileInfo() {
679
381
  await this.lifecycleService.when(LifecyclePhase.Eventually);
680
382
  const workspaceId = await this.workspaceTagsService.getTelemetryWorkspaceId(this.workspaceContextService.getWorkspace(), this.workspaceContextService.getWorkbenchState());
@@ -688,16 +390,15 @@ UserDataProfilesWorkbenchContribution = ( (__decorate([
688
390
  ( (__param(0, IUserDataProfileService))),
689
391
  ( (__param(1, IUserDataProfilesService))),
690
392
  ( (__param(2, IUserDataProfileManagementService))),
691
- ( (__param(3, IUserDataProfileImportExportService))),
692
- ( (__param(4, ITelemetryService))),
693
- ( (__param(5, IWorkspaceContextService))),
694
- ( (__param(6, IWorkspaceTagsService))),
695
- ( (__param(7, IContextKeyService))),
696
- ( (__param(8, IConfigurationService))),
697
- ( (__param(9, IEditorGroupsService))),
698
- ( (__param(10, IInstantiationService))),
699
- ( (__param(11, IProductService))),
700
- ( (__param(12, ILifecycleService)))
393
+ ( (__param(3, ITelemetryService))),
394
+ ( (__param(4, IWorkspaceContextService))),
395
+ ( (__param(5, IWorkspaceTagsService))),
396
+ ( (__param(6, IContextKeyService))),
397
+ ( (__param(7, IEditorGroupsService))),
398
+ ( (__param(8, IInstantiationService))),
399
+ ( (__param(9, ILifecycleService))),
400
+ ( (__param(10, IURLService))),
401
+ ( (__param(11, IBrowserWorkbenchEnvironmentService)))
701
402
  ], UserDataProfilesWorkbenchContribution)));
702
403
 
703
404
  export { OpenProfileMenu, UserDataProfilesWorkbenchContribution };