@codingame/monaco-vscode-user-data-profile-service-override 9.0.3 → 10.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 (30) hide show
  1. package/_virtual/semver.js +5 -0
  2. package/package.json +2 -2
  3. package/userDataProfile.js +10 -5
  4. package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +10 -8
  5. package/vscode/src/vs/platform/userDataSync/common/extensionsMerge.js +1 -1
  6. package/vscode/src/vs/platform/userDataSync/common/extensionsSync.js +20 -20
  7. package/vscode/src/vs/platform/userDataSync/common/globalStateSync.js +25 -26
  8. package/vscode/src/vs/platform/userDataSync/common/keybindingsSync.js +27 -28
  9. package/vscode/src/vs/platform/userDataSync/common/settingsSync.js +21 -24
  10. package/vscode/src/vs/platform/userDataSync/common/snippetsSync.js +40 -40
  11. package/vscode/src/vs/platform/userDataSync/common/tasksSync.js +14 -14
  12. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
  13. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.js +2 -2
  14. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +26 -24
  15. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +3 -3
  16. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +577 -138
  17. package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +242 -103
  18. package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +1 -2
  19. package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +11 -11
  20. package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +9 -11
  21. package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +5 -6
  22. package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +7 -8
  23. package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +5 -6
  24. package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +5 -6
  25. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +44 -46
  26. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +7 -9
  27. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +75 -34
  28. package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +3 -4
  29. package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +13 -15
  30. package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +0 -1
@@ -5,13 +5,14 @@ import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
5
5
  import { localize } from 'vscode/vscode/vs/nls';
6
6
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
7
7
  import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
8
- import { ProfileResourceType, isUserDataProfile, toUserDataProfile } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
8
+ import { isUserDataProfile, toUserDataProfile } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
9
9
  import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
10
10
  import { isProfileURL } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
11
11
  import { IUserDataProfileManagementService, IUserDataProfileService, IUserDataProfileImportExportService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
12
- import { Disposable, toDisposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
12
+ import { Disposable, DisposableStore, toDisposable } from 'vscode/vscode/vs/base/common/lifecycle';
13
13
  import { URI } from 'vscode/vscode/vs/base/common/uri';
14
- import { equals } from 'vscode/vscode/vs/base/common/objects';
14
+ import { equals } from 'vscode/vscode/vs/base/common/arrays';
15
+ import { equals as equals$1 } from 'vscode/vscode/vs/base/common/objects';
15
16
  import { EditorModel } from 'vscode/vscode/vs/workbench/common/editor/editorModel';
16
17
  import { ExtensionsResourceExportTreeItem, ExtensionsResourceImportTreeItem } from '../../../services/userDataProfile/browser/extensionsResource.js';
17
18
  import { SettingsResourceTreeItem, SettingsResource } from '../../../services/userDataProfile/browser/settingsResource.js';
@@ -31,11 +32,17 @@ import { SIDE_GROUP } from 'vscode/vscode/vs/workbench/services/editor/common/ed
31
32
  import { ICommandService } from 'vscode/vscode/vs/platform/commands/common/commands.service';
32
33
  import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
33
34
  import { CONFIG_NEW_WINDOW_PROFILE } from 'vscode/vscode/vs/workbench/common/configuration';
34
- import { ResourceMap } from 'vscode/vscode/vs/base/common/map';
35
+ import { ResourceSet, ResourceMap } from 'vscode/vscode/vs/base/common/map';
35
36
  import { getErrorMessage } from 'vscode/vscode/vs/base/common/errors';
36
37
  import { isWeb } from 'vscode/vscode/vs/base/common/platform';
37
38
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
38
39
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
40
+ import { WORKSPACE_SUFFIX } from 'vscode/vscode/vs/platform/workspace/common/workspace';
41
+ import { IWorkspaceContextService } from 'vscode/vscode/vs/platform/workspace/common/workspace.service';
42
+ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service';
43
+ import { isString } from 'vscode/vscode/vs/base/common/types';
44
+ import { IWorkbenchExtensionManagementService } from 'vscode/vscode/vs/workbench/services/extensionManagement/common/extensionManagement.service';
45
+ import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
39
46
 
40
47
  var UserDataProfilesEditorModel_1;
41
48
  function isProfileResourceTypeElement(element) {
@@ -45,11 +52,16 @@ function isProfileResourceChildElement(element) {
45
52
  return element.label !== undefined;
46
53
  }
47
54
  let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extends Disposable {
48
- constructor(name, icon, flags, isActive, userDataProfileManagementService, userDataProfilesService, commandService, instantiationService) {
55
+ constructor(name, icon, flags, workspaces, isActive, userDataProfileManagementService, userDataProfilesService, commandService, workspaceContextService, hostService, uriIdentityService, fileService, extensionManagementService, instantiationService) {
49
56
  super();
50
57
  this.userDataProfileManagementService = userDataProfileManagementService;
51
58
  this.userDataProfilesService = userDataProfilesService;
52
59
  this.commandService = commandService;
60
+ this.workspaceContextService = workspaceContextService;
61
+ this.hostService = hostService;
62
+ this.uriIdentityService = uriIdentityService;
63
+ this.fileService = fileService;
64
+ this.extensionManagementService = extensionManagementService;
53
65
  this.instantiationService = instantiationService;
54
66
  this._onDidChange = this._register(( (new Emitter())));
55
67
  this.onDidChange = this._onDidChange.event;
@@ -60,6 +72,7 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
60
72
  this._name = name;
61
73
  this._icon = icon;
62
74
  this._flags = flags;
75
+ this._workspaces = workspaces;
63
76
  this._active = isActive;
64
77
  this._register(this.onDidChange(e => {
65
78
  if (!e.message) {
@@ -67,6 +80,26 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
67
80
  }
68
81
  this.save();
69
82
  }));
83
+ this._register(this.extensionManagementService.onProfileAwareDidInstallExtensions(results => {
84
+ const profile = this.getProfileToWatch();
85
+ if (profile && ( (results.some(
86
+ r => !r.error && (r.applicationScoped || this.uriIdentityService.extUri.isEqual(r.profileLocation, profile.extensionsResource))
87
+ )))) {
88
+ this._onDidChange.fire({ extensions: true });
89
+ }
90
+ }));
91
+ this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(e => {
92
+ const profile = this.getProfileToWatch();
93
+ if (profile && !e.error && (e.applicationScoped || this.uriIdentityService.extUri.isEqual(e.profileLocation, profile.extensionsResource))) {
94
+ this._onDidChange.fire({ extensions: true });
95
+ }
96
+ }));
97
+ this._register(this.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata(e => {
98
+ const profile = this.getProfileToWatch();
99
+ if (profile && e.local.isApplicationScoped || this.uriIdentityService.extUri.isEqual(e.profileLocation, profile?.extensionsResource)) {
100
+ this._onDidChange.fire({ extensions: true });
101
+ }
102
+ }));
70
103
  }
71
104
  get name() { return this._name; }
72
105
  set name(name) {
@@ -83,9 +116,16 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
83
116
  this._onDidChange.fire({ icon: true });
84
117
  }
85
118
  }
119
+ get workspaces() { return this._workspaces; }
120
+ set workspaces(workspaces) {
121
+ if (!equals(this._workspaces, workspaces, (a, b) => ( (a.toString())) === ( (b.toString())))) {
122
+ this._workspaces = workspaces;
123
+ this._onDidChange.fire({ workspaces: true });
124
+ }
125
+ }
86
126
  get flags() { return this._flags; }
87
127
  set flags(flags) {
88
- if (!equals(this._flags, flags)) {
128
+ if (!equals$1(this._flags, flags)) {
89
129
  this._flags = flags;
90
130
  this._onDidChange.fire({ flags: true });
91
131
  }
@@ -126,15 +166,15 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
126
166
  }
127
167
  validate() {
128
168
  if (!this.name) {
129
- this.message = ( localize(11488, "Profile name is required and must be a non-empty value."));
169
+ this.message = ( localize(11631, "Profile name is required and must be a non-empty value."));
130
170
  return;
131
171
  }
132
172
  if (this.shouldValidateName() && this.name !== this.getInitialName() && ( (this.userDataProfilesService.profiles.some(p => p.name === this.name)))) {
133
- this.message = ( localize(11489, "Profile with name {0} already exists.", this.name));
173
+ this.message = ( localize(11632, "Profile with name {0} already exists.", this.name));
134
174
  return;
135
175
  }
136
176
  if (this.flags && this.flags.settings && this.flags.keybindings && this.flags.tasks && this.flags.snippets && this.flags.extensions) {
137
- this.message = ( localize(11490, "The profile should contain at least one configuration."));
177
+ this.message = ( localize(11633, "The profile should contain at least one configuration."));
138
178
  return;
139
179
  }
140
180
  this.message = undefined;
@@ -142,22 +182,21 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
142
182
  async getChildren(resourceType) {
143
183
  if (resourceType === undefined) {
144
184
  const resourceTypes = [
145
- ProfileResourceType.Settings,
146
- ProfileResourceType.Keybindings,
147
- ProfileResourceType.Tasks,
148
- ProfileResourceType.Snippets,
149
- ProfileResourceType.Extensions
185
+ "settings" ,
186
+ "keybindings" ,
187
+ "tasks" ,
188
+ "snippets" ,
189
+ "extensions"
150
190
  ];
151
191
  return Promise.all(( (resourceTypes.map(async (r) => {
152
- const children = (r === ProfileResourceType.Settings
153
- || r === ProfileResourceType.Keybindings
154
- || r === ProfileResourceType.Tasks) ? await this.getChildrenForResourceType(r) : [];
192
+ const children = ((r === "settings"
193
+ || r === "keybindings" || r === "tasks") ) ? await this.getChildrenForResourceType(r) : [];
155
194
  return {
156
195
  handle: r,
157
196
  checkbox: undefined,
158
197
  resourceType: r,
159
- action: children.length
160
- ? ( (new Action('_open', ( localize(11491, "Open to the Side")), ThemeIcon.asClassName(Codicon.goToFile), true, () => children[0]?.action?.run())))
198
+ openAction: children.length
199
+ ? ( (new Action('_open', ( localize(11634, "Open to the Side")), ThemeIcon.asClassName(Codicon.goToFile), true, () => children[0]?.openAction?.run())))
161
200
  : undefined
162
201
  };
163
202
  }))));
@@ -171,19 +210,19 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
171
210
  profile = this.getFlag(resourceType) ? this.userDataProfilesService.defaultProfile : profile;
172
211
  let children = [];
173
212
  switch (resourceType) {
174
- case ProfileResourceType.Settings:
213
+ case "settings" :
175
214
  children = await this.instantiationService.createInstance(SettingsResourceTreeItem, profile).getChildren();
176
215
  break;
177
- case ProfileResourceType.Keybindings:
216
+ case "keybindings" :
178
217
  children = await this.instantiationService.createInstance(KeybindingsResourceTreeItem, profile).getChildren();
179
218
  break;
180
- case ProfileResourceType.Snippets:
219
+ case "snippets" :
181
220
  children = (await this.instantiationService.createInstance(SnippetsResourceTreeItem, profile).getChildren()) ?? [];
182
221
  break;
183
- case ProfileResourceType.Tasks:
222
+ case "tasks" :
184
223
  children = await this.instantiationService.createInstance(TasksResourceTreeItem, profile).getChildren();
185
224
  break;
186
- case ProfileResourceType.Extensions:
225
+ case "extensions" :
187
226
  children = await this.instantiationService.createInstance(ExtensionsResourceExportTreeItem, profile).getChildren();
188
227
  break;
189
228
  }
@@ -191,21 +230,26 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
191
230
  (children.map(child => this.toUserDataProfileResourceChildElement(child)))
192
231
  );
193
232
  }
194
- toUserDataProfileResourceChildElement(child) {
233
+ toUserDataProfileResourceChildElement(child, primaryActions, contextMenuActions) {
195
234
  return {
196
235
  handle: child.handle,
197
236
  checkbox: child.checkbox,
198
237
  label: child.label?.label ?? '',
238
+ description: isString(child.description) ? child.description : undefined,
199
239
  resource: URI.revive(child.resourceUri),
200
240
  icon: child.themeIcon,
201
- action: ( (new Action('_openChild', ( localize(11491, "Open to the Side")), ThemeIcon.asClassName(Codicon.goToFile), true, async () => {
202
- if (child.parent.type === ProfileResourceType.Extensions) {
241
+ openAction: ( (new Action('_openChild', ( localize(11634, "Open to the Side")), ThemeIcon.asClassName(Codicon.goToFile), true, async () => {
242
+ if (child.parent.type === "extensions" ) {
203
243
  await this.commandService.executeCommand('extension.open', child.handle, undefined, true, undefined, true);
204
244
  }
205
245
  else if (child.resourceUri) {
206
246
  await this.commandService.executeCommand(API_OPEN_EDITOR_COMMAND_ID, child.resourceUri, [SIDE_GROUP], undefined);
207
247
  }
208
- })))
248
+ }))),
249
+ actions: {
250
+ primary: primaryActions,
251
+ contextMenu: contextMenuActions,
252
+ }
209
253
  };
210
254
  }
211
255
  getInitialName() {
@@ -214,6 +258,18 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
214
258
  shouldValidateName() {
215
259
  return true;
216
260
  }
261
+ getCurrentWorkspace() {
262
+ const workspace = this.workspaceContextService.getWorkspace();
263
+ return workspace.configuration ?? workspace.folders[0]?.uri;
264
+ }
265
+ openWorkspace(workspace) {
266
+ if (this.uriIdentityService.extUri.extname(workspace) === WORKSPACE_SUFFIX) {
267
+ this.hostService.openWindow([{ workspaceUri: workspace }], { forceNewWindow: true });
268
+ }
269
+ else {
270
+ this.hostService.openWindow([{ folderUri: workspace }], { forceNewWindow: true });
271
+ }
272
+ }
217
273
  save() {
218
274
  this.saveScheduler.schedule();
219
275
  }
@@ -224,7 +280,10 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
224
280
  if (this.icon !== profile.icon) {
225
281
  return true;
226
282
  }
227
- if (!equals(this.flags ?? {}, profile.useDefaultFlags ?? {})) {
283
+ if (!equals$1(this.flags ?? {}, profile.useDefaultFlags ?? {})) {
284
+ return true;
285
+ }
286
+ if (!equals(this.workspaces ?? [], profile.workspaces ?? [], (a, b) => ( (a.toString())) === ( (b.toString())))) {
228
287
  return true;
229
288
  }
230
289
  return false;
@@ -243,20 +302,26 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
243
302
  return await this.userDataProfileManagementService.updateProfile(profile, {
244
303
  name: this.name,
245
304
  icon: this.icon,
246
- useDefaultFlags: profile.useDefaultFlags && !useDefaultFlags ? {} : useDefaultFlags
305
+ useDefaultFlags: profile.useDefaultFlags && !useDefaultFlags ? {} : useDefaultFlags,
306
+ workspaces: this.workspaces
247
307
  });
248
308
  }
249
309
  };
250
310
  AbstractUserDataProfileElement = ( (__decorate([
251
- ( (__param(4, IUserDataProfileManagementService))),
252
- ( (__param(5, IUserDataProfilesService))),
253
- ( (__param(6, ICommandService))),
254
- ( (__param(7, IInstantiationService)))
311
+ ( (__param(5, IUserDataProfileManagementService))),
312
+ ( (__param(6, IUserDataProfilesService))),
313
+ ( (__param(7, ICommandService))),
314
+ ( (__param(8, IWorkspaceContextService))),
315
+ ( (__param(9, IHostService))),
316
+ ( (__param(10, IUriIdentityService))),
317
+ ( (__param(11, IFileService))),
318
+ ( (__param(12, IWorkbenchExtensionManagementService))),
319
+ ( (__param(13, IInstantiationService)))
255
320
  ], AbstractUserDataProfileElement)));
256
321
  let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDataProfileElement {
257
322
  get profile() { return this._profile; }
258
- constructor(_profile, titleButtons, actions, userDataProfileService, configurationService, userDataProfileManagementService, userDataProfilesService, commandService, instantiationService) {
259
- super(_profile.name, _profile.icon, _profile.useDefaultFlags, userDataProfileService.currentProfile.id === _profile.id, userDataProfileManagementService, userDataProfilesService, commandService, instantiationService);
323
+ constructor(_profile, titleButtons, actions, userDataProfileService, configurationService, userDataProfileManagementService, userDataProfilesService, commandService, workspaceContextService, hostService, uriIdentityService, fileService, extensionManagementService, instantiationService) {
324
+ super(_profile.name, _profile.icon, _profile.useDefaultFlags, _profile.workspaces, userDataProfileService.currentProfile.id === _profile.id, userDataProfileManagementService, userDataProfilesService, commandService, workspaceContextService, hostService, uriIdentityService, fileService, extensionManagementService, instantiationService);
260
325
  this._profile = _profile;
261
326
  this.titleButtons = titleButtons;
262
327
  this.actions = actions;
@@ -278,11 +343,31 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
278
343
  this._onDidChange.fire({ profile: true });
279
344
  }
280
345
  }));
346
+ this._register(fileService.watch(this.profile.snippetsHome));
347
+ this._register(fileService.onDidFilesChange(e => {
348
+ if (e.affects(this.profile.snippetsHome)) {
349
+ this._onDidChange.fire({ snippets: true });
350
+ }
351
+ }));
352
+ }
353
+ getProfileToWatch() {
354
+ return this.profile;
281
355
  }
282
356
  reset() {
283
357
  this.name = this._profile.name;
284
358
  this.icon = this._profile.icon;
285
359
  this.flags = this._profile.useDefaultFlags;
360
+ this.workspaces = this._profile.workspaces;
361
+ }
362
+ updateWorkspaces(toAdd, toRemove) {
363
+ const workspaces = ( (new ResourceSet(this.workspaces ?? [])));
364
+ for (const workspace of toAdd) {
365
+ workspaces.add(workspace);
366
+ }
367
+ for (const workspace of toRemove) {
368
+ workspaces.delete(workspace);
369
+ }
370
+ this.workspaces = [...( (workspaces.values()))];
286
371
  }
287
372
  async toggleNewWindowProfile() {
288
373
  if (this._isNewWindowProfile) {
@@ -311,6 +396,26 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
311
396
  await this.saveProfile(this.profile);
312
397
  }
313
398
  async getChildrenForResourceType(resourceType) {
399
+ if (resourceType === "extensions" ) {
400
+ const children = await this.instantiationService.createInstance(ExtensionsResourceExportTreeItem, this.profile).getChildren();
401
+ return (
402
+ (children.map(child => this.toUserDataProfileResourceChildElement(child, undefined, [{
403
+ id: 'applyToAllProfiles',
404
+ label: ( localize(11635, "Apply Extension to all Profiles")),
405
+ checked: child.applicationScoped,
406
+ enabled: true,
407
+ class: '',
408
+ tooltip: '',
409
+ run: async () => {
410
+ const extensions = await this.extensionManagementService.getInstalled(undefined, this.profile.extensionsResource);
411
+ const extension = extensions.find(e => areSameExtensions(e.identifier, child.identifier));
412
+ if (extension) {
413
+ await this.extensionManagementService.toggleAppliationScope(extension, this.profile.extensionsResource);
414
+ }
415
+ }
416
+ }])))
417
+ );
418
+ }
314
419
  return this.getChildrenFromProfile(this.profile, resourceType);
315
420
  }
316
421
  getInitialName() {
@@ -323,24 +428,34 @@ UserDataProfileElement = ( (__decorate([
323
428
  ( (__param(5, IUserDataProfileManagementService))),
324
429
  ( (__param(6, IUserDataProfilesService))),
325
430
  ( (__param(7, ICommandService))),
326
- ( (__param(8, IInstantiationService)))
431
+ ( (__param(8, IWorkspaceContextService))),
432
+ ( (__param(9, IHostService))),
433
+ ( (__param(10, IUriIdentityService))),
434
+ ( (__param(11, IFileService))),
435
+ ( (__param(12, IWorkbenchExtensionManagementService))),
436
+ ( (__param(13, IInstantiationService)))
327
437
  ], UserDataProfileElement)));
328
438
  const USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME = 'userdataprofiletemplatepreview';
329
439
  let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileElement {
330
440
  get copyFromTemplates() { return this._copyFromTemplates; }
331
- constructor(name, copyFrom, titleButtons, actions, fileService, userDataProfileImportExportService, userDataProfileManagementService, userDataProfilesService, commandService, instantiationService) {
332
- super(name, undefined, undefined, false, userDataProfileManagementService, userDataProfilesService, commandService, instantiationService);
441
+ constructor(name, copyFrom, titleButtons, actions, userDataProfileImportExportService, userDataProfileManagementService, userDataProfilesService, commandService, workspaceContextService, hostService, uriIdentityService, fileService, extensionManagementService, instantiationService) {
442
+ super(name, undefined, undefined, undefined, false, userDataProfileManagementService, userDataProfilesService, commandService, workspaceContextService, hostService, uriIdentityService, fileService, extensionManagementService, instantiationService);
333
443
  this.titleButtons = titleButtons;
334
444
  this.actions = actions;
335
- this.fileService = fileService;
336
445
  this.userDataProfileImportExportService = userDataProfileImportExportService;
337
446
  this._copyFromTemplates = ( (new ResourceMap()));
338
447
  this.template = null;
448
+ this.previewProfileWatchDisposables = this._register(( (new DisposableStore())));
339
449
  this.defaultName = name;
340
450
  this._copyFrom = copyFrom;
341
451
  this._copyFlags = this.getCopyFlagsFrom(copyFrom);
342
452
  this.initialize();
343
453
  this._register(this.fileService.registerProvider(USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME, this._register(( (new InMemoryFileSystemProvider())))));
454
+ this._register(toDisposable(() => {
455
+ if (this.previewProfile) {
456
+ this.userDataProfilesService.removeProfile(this.previewProfile);
457
+ }
458
+ }));
344
459
  }
345
460
  get copyFrom() { return this._copyFrom; }
346
461
  set copyFrom(copyFrom) {
@@ -358,7 +473,7 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
358
473
  }
359
474
  get copyFlags() { return this._copyFlags; }
360
475
  set copyFlags(flags) {
361
- if (!equals(this._copyFlags, flags)) {
476
+ if (!equals$1(this._copyFlags, flags)) {
362
477
  this._copyFlags = flags;
363
478
  this._onDidChange.fire({ copyFlags: true });
364
479
  }
@@ -368,8 +483,23 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
368
483
  if (this._previewProfile !== profile) {
369
484
  this._previewProfile = profile;
370
485
  this._onDidChange.fire({ preview: true });
486
+ this.previewProfileWatchDisposables.clear();
487
+ if (this._previewProfile) {
488
+ this.previewProfileWatchDisposables.add(this.fileService.watch(this._previewProfile.snippetsHome));
489
+ this.previewProfileWatchDisposables.add(this.fileService.onDidFilesChange(e => {
490
+ if (!this._previewProfile) {
491
+ return;
492
+ }
493
+ if (e.affects(this._previewProfile.snippetsHome)) {
494
+ this._onDidChange.fire({ snippets: true });
495
+ }
496
+ }));
497
+ }
371
498
  }
372
499
  }
500
+ getProfileToWatch() {
501
+ return this.previewProfile;
502
+ }
373
503
  getCopyFlagsFrom(copyFrom) {
374
504
  return copyFrom ? {
375
505
  settings: true,
@@ -392,41 +522,41 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
392
522
  if (this.defaultIcon === this.icon) {
393
523
  this.icon = this.defaultIcon = this.template.icon;
394
524
  }
395
- this.setCopyFlag(ProfileResourceType.Settings, !!this.template.settings);
396
- this.setCopyFlag(ProfileResourceType.Keybindings, !!this.template.keybindings);
397
- this.setCopyFlag(ProfileResourceType.Tasks, !!this.template.tasks);
398
- this.setCopyFlag(ProfileResourceType.Snippets, !!this.template.snippets);
399
- this.setCopyFlag(ProfileResourceType.Extensions, !!this.template.extensions);
525
+ this.setCopyFlag("settings" , !!this.template.settings);
526
+ this.setCopyFlag("keybindings" , !!this.template.keybindings);
527
+ this.setCopyFlag("tasks" , !!this.template.tasks);
528
+ this.setCopyFlag("snippets" , !!this.template.snippets);
529
+ this.setCopyFlag("extensions" , !!this.template.extensions);
400
530
  this._onDidChange.fire({ copyFromInfo: true });
401
531
  }
402
532
  return;
403
533
  }
404
534
  if (isUserDataProfile(this.copyFrom)) {
405
535
  if (this.defaultName === this.name) {
406
- this.name = this.defaultName = ( localize(11492, "{0} (Copy)", this.copyFrom.name));
536
+ this.name = this.defaultName = ( localize(11636, "{0} (Copy)", this.copyFrom.name));
407
537
  }
408
538
  if (this.defaultIcon === this.icon) {
409
539
  this.icon = this.defaultIcon = this.copyFrom.icon;
410
540
  }
411
- this.setCopyFlag(ProfileResourceType.Settings, true);
412
- this.setCopyFlag(ProfileResourceType.Keybindings, true);
413
- this.setCopyFlag(ProfileResourceType.Tasks, true);
414
- this.setCopyFlag(ProfileResourceType.Snippets, true);
415
- this.setCopyFlag(ProfileResourceType.Extensions, true);
541
+ this.setCopyFlag("settings" , true);
542
+ this.setCopyFlag("keybindings" , true);
543
+ this.setCopyFlag("tasks" , true);
544
+ this.setCopyFlag("snippets" , true);
545
+ this.setCopyFlag("extensions" , true);
416
546
  this._onDidChange.fire({ copyFromInfo: true });
417
547
  return;
418
548
  }
419
549
  if (this.defaultName === this.name) {
420
- this.name = this.defaultName = ( localize(11493, "Untitled"));
550
+ this.name = this.defaultName = ( localize(11637, "Untitled"));
421
551
  }
422
552
  if (this.defaultIcon === this.icon) {
423
553
  this.icon = this.defaultIcon = undefined;
424
554
  }
425
- this.setCopyFlag(ProfileResourceType.Settings, false);
426
- this.setCopyFlag(ProfileResourceType.Keybindings, false);
427
- this.setCopyFlag(ProfileResourceType.Tasks, false);
428
- this.setCopyFlag(ProfileResourceType.Snippets, false);
429
- this.setCopyFlag(ProfileResourceType.Extensions, false);
555
+ this.setCopyFlag("settings" , false);
556
+ this.setCopyFlag("keybindings" , false);
557
+ this.setCopyFlag("tasks" , false);
558
+ this.setCopyFlag("snippets" , false);
559
+ this.setCopyFlag("extensions" , false);
430
560
  this._onDidChange.fire({ copyFromInfo: true });
431
561
  }
432
562
  finally {
@@ -448,15 +578,15 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
448
578
  hasResource(resourceType) {
449
579
  if (this.template) {
450
580
  switch (resourceType) {
451
- case ProfileResourceType.Settings:
581
+ case "settings" :
452
582
  return !!this.template.settings;
453
- case ProfileResourceType.Keybindings:
583
+ case "keybindings" :
454
584
  return !!this.template.keybindings;
455
- case ProfileResourceType.Snippets:
585
+ case "snippets" :
456
586
  return !!this.template.snippets;
457
- case ProfileResourceType.Tasks:
587
+ case "tasks" :
458
588
  return !!this.template.tasks;
459
- case ProfileResourceType.Extensions:
589
+ case "extensions" :
460
590
  return !!this.template.extensions;
461
591
  }
462
592
  }
@@ -486,6 +616,9 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
486
616
  if (!this.getCopyFlag(resourceType)) {
487
617
  return [];
488
618
  }
619
+ if (this.previewProfile) {
620
+ return this.getChildrenFromProfile(this.previewProfile, resourceType);
621
+ }
489
622
  if (this.copyFrom instanceof URI) {
490
623
  await this.resolveTemplate(this.copyFrom);
491
624
  if (!this.template) {
@@ -501,31 +634,31 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
501
634
  async getChildrenFromProfileTemplate(profileTemplate, resourceType) {
502
635
  const profile = toUserDataProfile(generateUuid(), this.name, URI.file('/root').with({ scheme: USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME }), URI.file('/cache').with({ scheme: USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME }));
503
636
  switch (resourceType) {
504
- case ProfileResourceType.Settings:
637
+ case "settings" :
505
638
  if (profileTemplate.settings) {
506
639
  await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
507
640
  return this.getChildrenFromProfile(profile, resourceType);
508
641
  }
509
642
  return [];
510
- case ProfileResourceType.Keybindings:
643
+ case "keybindings" :
511
644
  if (profileTemplate.keybindings) {
512
645
  await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
513
646
  return this.getChildrenFromProfile(profile, resourceType);
514
647
  }
515
648
  return [];
516
- case ProfileResourceType.Snippets:
649
+ case "snippets" :
517
650
  if (profileTemplate.snippets) {
518
651
  await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
519
652
  return this.getChildrenFromProfile(profile, resourceType);
520
653
  }
521
654
  return [];
522
- case ProfileResourceType.Tasks:
655
+ case "tasks" :
523
656
  if (profileTemplate.tasks) {
524
657
  await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
525
658
  return this.getChildrenFromProfile(profile, resourceType);
526
659
  }
527
660
  return [];
528
- case ProfileResourceType.Extensions:
661
+ case "extensions" :
529
662
  if (profileTemplate.extensions) {
530
663
  const children = await this.instantiationService.createInstance(ExtensionsResourceImportTreeItem, profileTemplate.extensions).getChildren();
531
664
  return (
@@ -552,12 +685,16 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
552
685
  }
553
686
  };
554
687
  NewProfileElement = ( (__decorate([
555
- ( (__param(4, IFileService))),
556
- ( (__param(5, IUserDataProfileImportExportService))),
557
- ( (__param(6, IUserDataProfileManagementService))),
558
- ( (__param(7, IUserDataProfilesService))),
559
- ( (__param(8, ICommandService))),
560
- ( (__param(9, IInstantiationService)))
688
+ ( (__param(4, IUserDataProfileImportExportService))),
689
+ ( (__param(5, IUserDataProfileManagementService))),
690
+ ( (__param(6, IUserDataProfilesService))),
691
+ ( (__param(7, ICommandService))),
692
+ ( (__param(8, IWorkspaceContextService))),
693
+ ( (__param(9, IHostService))),
694
+ ( (__param(10, IUriIdentityService))),
695
+ ( (__param(11, IFileService))),
696
+ ( (__param(12, IWorkbenchExtensionManagementService))),
697
+ ( (__param(13, IInstantiationService)))
561
698
  ], NewProfileElement)));
562
699
  let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends EditorModel {
563
700
  static { UserDataProfilesEditorModel_1 = this; }
@@ -638,11 +775,11 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
638
775
  }
639
776
  createProfileElement(profile) {
640
777
  const disposables = ( (new DisposableStore()));
641
- const activateAction = disposables.add(( (new Action('userDataProfile.activate', ( localize(11494, "Use this Profile for Current Window")), ThemeIcon.asClassName(Codicon.check), true, () => this.userDataProfileManagementService.switchProfile(profileElement.profile)))));
642
- const copyFromProfileAction = disposables.add(( (new Action('userDataProfile.copyFromProfile', ( localize(11495, "Duplicate...")), ThemeIcon.asClassName(Codicon.copy), true, () => this.createNewProfile(profileElement.profile)))));
643
- const exportAction = disposables.add(( (new Action('userDataProfile.export', ( localize(11496, "Export...")), ThemeIcon.asClassName(Codicon.export), true, () => this.userDataProfileImportExportService.exportProfile(profile)))));
644
- const deleteAction = disposables.add(( (new Action('userDataProfile.delete', ( localize(11497, "Delete")), ThemeIcon.asClassName(Codicon.trash), true, () => this.removeProfile(profileElement.profile)))));
645
- const newWindowAction = disposables.add(( (new Action('userDataProfile.newWindow', ( localize(11498, "Open New Window with this Profile")), ThemeIcon.asClassName(Codicon.emptyWindow), true, () => this.openWindow(profileElement.profile)))));
778
+ const activateAction = disposables.add(( (new Action('userDataProfile.activate', ( localize(11638, "Use this Profile for Current Window")), ThemeIcon.asClassName(Codicon.check), true, () => this.userDataProfileManagementService.switchProfile(profileElement.profile)))));
779
+ const copyFromProfileAction = disposables.add(( (new Action('userDataProfile.copyFromProfile', ( localize(11639, "Duplicate...")), ThemeIcon.asClassName(Codicon.copy), true, () => this.createNewProfile(profileElement.profile)))));
780
+ const exportAction = disposables.add(( (new Action('userDataProfile.export', ( localize(11640, "Export...")), ThemeIcon.asClassName(Codicon.export), true, () => this.userDataProfileImportExportService.exportProfile(profile)))));
781
+ const deleteAction = disposables.add(( (new Action('userDataProfile.delete', ( localize(11641, "Delete")), ThemeIcon.asClassName(Codicon.trash), true, () => this.removeProfile(profileElement.profile)))));
782
+ const newWindowAction = disposables.add(( (new Action('userDataProfile.newWindow', ( localize(11642, "Open New Window with this Profile")), ThemeIcon.asClassName(Codicon.emptyWindow), true, () => this.openWindow(profileElement.profile)))));
646
783
  const primaryActions = [];
647
784
  primaryActions.push(activateAction);
648
785
  primaryActions.push(newWindowAction);
@@ -663,11 +800,11 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
663
800
  const result = await this.dialogService.confirm({
664
801
  type: 'info',
665
802
  message: ( localize(
666
- 11499,
803
+ 11643,
667
804
  "A new profile is already being created. Do you want to discard it and create a new one?"
668
805
  )),
669
- primaryButton: ( localize(11500, "Discard & Create")),
670
- cancelButton: ( localize(11501, "Cancel"))
806
+ primaryButton: ( localize(11644, "Discard & Create")),
807
+ cancelButton: ( localize(11645, "Cancel"))
671
808
  });
672
809
  if (!result.confirmed) {
673
810
  return;
@@ -689,36 +826,32 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
689
826
  disposables.add(toDisposable(() => cancellationTokenSource.dispose(true)));
690
827
  const primaryActions = [];
691
828
  const secondaryActions = [];
692
- const createAction = disposables.add(( (new Action('userDataProfile.create', ( localize(11502, "Create")), undefined, true, () => this.saveNewProfile(false, cancellationTokenSource.token)))));
829
+ const createAction = disposables.add(( (new Action('userDataProfile.create', ( localize(11646, "Create")), undefined, true, () => this.saveNewProfile(false, cancellationTokenSource.token)))));
693
830
  primaryActions.push(createAction);
694
831
  if (isWeb && copyFrom instanceof URI && isProfileURL(copyFrom)) {
695
- primaryActions.push(( (new Action('userDataProfile.createInDesktop', ( localize(11503, "Create in {0}", this.productService.nameLong)), undefined, true, () => this.openerService.open(copyFrom, { openExternal: true })))));
832
+ primaryActions.push(( (new Action('userDataProfile.createInDesktop', ( localize(11647, "Create in {0}", this.productService.nameLong)), undefined, true, () => this.openerService.open(copyFrom, { openExternal: true })))));
696
833
  }
697
- const cancelAction = disposables.add(( (new Action('userDataProfile.cancel', ( localize(11501, "Cancel")), ThemeIcon.asClassName(Codicon.trash), true, () => this.discardNewProfile()))));
834
+ const cancelAction = disposables.add(( (new Action('userDataProfile.cancel', ( localize(11645, "Cancel")), ThemeIcon.asClassName(Codicon.trash), true, () => this.discardNewProfile()))));
698
835
  secondaryActions.push(cancelAction);
699
- const previewProfileAction = disposables.add(( (new Action('userDataProfile.preview', ( localize(11504, "Preview")), ThemeIcon.asClassName(Codicon.openPreview), true, () => this.previewNewProfile(cancellationTokenSource.token)))));
700
- if (!isWeb) {
701
- secondaryActions.push(previewProfileAction);
702
- }
703
- const exportAction = disposables.add(( (new Action('userDataProfile.export', ( localize(11496, "Export...")), ThemeIcon.asClassName(Codicon.export), isUserDataProfile(copyFrom), () => this.exportNewProfile(cancellationTokenSource.token)))));
704
- this.newProfileElement = disposables.add(this.instantiationService.createInstance(NewProfileElement, copyFrom ? '' : ( localize(11493, "Untitled")), copyFrom, [primaryActions, secondaryActions], [[cancelAction], [exportAction]]));
836
+ const previewProfileAction = disposables.add(( (new Action('userDataProfile.preview', ( localize(11648, "Preview")), ThemeIcon.asClassName(Codicon.openPreview), true, () => this.previewNewProfile(cancellationTokenSource.token)))));
837
+ secondaryActions.push(previewProfileAction);
838
+ const exportAction = disposables.add(( (new Action('userDataProfile.export', ( localize(11640, "Export...")), ThemeIcon.asClassName(Codicon.export), isUserDataProfile(copyFrom), () => this.exportNewProfile(cancellationTokenSource.token)))));
839
+ this.newProfileElement = disposables.add(this.instantiationService.createInstance(NewProfileElement, copyFrom ? '' : ( localize(11637, "Untitled")), copyFrom, [primaryActions, secondaryActions], [[cancelAction], [exportAction]]));
705
840
  const updateCreateActionLabel = () => {
706
841
  if (createAction.enabled) {
707
- if (this.newProfileElement?.copyFrom && ( (this.userDataProfilesService.profiles.some(p => p.name === this.newProfileElement?.name)))) {
708
- createAction.label = ( localize(11505, "Replace"));
842
+ if (this.newProfileElement?.copyFrom && ( (this.userDataProfilesService.profiles.some(p => !p.isTransient && p.name === this.newProfileElement?.name)))) {
843
+ createAction.label = ( localize(11649, "Replace"));
709
844
  }
710
845
  else {
711
- createAction.label = ( localize(11502, "Create"));
846
+ createAction.label = ( localize(11646, "Create"));
712
847
  }
713
848
  }
714
849
  };
715
850
  updateCreateActionLabel();
716
851
  disposables.add(this.newProfileElement.onDidChange(e => {
717
- if (e.preview) {
718
- previewProfileAction.checked = !!this.newProfileElement?.previewProfile;
719
- }
720
- if (e.disabled || e.message) {
721
- previewProfileAction.enabled = createAction.enabled = !this.newProfileElement?.disabled && !this.newProfileElement?.message;
852
+ if (e.preview || e.disabled || e.message) {
853
+ createAction.enabled = !this.newProfileElement?.disabled && !this.newProfileElement?.message;
854
+ previewProfileAction.enabled = !this.newProfileElement?.previewProfile && !this.newProfileElement?.disabled && !this.newProfileElement?.message;
722
855
  }
723
856
  if (e.name || e.copyFrom) {
724
857
  updateCreateActionLabel();
@@ -754,7 +887,12 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
754
887
  const profile = await this.saveNewProfile(true, token);
755
888
  if (profile) {
756
889
  this.newProfileElement.previewProfile = profile;
757
- await this.openWindow(profile);
890
+ if (isWeb) {
891
+ await this.userDataProfileManagementService.switchProfile(profile);
892
+ }
893
+ else {
894
+ await this.openWindow(profile);
895
+ }
758
896
  }
759
897
  }
760
898
  async exportNewProfile(token) {
@@ -854,6 +992,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
854
992
  }
855
993
  if (this.newProfileElement.previewProfile) {
856
994
  await this.userDataProfileManagementService.removeProfile(this.newProfileElement.previewProfile);
995
+ return;
857
996
  }
858
997
  this.removeNewProfile();
859
998
  this._onDidChange.fire(undefined);
@@ -861,9 +1000,9 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
861
1000
  async removeProfile(profile) {
862
1001
  const result = await this.dialogService.confirm({
863
1002
  type: 'info',
864
- message: ( localize(11506, "Are you sure you want to delete the profile '{0}'?", profile.name)),
865
- primaryButton: ( localize(11497, "Delete")),
866
- cancelButton: ( localize(11501, "Cancel"))
1003
+ message: ( localize(11650, "Are you sure you want to delete the profile '{0}'?", profile.name)),
1004
+ primaryButton: ( localize(11641, "Delete")),
1005
+ cancelButton: ( localize(11645, "Cancel"))
867
1006
  });
868
1007
  if (result.confirmed) {
869
1008
  await this.userDataProfileManagementService.removeProfile(profile);