@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,10 +3,8 @@ import './media/userDataProfileView.css.js';
3
3
  import { localize } from 'vscode/vscode/vs/nls';
4
4
  import 'vscode/vscode/vs/platform/instantiation/common/extensions';
5
5
  import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
6
- import { INotificationService } from 'vscode/vscode/vs/platform/notification/common/notification.service';
7
- import { Event, Emitter } from 'vscode/vscode/vs/base/common/event';
8
- import { $, append, Dimension, addDisposableListener, EventType, EventHelper, getClientArea, clearNode } from 'vscode/vscode/vs/base/browser/dom';
9
- import { IS_PROFILE_EXPORT_IN_PROGRESS_CONTEXT, IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT, PROFILES_TITLE, defaultUserDataProfileIcon, PROFILE_URL_AUTHORITY, PROFILES_CATEGORY, toUserDataProfileUri, PROFILE_FILTER, PROFILE_EXTENSION } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
6
+ import { Emitter } from 'vscode/vscode/vs/base/common/event';
7
+ import { PROFILES_CATEGORY, PROFILE_URL_AUTHORITY, toUserDataProfileUri, isProfileURL, PROFILE_URL_AUTHORITY_PREFIX, PROFILE_FILTER, PROFILE_EXTENSION } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
10
8
  import { IUserDataProfileService, IUserDataProfileManagementService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
11
9
  import { Disposable, toDisposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
12
10
  import { IDialogService, IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
@@ -14,36 +12,15 @@ import { IUriIdentityService } from 'vscode/vscode/vs/platform/uriIdentity/commo
14
12
  import { ITextFileService } from 'vscode/vscode/vs/workbench/services/textfile/common/textfiles.service';
15
13
  import { IFileService } from 'vscode/vscode/vs/platform/files/common/files.service';
16
14
  import { URI } from 'vscode/vscode/vs/base/common/uri';
17
- import { Extensions, ViewContainerLocation, TreeItemCollapsibleState } from 'vscode/vscode/vs/workbench/common/views';
18
- import { IViewDescriptorService } from 'vscode/vscode/vs/workbench/common/views.service';
19
- import { IViewsService } from 'vscode/vscode/vs/workbench/services/views/common/viewsService.service';
20
- import { isUserDataProfile, ProfileResourceType, toUserDataProfile } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile';
21
15
  import { IUserDataProfilesService } from 'vscode/vscode/vs/platform/userDataProfile/common/userDataProfile.service';
22
- import { ContextKeyExpr } from 'vscode/vscode/vs/platform/contextkey/common/contextkey';
23
- import { IContextKeyService } from 'vscode/vscode/vs/platform/contextkey/common/contextkey.service';
24
- import { Registry } from 'vscode/vscode/vs/platform/registry/common/platform';
25
- import { SyncDescriptor } from 'vscode/vscode/vs/platform/instantiation/common/descriptors';
26
- import { ViewPaneContainer } from 'vscode/vscode/vs/workbench/browser/parts/views/viewPaneContainer';
27
- import { TreeView, TreeViewPane } from 'vscode/vscode/vs/workbench/browser/parts/views/treeView';
28
16
  import { SettingsResource, SettingsResourceTreeItem } from './settingsResource.js';
29
17
  import { KeybindingsResource, KeybindingsResourceTreeItem } from './keybindingsResource.js';
30
18
  import { SnippetsResource, SnippetsResourceTreeItem } from './snippetsResource.js';
31
19
  import { TasksResource, TasksResourceTreeItem } from './tasksResource.js';
32
- import { ExtensionsResource, ExtensionsResourceTreeItem, ExtensionsResourceExportTreeItem, ExtensionsResourceImportTreeItem } from './extensionsResource.js';
33
- import { GlobalStateResource, GlobalStateResourceTreeItem, GlobalStateResourceExportTreeItem, GlobalStateResourceImportTreeItem } from './globalStateResource.js';
20
+ import { ExtensionsResource, ExtensionsResourceTreeItem, ExtensionsResourceExportTreeItem } from './extensionsResource.js';
21
+ import { GlobalStateResource, GlobalStateResourceTreeItem, GlobalStateResourceExportTreeItem } from './globalStateResource.js';
34
22
  import { InMemoryFileSystemProvider } from 'vscode/vscode/vs/platform/files/common/inMemoryFilesystemProvider';
35
- import { Button } from 'vscode/vscode/vs/base/browser/ui/button/button';
36
- import { IKeybindingService } from 'vscode/vscode/vs/platform/keybinding/common/keybinding.service';
37
- import { IContextViewService, IContextMenuService } from 'vscode/vscode/vs/platform/contextview/browser/contextView.service';
38
- import { IConfigurationService } from 'vscode/vscode/vs/platform/configuration/common/configuration.service';
39
23
  import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
40
- import { IThemeService } from 'vscode/vscode/vs/platform/theme/common/themeService.service';
41
- import { ITelemetryService } from 'vscode/vscode/vs/platform/telemetry/common/telemetry.service';
42
- import { defaultInputBoxStyles, defaultSelectBoxStyles, defaultButtonStyles } from 'vscode/vscode/vs/platform/theme/browser/defaultStyles';
43
- import { generateUuid } from 'vscode/vscode/vs/base/common/uuid';
44
- import { IEditorService } from 'vscode/vscode/vs/workbench/services/editor/common/editorService.service';
45
- import { EditorsOrder } from 'vscode/vscode/vs/workbench/common/editor';
46
- import { getErrorMessage, onUnexpectedError } from 'vscode/vscode/vs/base/common/errors';
47
24
  import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
48
25
  import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
49
26
  import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
@@ -55,34 +32,12 @@ import { Schemas } from 'vscode/vscode/vs/base/common/network';
55
32
  import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
56
33
  import Severity$1 from 'vscode/vscode/vs/base/common/severity';
57
34
  import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
58
- import { IURLService } from 'vscode/vscode/vs/platform/url/common/url.service';
59
35
  import { asText } from 'vscode/vscode/vs/platform/request/common/request';
60
36
  import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request.service';
61
37
  import { IProductService } from 'vscode/vscode/vs/platform/product/common/productService.service';
62
38
  import { isUndefined } from 'vscode/vscode/vs/base/common/types';
63
- import { Action, ActionRunner } from 'vscode/vscode/vs/base/common/actions';
64
- import { isWeb } from 'vscode/vscode/vs/base/common/platform';
65
- import { registerAction2, Action2, MenuId } from 'vscode/vscode/vs/platform/actions/common/actions';
66
- import { getAllCodicons, Codicon } from 'vscode/vscode/vs/base/common/codicons';
67
- import { createCancelablePromise, Barrier } from 'vscode/vscode/vs/base/common/async';
68
- import { IExtensionManagementService } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagement.service';
69
- import { ExtensionType } from 'vscode/vscode/vs/platform/extensions/common/extensions';
70
- import { areSameExtensions } from 'vscode/vscode/vs/platform/extensionManagement/common/extensionManagementUtil';
71
- import { MarkdownString } from 'vscode/vscode/vs/base/common/htmlContent';
72
- import { renderMarkdown } from 'vscode/vscode/vs/base/browser/markdownRenderer';
73
- import { showWindowLogActionId } from 'vscode/vscode/vs/workbench/services/log/common/logConstants';
74
- import { SelectBox } from 'vscode/vscode/vs/base/browser/ui/selectBox/selectBox';
75
- import { ThemeIcon } from 'vscode/vscode/vs/base/common/themables';
76
- import { IHoverService } from 'vscode/vscode/vs/platform/hover/browser/hover.service';
77
- import { HoverPosition } from 'vscode/vscode/vs/base/browser/ui/hover/hoverWidget';
78
- import { DEFAULT_ICON, ICONS } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfileIcons';
79
- import { WorkbenchIconSelectBox } from 'vscode/vscode/vs/workbench/services/userDataProfile/browser/iconSelectBox';
80
- import { StandardKeyboardEvent } from 'vscode/vscode/vs/base/browser/keyboardEvent';
81
- import { KeyCode } from 'vscode/vscode/vs/base/common/keyCodes';
82
- import { IAccessibleViewInformationService } from 'vscode/vscode/vs/workbench/services/accessibility/common/accessibleViewInformationService.service';
83
- import { ILogService } from 'vscode/vscode/vs/platform/log/common/log.service';
39
+ import { createCancelablePromise } from 'vscode/vscode/vs/base/common/async';
84
40
 
85
- var UserDataProfileImportExportService_1;
86
41
  function isUserDataProfileTemplate(thing) {
87
42
  const candidate = thing;
88
43
  return !!(candidate && typeof candidate === 'object'
@@ -92,23 +47,15 @@ function isUserDataProfileTemplate(thing) {
92
47
  && (isUndefined(candidate.globalState) || typeof candidate.globalState === 'string')
93
48
  && (isUndefined(candidate.extensions) || typeof candidate.extensions === 'string'));
94
49
  }
95
- const EXPORT_PROFILE_PREVIEW_VIEW = 'workbench.views.profiles.export.preview';
96
- const IMPORT_PROFILE_PREVIEW_VIEW = 'workbench.views.profiles.import.preview';
97
50
  let UserDataProfileImportExportService = class UserDataProfileImportExportService extends Disposable {
98
- static { UserDataProfileImportExportService_1 = this; }
99
- static { this.PROFILE_URL_AUTHORITY_PREFIX = 'profile-'; }
100
- constructor(instantiationService, userDataProfileService, viewsService, editorService, contextKeyService, userDataProfileManagementService, userDataProfilesService, extensionService, extensionManagementService, quickInputService, notificationService, progressService, dialogService, clipboardService, openerService, requestService, urlService, productService, uriIdentityService, telemetryService, contextViewService, hoverService, logService) {
51
+ constructor(instantiationService, userDataProfileService, userDataProfileManagementService, userDataProfilesService, extensionService, quickInputService, progressService, dialogService, clipboardService, openerService, requestService, productService, uriIdentityService) {
101
52
  super();
102
53
  this.instantiationService = instantiationService;
103
54
  this.userDataProfileService = userDataProfileService;
104
- this.viewsService = viewsService;
105
- this.editorService = editorService;
106
55
  this.userDataProfileManagementService = userDataProfileManagementService;
107
56
  this.userDataProfilesService = userDataProfilesService;
108
57
  this.extensionService = extensionService;
109
- this.extensionManagementService = extensionManagementService;
110
58
  this.quickInputService = quickInputService;
111
- this.notificationService = notificationService;
112
59
  this.progressService = progressService;
113
60
  this.dialogService = dialogService;
114
61
  this.clipboardService = clipboardService;
@@ -116,40 +63,8 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
116
63
  this.requestService = requestService;
117
64
  this.productService = productService;
118
65
  this.uriIdentityService = uriIdentityService;
119
- this.telemetryService = telemetryService;
120
- this.contextViewService = contextViewService;
121
- this.hoverService = hoverService;
122
- this.logService = logService;
123
66
  this.profileContentHandlers = ( (new Map()));
124
67
  this.registerProfileContentHandler(Schemas.file, this.fileUserDataProfileContentHandler = instantiationService.createInstance(FileUserDataProfileContentHandler));
125
- this.isProfileExportInProgressContextKey = IS_PROFILE_EXPORT_IN_PROGRESS_CONTEXT.bindTo(contextKeyService);
126
- this.isProfileImportInProgressContextKey = IS_PROFILE_IMPORT_IN_PROGRESS_CONTEXT.bindTo(contextKeyService);
127
- this.viewContainer = ( (Registry.as(Extensions.ViewContainersRegistry))).registerViewContainer({
128
- id: 'userDataProfiles',
129
- title: PROFILES_TITLE,
130
- ctorDescriptor: ( (new SyncDescriptor(
131
- ViewPaneContainer,
132
- ['userDataProfiles', { mergeViewWithContainerWhenSingleView: true }]
133
- ))),
134
- icon: defaultUserDataProfileIcon,
135
- hideIfEmpty: true,
136
- }, ViewContainerLocation.Sidebar);
137
- urlService.registerHandler(this);
138
- }
139
- isProfileURL(uri) {
140
- return uri.authority === PROFILE_URL_AUTHORITY || ( (new RegExp(`^${UserDataProfileImportExportService_1.PROFILE_URL_AUTHORITY_PREFIX}`))).test(uri.authority);
141
- }
142
- async handleURL(uri) {
143
- if (this.isProfileURL(uri)) {
144
- try {
145
- await this.importProfile(uri);
146
- }
147
- catch (error) {
148
- this.notificationService.error(( localize(3668, "Error while importing profile: {0}", getErrorMessage(error))));
149
- }
150
- return true;
151
- }
152
- return false;
153
68
  }
154
69
  registerProfileContentHandler(id, profileContentHandler) {
155
70
  if (( (this.profileContentHandlers.has(id)))) {
@@ -161,51 +76,6 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
161
76
  unregisterProfileContentHandler(id) {
162
77
  this.profileContentHandlers.delete(id);
163
78
  }
164
- async exportProfile2() {
165
- if (this.isProfileExportInProgressContextKey.get()) {
166
- this.logService.warn('Profile export already in progress.');
167
- return;
168
- }
169
- return this.showProfileContents();
170
- }
171
- async importProfile(uri, options) {
172
- if (this.isProfileImportInProgressContextKey.get()) {
173
- this.notificationService.warn('Profile import already in progress.');
174
- return;
175
- }
176
- this.isProfileImportInProgressContextKey.set(true);
177
- const disposables = ( (new DisposableStore()));
178
- disposables.add(toDisposable(() => this.isProfileImportInProgressContextKey.set(false)));
179
- try {
180
- const mode = options?.mode ?? 'preview';
181
- const profileTemplate = await this.progressService.withProgress({
182
- location: ProgressLocation.Window,
183
- command: showWindowLogActionId,
184
- title: ( localize(3669, "{0}: Resolving profile content...", options?.mode ? ( localize(3670, "Preview Profile")) : ( localize(3671, "Create Profile")))),
185
- }, () => this.resolveProfileTemplate(uri, options));
186
- if (!profileTemplate) {
187
- return;
188
- }
189
- if (mode === 'preview') {
190
- await this.previewProfile(profileTemplate, options);
191
- }
192
- else if (mode === 'apply') {
193
- await this.createAndSwitch(profileTemplate, !!options?.transient, true, options, ( localize(3672, "Create Profile")));
194
- }
195
- else if (mode === 'both') {
196
- await this.importAndPreviewProfile(uri, profileTemplate, options);
197
- }
198
- }
199
- finally {
200
- disposables.dispose();
201
- }
202
- }
203
- createProfile(from) {
204
- return this.saveProfile(undefined, from);
205
- }
206
- editProfile(profile) {
207
- return this.saveProfile(profile);
208
- }
209
79
  async createFromProfile(from, options, token) {
210
80
  const disposables = ( (new DisposableStore()));
211
81
  let creationPromise;
@@ -217,7 +87,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
217
87
  sticky: true,
218
88
  cancellable: true,
219
89
  }, async (progress) => {
220
- const reportProgress = (message) => progress.report({ message: ( localize(3673, "Create Profile: {0}", message)) });
90
+ const reportProgress = (message) => progress.report({ message: ( localize(3659, "Create Profile: {0}", message)) });
221
91
  creationPromise = createCancelablePromise(async (token) => {
222
92
  const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, from, { ...options?.resourceTypeFlags, extensions: false }));
223
93
  const profileTemplate = await userDataProfilesExportState.getProfileTemplate(options.name ?? from.name, options?.icon);
@@ -233,7 +103,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
233
103
  try {
234
104
  await creationPromise;
235
105
  if (profile && (options?.resourceTypeFlags?.extensions ?? true)) {
236
- reportProgress(( localize(3674, "Installing Extensions...")));
106
+ reportProgress(( localize(3660, "Installing Extensions...")));
237
107
  await this.instantiationService.createInstance(ExtensionsResource).copy(from, profile, false);
238
108
  }
239
109
  }
@@ -257,7 +127,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
257
127
  sticky: true,
258
128
  cancellable: true,
259
129
  }, async (progress) => {
260
- const reportProgress = (message) => progress.report({ message: ( localize(3673, "Create Profile: {0}", message)) });
130
+ const reportProgress = (message) => progress.report({ message: ( localize(3659, "Create Profile: {0}", message)) });
261
131
  creationPromise = createCancelablePromise(async (token) => {
262
132
  profile = await this.getProfileToImport({ ...profileTemplate, name: options.name ?? profileTemplate.name }, !!options.transient, options);
263
133
  if (!profile) {
@@ -282,389 +152,70 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
282
152
  }
283
153
  async applyProfileTemplate(profileTemplate, profile, options, reportProgress, token) {
284
154
  if (profileTemplate.settings && (options.resourceTypeFlags?.settings ?? true) && !profile.useDefaultFlags?.settings) {
285
- reportProgress(( localize(3675, "Creating Settings...")));
155
+ reportProgress(( localize(3661, "Creating Settings...")));
286
156
  await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
287
157
  }
288
158
  if (token.isCancellationRequested) {
289
159
  return;
290
160
  }
291
161
  if (profileTemplate.keybindings && (options.resourceTypeFlags?.keybindings ?? true) && !profile.useDefaultFlags?.keybindings) {
292
- reportProgress(( localize(3676, "Creating Keyboard Shortcuts...")));
162
+ reportProgress(( localize(3662, "Creating Keyboard Shortcuts...")));
293
163
  await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
294
164
  }
295
165
  if (token.isCancellationRequested) {
296
166
  return;
297
167
  }
298
168
  if (profileTemplate.tasks && (options.resourceTypeFlags?.tasks ?? true) && !profile.useDefaultFlags?.tasks) {
299
- reportProgress(( localize(3677, "Creating Tasks...")));
169
+ reportProgress(( localize(3663, "Creating Tasks...")));
300
170
  await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
301
171
  }
302
172
  if (token.isCancellationRequested) {
303
173
  return;
304
174
  }
305
175
  if (profileTemplate.snippets && (options.resourceTypeFlags?.snippets ?? true) && !profile.useDefaultFlags?.snippets) {
306
- reportProgress(( localize(3678, "Creating Snippets...")));
176
+ reportProgress(( localize(3664, "Creating Snippets...")));
307
177
  await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
308
178
  }
309
179
  if (token.isCancellationRequested) {
310
180
  return;
311
181
  }
312
182
  if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
313
- reportProgress(( localize(3679, "Applying UI State...")));
183
+ reportProgress(( localize(3665, "Applying UI State...")));
314
184
  await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
315
185
  }
316
186
  if (token.isCancellationRequested) {
317
187
  return;
318
188
  }
319
189
  if (profileTemplate.extensions && (options.resourceTypeFlags?.extensions ?? true) && !profile.useDefaultFlags?.extensions) {
320
- reportProgress(( localize(3674, "Installing Extensions...")));
190
+ reportProgress(( localize(3660, "Installing Extensions...")));
321
191
  await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile, reportProgress, token);
322
192
  }
323
193
  }
324
- async saveProfile(profile, source) {
325
- const createProfileTelemetryData = { source: source instanceof URI ? 'template' : isUserDataProfile(source) ? 'profile' : source ? 'external' : undefined };
326
- if (profile) {
327
- this.telemetryService.publicLog2('userDataProfile.startEdit');
328
- }
329
- else {
330
- this.telemetryService.publicLog2('userDataProfile.startCreate', createProfileTelemetryData);
331
- }
332
- const disposables = ( (new DisposableStore()));
333
- const title = profile ? ( localize(3680, "Edit {0} Profile...", profile.name)) : ( localize(3681, "Create New Profile..."));
334
- const settings = { id: ProfileResourceType.Settings, label: ( localize(3682, "Settings")), picked: !profile?.useDefaultFlags?.settings };
335
- const keybindings = { id: ProfileResourceType.Keybindings, label: ( localize(3683, "Keyboard Shortcuts")), picked: !profile?.useDefaultFlags?.keybindings };
336
- const snippets = { id: ProfileResourceType.Snippets, label: ( localize(3684, "Snippets")), picked: !profile?.useDefaultFlags?.snippets };
337
- const tasks = { id: ProfileResourceType.Tasks, label: ( localize(3685, "Tasks")), picked: !profile?.useDefaultFlags?.tasks };
338
- const extensions = { id: ProfileResourceType.Extensions, label: ( localize(3686, "Extensions")), picked: !profile?.useDefaultFlags?.extensions };
339
- const resources = [settings, keybindings, snippets, tasks, extensions];
340
- const quickPick = this.quickInputService.createQuickPick();
341
- quickPick.title = title;
342
- quickPick.placeholder = ( localize(3687, "Profile name"));
343
- quickPick.value = profile?.name ?? (isUserDataProfileTemplate(source) ? this.generateProfileName(source.name) : '');
344
- quickPick.canSelectMany = true;
345
- quickPick.matchOnDescription = false;
346
- quickPick.matchOnDetail = false;
347
- quickPick.matchOnLabel = false;
348
- quickPick.sortByLabel = false;
349
- quickPick.hideCountBadge = true;
350
- quickPick.ok = false;
351
- quickPick.customButton = true;
352
- quickPick.hideCheckAll = true;
353
- quickPick.ignoreFocusOut = true;
354
- quickPick.customLabel = profile ? ( localize(3688, "Save")) : ( localize(3689, "Create"));
355
- quickPick.description = ( localize(3690, "Choose what to configure in your Profile:"));
356
- quickPick.items = [...resources];
357
- const update = () => {
358
- quickPick.items = resources;
359
- quickPick.selectedItems = resources.filter(item => item.picked);
360
- };
361
- update();
362
- const validate = () => {
363
- if (!profile && ( (this.userDataProfilesService.profiles.some(p => p.name === quickPick.value)))) {
364
- quickPick.validationMessage = ( localize(3691, "Profile with name {0} already exists.", quickPick.value));
365
- quickPick.severity = Severity$1.Warning;
366
- return;
367
- }
368
- if (resources.every(resource => !resource.picked)) {
369
- quickPick.validationMessage = ( localize(3692, "The profile should contain at least one configuration."));
370
- quickPick.severity = Severity$1.Warning;
371
- return;
372
- }
373
- quickPick.severity = Severity$1.Ignore;
374
- quickPick.validationMessage = undefined;
375
- };
376
- disposables.add(quickPick.onDidChangeSelection(items => {
377
- let needUpdate = false;
378
- for (const resource of resources) {
379
- resource.picked = items.includes(resource);
380
- const description = resource.picked ? undefined : ( localize(3693, "Using Default Profile"));
381
- if (resource.description !== description) {
382
- resource.description = description;
383
- needUpdate = true;
384
- }
385
- }
386
- if (needUpdate) {
387
- update();
388
- }
389
- validate();
390
- }));
391
- disposables.add(quickPick.onDidChangeValue(validate));
392
- let icon = DEFAULT_ICON;
393
- if (profile?.icon) {
394
- icon = ThemeIcon.fromId(profile.icon);
395
- }
396
- if (isUserDataProfileTemplate(source) && source.icon) {
397
- icon = ThemeIcon.fromId(source.icon);
398
- }
399
- if (icon.id !== DEFAULT_ICON.id && !( (ICONS.some(({ id }) => id === icon.id))) && !( (getAllCodicons().some(({ id }) => id === icon.id)))) {
400
- icon = DEFAULT_ICON;
401
- }
402
- let result;
403
- disposables.add(Event.any(quickPick.onDidCustom, quickPick.onDidAccept)(() => {
404
- const name = quickPick.value.trim();
405
- if (!name) {
406
- quickPick.validationMessage = ( localize(3694, "Profile name is required and must be a non-empty value."));
407
- quickPick.severity = Severity$1.Error;
408
- }
409
- if (quickPick.validationMessage) {
410
- return;
411
- }
412
- result = { name, items: quickPick.selectedItems, icon: icon.id === DEFAULT_ICON.id ? null : icon.id };
413
- quickPick.hide();
414
- quickPick.severity = Severity$1.Ignore;
415
- quickPick.validationMessage = undefined;
416
- }));
417
- const domNode = $('.profile-edit-widget');
418
- const profileIconContainer = $('.profile-icon-container');
419
- append(profileIconContainer, $('.profile-icon-label', undefined, ( localize(3695, "Icon:"))));
420
- const profileIconElement = append(profileIconContainer, $(`.profile-icon${ThemeIcon.asCSSSelector(icon)}`));
421
- profileIconElement.tabIndex = 0;
422
- profileIconElement.role = 'button';
423
- profileIconElement.ariaLabel = ( localize(3696, "Icon: {0}", icon.id));
424
- const iconSelectBox = disposables.add(this.instantiationService.createInstance(WorkbenchIconSelectBox, { icons: ICONS, inputBoxStyles: defaultInputBoxStyles }));
425
- const dimension = new Dimension(486, 260);
426
- iconSelectBox.layout(dimension);
427
- let hoverWidget;
428
- const updateIcon = (updated) => {
429
- icon = updated ?? DEFAULT_ICON;
430
- profileIconElement.className = `profile-icon ${ThemeIcon.asClassName(icon)}`;
431
- profileIconElement.ariaLabel = ( localize(3696, "Icon: {0}", icon.id));
432
- };
433
- disposables.add(iconSelectBox.onDidSelect(selectedIcon => {
434
- if (icon.id !== selectedIcon.id) {
435
- updateIcon(selectedIcon);
436
- }
437
- hoverWidget?.dispose();
438
- profileIconElement.focus();
439
- }));
440
- const showIconSelectBox = () => {
441
- iconSelectBox.clearInput();
442
- hoverWidget = this.hoverService.showHover({
443
- content: iconSelectBox.domNode,
444
- target: profileIconElement,
445
- position: {
446
- hoverPosition: HoverPosition.BELOW,
447
- },
448
- persistence: {
449
- sticky: true,
450
- },
451
- appearance: {
452
- showPointer: true,
453
- },
454
- }, true);
455
- if (hoverWidget) {
456
- iconSelectBox.layout(dimension);
457
- disposables.add(hoverWidget);
458
- }
459
- iconSelectBox.focus();
460
- };
461
- disposables.add(addDisposableListener(profileIconElement, EventType.CLICK, (e) => {
462
- EventHelper.stop(e, true);
463
- showIconSelectBox();
464
- }));
465
- disposables.add(addDisposableListener(profileIconElement, EventType.KEY_DOWN, e => {
466
- const event = ( (new StandardKeyboardEvent(e)));
467
- if (event.equals(KeyCode.Enter) || event.equals(KeyCode.Space)) {
468
- EventHelper.stop(event, true);
469
- showIconSelectBox();
470
- }
471
- }));
472
- disposables.add(addDisposableListener(iconSelectBox.domNode, EventType.KEY_DOWN, e => {
473
- const event = ( (new StandardKeyboardEvent(e)));
474
- if (event.equals(KeyCode.Escape)) {
475
- EventHelper.stop(event, true);
476
- hoverWidget?.dispose();
477
- profileIconElement.focus();
478
- }
479
- }));
480
- if (!profile && !isUserDataProfileTemplate(source)) {
481
- const profileTypeContainer = append(domNode, $('.profile-type-container'));
482
- append(profileTypeContainer, $('.profile-type-create-label', undefined, ( localize(3697, "Copy from:"))));
483
- const separator = { text: '\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500', isDisabled: true };
484
- const profileOptions = [];
485
- profileOptions.push({ text: ( localize(3698, "None")) });
486
- const templates = await this.userDataProfileManagementService.getBuiltinProfileTemplates();
487
- if (templates.length) {
488
- profileOptions.push({ ...separator, decoratorRight: ( localize(3699, "Profile Templates")) });
489
- for (const template of templates) {
490
- profileOptions.push({ text: template.name, id: template.url, source: ( (URI.parse(template.url))) });
491
- }
492
- }
493
- profileOptions.push({ ...separator, decoratorRight: ( localize(3700, "Existing Profiles")) });
494
- for (const profile of this.userDataProfilesService.profiles) {
495
- profileOptions.push({ text: profile.name, id: profile.id, source: profile });
496
- }
497
- const findOptionIndex = () => {
498
- const index = profileOptions.findIndex(option => {
499
- if (source instanceof URI) {
500
- return option.source instanceof URI && this.uriIdentityService.extUri.isEqual(option.source, source);
501
- }
502
- else if (isUserDataProfile(source)) {
503
- return option.id === source.id;
504
- }
505
- return false;
506
- });
507
- return index > -1 ? index : 0;
508
- };
509
- const initialIndex = findOptionIndex();
510
- const selectBox = disposables.add(this.instantiationService.createInstance(SelectBox, profileOptions, initialIndex, this.contextViewService, defaultSelectBoxStyles, {
511
- useCustomDrawn: true,
512
- ariaLabel: ( localize(3701, "Copy profile from")),
513
- }));
514
- selectBox.render(append(profileTypeContainer, $('.profile-type-select-container')));
515
- if (profileOptions[initialIndex].source) {
516
- quickPick.value = this.generateProfileName(profileOptions[initialIndex].text);
517
- }
518
- const updateOptions = () => {
519
- const option = profileOptions[findOptionIndex()];
520
- for (const resource of resources) {
521
- resource.picked = option.source && !(option.source instanceof URI) ? !option.source?.useDefaultFlags?.[resource.id] : true;
522
- }
523
- updateIcon(!(option.source instanceof URI) && option.source?.icon ? ThemeIcon.fromId(option.source.icon) : undefined);
524
- update();
525
- };
526
- updateOptions();
527
- disposables.add(selectBox.onDidSelect(({ index }) => {
528
- source = profileOptions[index].source;
529
- updateOptions();
530
- }));
531
- }
532
- append(domNode, profileIconContainer);
533
- quickPick.widget = domNode;
534
- quickPick.show();
535
- await ( (new Promise((c, e) => {
536
- disposables.add(quickPick.onDidHide(() => {
537
- disposables.dispose();
538
- c();
539
- }));
540
- })));
541
- if (!result) {
542
- if (profile) {
543
- this.telemetryService.publicLog2('userDataProfile.cancelEdit');
544
- }
545
- else {
546
- this.telemetryService.publicLog2('userDataProfile.cancelCreate', createProfileTelemetryData);
547
- }
548
- return;
549
- }
550
- try {
551
- const useDefaultFlags = result.items.length === resources.length
552
- ? undefined
553
- : {
554
- settings: !result.items.includes(settings),
555
- keybindings: !result.items.includes(keybindings),
556
- snippets: !result.items.includes(snippets),
557
- tasks: !result.items.includes(tasks),
558
- extensions: !result.items.includes(extensions)
559
- };
560
- if (profile) {
561
- await this.userDataProfileManagementService.updateProfile(profile, { name: result.name, icon: result.icon, useDefaultFlags: profile.useDefaultFlags && !useDefaultFlags ? {} : useDefaultFlags });
562
- }
563
- else {
564
- if (source instanceof URI) {
565
- this.telemetryService.publicLog2('userDataProfile.createFromTemplate', createProfileTelemetryData);
566
- await this.importProfile(source, { mode: 'apply', name: result.name, useDefaultFlags, icon: result.icon ? result.icon : undefined });
567
- }
568
- else if (isUserDataProfile(source)) {
569
- this.telemetryService.publicLog2('userDataProfile.createFromProfile', createProfileTelemetryData);
570
- await this._createFromProfile(source, result.name, { useDefaultFlags, icon: result.icon ? result.icon : undefined });
571
- }
572
- else if (isUserDataProfileTemplate(source)) {
573
- source.name = result.name;
574
- this.telemetryService.publicLog2('userDataProfile.createFromExternalTemplate', createProfileTelemetryData);
575
- await this.createAndSwitch(source, false, true, { useDefaultFlags, icon: result.icon ? result.icon : undefined }, ( localize(3672, "Create Profile")));
576
- }
577
- else {
578
- this.telemetryService.publicLog2('userDataProfile.createEmptyProfile', createProfileTelemetryData);
579
- await this.userDataProfileManagementService.createAndEnterProfile(result.name, { useDefaultFlags, icon: result.icon ? result.icon : undefined });
580
- }
581
- }
582
- }
583
- catch (error) {
584
- this.notificationService.error(error);
585
- }
586
- }
587
- async showProfileContents() {
588
- const view = this.viewsService.getViewWithId(EXPORT_PROFILE_PREVIEW_VIEW);
589
- if (view) {
590
- this.viewsService.openView(view.id, true);
591
- return;
592
- }
593
- const disposables = ( (new DisposableStore()));
594
- try {
595
- const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, this.userDataProfileService.currentProfile, undefined));
596
- const barrier = ( (new Barrier()));
597
- const exportAction = ( (new BarrierAction(barrier, (new Action('export', ( localize(3702, "Export")), undefined, true, async () => {
598
- exportAction.enabled = false;
599
- try {
600
- await this.doExportProfile(userDataProfilesExportState, EXPORT_PROFILE_PREVIEW_VIEW);
601
- }
602
- catch (error) {
603
- exportAction.enabled = true;
604
- this.notificationService.error(error);
605
- throw error;
606
- }
607
- })), this.notificationService)));
608
- const closeAction = ( (new BarrierAction(barrier, (new Action('close', ( localize(3703, "Close")))), this.notificationService)));
609
- await this.showProfilePreviewView(EXPORT_PROFILE_PREVIEW_VIEW, userDataProfilesExportState.profile.name, exportAction, closeAction, true, userDataProfilesExportState);
610
- disposables.add(this.userDataProfileService.onDidChangeCurrentProfile(e => barrier.open()));
611
- await barrier.wait();
612
- await this.hideProfilePreviewView(EXPORT_PROFILE_PREVIEW_VIEW);
613
- }
614
- finally {
615
- disposables.dispose();
616
- }
617
- }
618
- async exportProfile(profile) {
194
+ async exportProfile(profile, exportFlags) {
619
195
  const disposables = ( (new DisposableStore()));
620
196
  try {
621
- const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, profile, undefined));
197
+ const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, profile, exportFlags));
622
198
  await this.doExportProfile(userDataProfilesExportState, ProgressLocation.Notification);
623
199
  }
624
200
  finally {
625
201
  disposables.dispose();
626
202
  }
627
203
  }
628
- async _createFromProfile(profile, name, options) {
629
- const userDataProfilesExportState = this.instantiationService.createInstance(UserDataProfileExportState, profile, options?.resourceTypeFlags);
630
- try {
631
- const profileTemplate = await userDataProfilesExportState.getProfileTemplate(name, options?.icon);
632
- await this.progressService.withProgress({
633
- location: ProgressLocation.Notification,
634
- delay: 500,
635
- sticky: true,
636
- }, async (progress) => {
637
- const reportProgress = (message) => progress.report({ message: ( localize(3673, "Create Profile: {0}", message)) });
638
- const createdProfile = await this.doCreateProfile(profileTemplate, false, false, { useDefaultFlags: options?.useDefaultFlags, icon: options?.icon, transient: options?.transient }, reportProgress);
639
- if (createdProfile) {
640
- if (options?.resourceTypeFlags?.extensions ?? true) {
641
- reportProgress(( localize(3704, "Applying Extensions...")));
642
- await this.instantiationService.createInstance(ExtensionsResource).copy(profile, createdProfile, false);
643
- }
644
- reportProgress(( localize(3705, "Switching Profile...")));
645
- await this.userDataProfileManagementService.switchProfile(createdProfile);
646
- }
647
- });
648
- }
649
- finally {
650
- userDataProfilesExportState.dispose();
651
- }
652
- }
653
204
  async createTroubleshootProfile() {
654
205
  const userDataProfilesExportState = this.instantiationService.createInstance(UserDataProfileExportState, this.userDataProfileService.currentProfile, undefined);
655
206
  try {
656
- const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(3706, "Troubleshoot Issue")), undefined);
207
+ const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(3666, "Troubleshoot Issue")), undefined);
657
208
  await this.progressService.withProgress({
658
209
  location: ProgressLocation.Notification,
659
210
  delay: 1000,
660
211
  sticky: true,
661
212
  }, async (progress) => {
662
- const reportProgress = (message) => progress.report({ message: ( localize(3707, "Setting up Troubleshoot Profile: {0}", message)) });
213
+ const reportProgress = (message) => progress.report({ message: ( localize(3667, "Setting up Troubleshoot Profile: {0}", message)) });
663
214
  const profile = await this.doCreateProfile(profileTemplate, true, false, { useDefaultFlags: this.userDataProfileService.currentProfile.useDefaultFlags }, reportProgress);
664
215
  if (profile) {
665
- reportProgress(( localize(3704, "Applying Extensions...")));
216
+ reportProgress(( localize(3668, "Applying Extensions...")));
666
217
  await this.instantiationService.createInstance(ExtensionsResource).copy(this.userDataProfileService.currentProfile, profile, true);
667
- reportProgress(( localize(3705, "Switching Profile...")));
218
+ reportProgress(( localize(3669, "Switching Profile...")));
668
219
  await this.userDataProfileManagementService.switchProfile(profile);
669
220
  }
670
221
  });
@@ -678,13 +229,11 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
678
229
  if (!profile) {
679
230
  return;
680
231
  }
681
- this.isProfileExportInProgressContextKey.set(true);
682
232
  const disposables = ( (new DisposableStore()));
683
- disposables.add(toDisposable(() => this.isProfileExportInProgressContextKey.set(false)));
684
233
  try {
685
234
  await this.progressService.withProgress({
686
235
  location,
687
- title: ( localize(3708, "{0}: Exporting...", PROFILES_CATEGORY.value)),
236
+ title: ( localize(3670, "{0}: Exporting...", PROFILES_CATEGORY.value)),
688
237
  }, async (progress) => {
689
238
  const id = await this.pickProfileContentHandler(profile.name);
690
239
  if (!id) {
@@ -698,17 +247,17 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
698
247
  if (!saveResult) {
699
248
  return;
700
249
  }
701
- const message = ( localize(3709, "Profile '{0}' was exported successfully.", profile.name));
250
+ const message = ( localize(3671, "Profile '{0}' was exported successfully.", profile.name));
702
251
  if (profileContentHandler.extensionId) {
703
252
  const buttons = [];
704
253
  const link = this.productService.webUrl ? `${this.productService.webUrl}/${PROFILE_URL_AUTHORITY}/${id}/${saveResult.id}` : ( (toUserDataProfileUri(`/${id}/${saveResult.id}`, this.productService).toString()));
705
254
  buttons.push({
706
- label: ( localize(3710, "&&Copy Link")),
255
+ label: ( localize(3672, "&&Copy Link")),
707
256
  run: () => this.clipboardService.writeText(link)
708
257
  });
709
258
  if (this.productService.webUrl) {
710
259
  buttons.push({
711
- label: ( localize(3711, "&&Open Link")),
260
+ label: ( localize(3673, "&&Open Link")),
712
261
  run: async () => {
713
262
  await this.openerService.open(link);
714
263
  }
@@ -716,7 +265,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
716
265
  }
717
266
  else {
718
267
  buttons.push({
719
- label: ( localize(3712, "&&Open in {0}", profileContentHandler.name)),
268
+ label: ( localize(3674, "&&Open in {0}", profileContentHandler.name)),
720
269
  run: async () => {
721
270
  await this.openerService.open(( (saveResult.link.toString())));
722
271
  }
@@ -726,7 +275,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
726
275
  type: Severity$1.Info,
727
276
  message,
728
277
  buttons,
729
- cancelButton: ( localize(3703, "Close"))
278
+ cancelButton: ( localize(3675, "Close"))
730
279
  });
731
280
  }
732
281
  else {
@@ -748,10 +297,10 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
748
297
  profileTemplate = JSON.parse(profileContent);
749
298
  }
750
299
  catch (error) {
751
- throw ( (new Error(localize(3713, "This profile is not valid."))));
300
+ throw ( (new Error(localize(3676, "This profile is not valid."))));
752
301
  }
753
302
  if (!isUserDataProfileTemplate(profileTemplate)) {
754
- throw ( (new Error(localize(3713, "This profile is not valid."))));
303
+ throw ( (new Error(localize(3676, "This profile is not valid."))));
755
304
  }
756
305
  if (options?.name) {
757
306
  profileTemplate.name = options.name;
@@ -779,153 +328,33 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
779
328
  }
780
329
  return profileTemplate;
781
330
  }
782
- async importAndPreviewProfile(uri, profileTemplate, options) {
783
- const disposables = ( (new DisposableStore()));
784
- try {
785
- const userDataProfileImportState = disposables.add(this.instantiationService.createInstance(UserDataProfileImportState, profileTemplate));
786
- profileTemplate = await userDataProfileImportState.getProfileTemplateToImport();
787
- const importedProfile = await this.createAndSwitch(profileTemplate, true, false, options, ( localize(3670, "Preview Profile")));
788
- if (!importedProfile) {
789
- return;
790
- }
791
- const barrier = ( (new Barrier()));
792
- const importAction = this.getCreateAction(barrier, userDataProfileImportState);
793
- const primaryAction = isWeb
794
- ? ( (new Action('importInDesktop', ( localize(3714, "Create Profile in {0}", this.productService.nameLong)), undefined, true, async () => this.openerService.open(uri, { openExternal: true }))))
795
- : importAction;
796
- const secondaryAction = isWeb
797
- ? importAction
798
- : ( (new BarrierAction(barrier, (new Action('close', ( localize(3703, "Close")))), this.notificationService)));
799
- const view = await this.showProfilePreviewView(IMPORT_PROFILE_PREVIEW_VIEW, importedProfile.name, primaryAction, secondaryAction, false, userDataProfileImportState);
800
- const message = ( (new MarkdownString()));
801
- message.appendMarkdown(( localize(
802
- 3715,
803
- "By default, extensions aren't installed when previewing a profile on the web. You can still install them manually before importing the profile. "
804
- )));
805
- message.appendMarkdown(`[${( localize(3716, "Learn more"))}](https://aka.ms/vscode-extension-marketplace#_can-i-trust-extensions-from-the-marketplace).`);
806
- view.setMessage(message);
807
- const that = this;
808
- const disposable = disposables.add(registerAction2(class extends Action2 {
809
- constructor() {
810
- super({
811
- id: 'previewProfile.installExtensions',
812
- title: ( localize(3717, "Install Extensions")),
813
- icon: Codicon.cloudDownload,
814
- menu: {
815
- id: MenuId.ViewItemContext,
816
- group: 'inline',
817
- when: ( (ContextKeyExpr.and(
818
- (ContextKeyExpr.equals('view', IMPORT_PROFILE_PREVIEW_VIEW)),
819
- (ContextKeyExpr.equals('viewItem', ProfileResourceType.Extensions))
820
- ))),
821
- }
822
- });
823
- }
824
- async run() {
825
- return that.progressService.withProgress({
826
- location: IMPORT_PROFILE_PREVIEW_VIEW,
827
- }, async (progress) => {
828
- view.setMessage(undefined);
829
- const profileTemplate = await userDataProfileImportState.getProfileTemplateToImport();
830
- if (profileTemplate.extensions) {
831
- await that.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, importedProfile);
832
- }
833
- disposable.dispose();
834
- });
835
- }
836
- }));
837
- disposables.add(Event.debounce(this.extensionManagementService.onDidInstallExtensions, () => undefined, 100)(async () => {
838
- const profileTemplate = await userDataProfileImportState.getProfileTemplateToImport();
839
- if (profileTemplate.extensions) {
840
- const profileExtensions = await that.instantiationService.createInstance(ExtensionsResource).getProfileExtensions(profileTemplate.extensions);
841
- const installed = await this.extensionManagementService.getInstalled(ExtensionType.User);
842
- if (profileExtensions.every(e => ( (installed.some(i => areSameExtensions(e.identifier, i.identifier)))))) {
843
- disposable.dispose();
844
- }
845
- }
846
- }));
847
- await barrier.wait();
848
- await this.hideProfilePreviewView(IMPORT_PROFILE_PREVIEW_VIEW);
849
- }
850
- finally {
851
- disposables.dispose();
852
- }
853
- }
854
- async previewProfile(profileTemplate, options) {
855
- const disposables = ( (new DisposableStore()));
856
- try {
857
- const userDataProfileImportState = disposables.add(this.instantiationService.createInstance(UserDataProfileImportState, profileTemplate));
858
- if (userDataProfileImportState.isEmpty()) {
859
- await this.createAndSwitch(profileTemplate, false, true, options, ( localize(3672, "Create Profile")));
860
- }
861
- else {
862
- const barrier = ( (new Barrier()));
863
- const cancelAction = ( (new BarrierAction(barrier, (new Action('cancel', ( localize(3718, "Cancel")))), this.notificationService)));
864
- const importAction = this.getCreateAction(barrier, userDataProfileImportState, cancelAction);
865
- await this.showProfilePreviewView(IMPORT_PROFILE_PREVIEW_VIEW, profileTemplate.name, importAction, cancelAction, false, userDataProfileImportState);
866
- await barrier.wait();
867
- await this.hideProfilePreviewView(IMPORT_PROFILE_PREVIEW_VIEW);
868
- }
869
- }
870
- finally {
871
- disposables.dispose();
872
- }
873
- }
874
- getCreateAction(barrier, userDataProfileImportState, cancelAction) {
875
- const importAction = ( (new BarrierAction(barrier, (new Action('title', ( localize(3719, "Create Profile")), undefined, true, async () => {
876
- importAction.enabled = false;
877
- if (cancelAction) {
878
- cancelAction.enabled = false;
879
- }
880
- const profileTemplate = await userDataProfileImportState.getProfileTemplateToImport();
881
- return this.saveProfile(undefined, profileTemplate);
882
- })), this.notificationService)));
883
- return importAction;
884
- }
885
- async createAndSwitch(profileTemplate, temporaryProfile, extensions, options, title) {
886
- return this.progressService.withProgress({
887
- location: ProgressLocation.Notification,
888
- delay: 500,
889
- sticky: true,
890
- }, async (progress) => {
891
- title = `${title} (${profileTemplate.name})`;
892
- progress.report({ message: title });
893
- const reportProgress = (message) => progress.report({ message: `${title}: ${message}` });
894
- const profile = await this.doCreateProfile(profileTemplate, temporaryProfile, extensions, options, reportProgress);
895
- if (profile) {
896
- reportProgress(( localize(3705, "Switching Profile...")));
897
- await this.userDataProfileManagementService.switchProfile(profile);
898
- }
899
- return profile;
900
- });
901
- }
902
331
  async doCreateProfile(profileTemplate, temporaryProfile, extensions, options, progress) {
903
332
  const profile = await this.getProfileToImport(profileTemplate, temporaryProfile, options);
904
333
  if (!profile) {
905
334
  return undefined;
906
335
  }
907
336
  if (profileTemplate.settings && !profile.useDefaultFlags?.settings) {
908
- progress(( localize(3720, "Applying Settings...")));
337
+ progress(( localize(3677, "Applying Settings...")));
909
338
  await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
910
339
  }
911
340
  if (profileTemplate.keybindings && !profile.useDefaultFlags?.keybindings) {
912
- progress(( localize(3721, "Applying Keyboard Shortcuts...")));
341
+ progress(( localize(3678, "Applying Keyboard Shortcuts...")));
913
342
  await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
914
343
  }
915
344
  if (profileTemplate.tasks && !profile.useDefaultFlags?.tasks) {
916
- progress(( localize(3722, "Applying Tasks...")));
345
+ progress(( localize(3679, "Applying Tasks...")));
917
346
  await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
918
347
  }
919
348
  if (profileTemplate.snippets && !profile.useDefaultFlags?.snippets) {
920
- progress(( localize(3723, "Applying Snippets...")));
349
+ progress(( localize(3680, "Applying Snippets...")));
921
350
  await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
922
351
  }
923
352
  if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
924
- progress(( localize(3724, "Applying State...")));
353
+ progress(( localize(3681, "Applying State...")));
925
354
  await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
926
355
  }
927
356
  if (profileTemplate.extensions && extensions && !profile.useDefaultFlags?.extensions) {
928
- progress(( localize(3704, "Applying Extensions...")));
357
+ progress(( localize(3668, "Applying Extensions...")));
929
358
  await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile);
930
359
  }
931
360
  return profile;
@@ -934,14 +363,14 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
934
363
  if (await this.fileUserDataProfileContentHandler.canHandle(resource)) {
935
364
  return this.fileUserDataProfileContentHandler.readProfile(resource, CancellationToken.None);
936
365
  }
937
- if (this.isProfileURL(resource)) {
366
+ if (isProfileURL(resource)) {
938
367
  let handlerId, idOrUri;
939
368
  if (resource.authority === PROFILE_URL_AUTHORITY) {
940
369
  idOrUri = this.uriIdentityService.extUri.basename(resource);
941
370
  handlerId = this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(resource));
942
371
  }
943
372
  else {
944
- handlerId = resource.authority.substring(UserDataProfileImportExportService_1.PROFILE_URL_AUTHORITY_PREFIX.length);
373
+ handlerId = resource.authority.substring(PROFILE_URL_AUTHORITY_PREFIX.length);
945
374
  idOrUri = ( (URI.parse(resource.path.substring(1))));
946
375
  }
947
376
  await this.extensionService.activateByEvent(`onProfile:${handlerId}`);
@@ -978,7 +407,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
978
407
  options.push({ id, label: profileContentHandler.name, description: profileContentHandler.description });
979
408
  }
980
409
  const result = await this.quickInputService.pick(options.reverse(), {
981
- title: ( localize(3725, "Export '{0}' profile as...", name)),
410
+ title: ( localize(3682, "Export '{0}' profile as...", name)),
982
411
  hideInput: true
983
412
  });
984
413
  return result?.id;
@@ -993,11 +422,11 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
993
422
  const { confirmed } = await this.dialogService.confirm({
994
423
  type: Severity$1.Info,
995
424
  message: ( localize(
996
- 3726,
425
+ 3683,
997
426
  "Profile with name '{0}' already exists. Do you want to replace its contents?",
998
427
  profileName
999
428
  )),
1000
- primaryButton: ( localize(3727, "&&Replace"))
429
+ primaryButton: ( localize(3684, "&&Replace"))
1001
430
  });
1002
431
  if (!confirmed) {
1003
432
  return undefined;
@@ -1008,10 +437,6 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
1008
437
  return this.userDataProfilesService.createNamedProfile(profileName, { ...options, transient: temp });
1009
438
  }
1010
439
  }
1011
- generateProfileName(profileName) {
1012
- const existingProfile = this.userDataProfilesService.profiles.find(p => p.name === profileName);
1013
- return existingProfile ? `${profileName} ${this.getProfileNameIndex(profileName)}` : profileName;
1014
- }
1015
440
  getProfileNameIndex(name) {
1016
441
  const nameRegEx = ( (new RegExp(`${escapeRegExpCharacters(name)}\\s(\\d+)`)));
1017
442
  let nameIndex = 0;
@@ -1022,81 +447,35 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
1022
447
  }
1023
448
  return nameIndex + 1;
1024
449
  }
1025
- async showProfilePreviewView(id, name, primary, secondary, refreshAction, userDataProfilesData) {
1026
- const viewsRegistry = ( (Registry.as(Extensions.ViewsRegistry)));
1027
- const treeView = this.instantiationService.createInstance(TreeView, id, name);
1028
- if (refreshAction) {
1029
- treeView.showRefreshAction = true;
1030
- }
1031
- const actionRunner = ( (new ActionRunner()));
1032
- const descriptor = {
1033
- id,
1034
- name: { value: name, original: name },
1035
- ctorDescriptor: ( (new SyncDescriptor(
1036
- UserDataProfilePreviewViewPane,
1037
- [userDataProfilesData, primary, secondary, actionRunner]
1038
- ))),
1039
- canToggleVisibility: false,
1040
- canMoveView: false,
1041
- treeView,
1042
- collapsed: false,
1043
- };
1044
- viewsRegistry.registerViews([descriptor], this.viewContainer);
1045
- return (await this.viewsService.openView(id, true));
1046
- }
1047
- async hideProfilePreviewView(id) {
1048
- const viewsRegistry = ( (Registry.as(Extensions.ViewsRegistry)));
1049
- const viewDescriptor = viewsRegistry.getView(id);
1050
- if (viewDescriptor) {
1051
- viewDescriptor.treeView.dispose();
1052
- viewsRegistry.deregisterViews([viewDescriptor], this.viewContainer);
1053
- }
1054
- await this.closeAllImportExportPreviewEditors();
1055
- }
1056
- async closeAllImportExportPreviewEditors() {
1057
- const editorsToColse = this.editorService.getEditors(EditorsOrder.SEQUENTIAL).filter(({ editor }) => editor.resource?.scheme === USER_DATA_PROFILE_EXPORT_SCHEME || editor.resource?.scheme === USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME || editor.resource?.scheme === USER_DATA_PROFILE_IMPORT_PREVIEW_SCHEME);
1058
- if (editorsToColse.length) {
1059
- await this.editorService.closeEditors(editorsToColse);
1060
- }
1061
- }
1062
450
  };
1063
- UserDataProfileImportExportService = UserDataProfileImportExportService_1 = ( (__decorate([
451
+ UserDataProfileImportExportService = ( (__decorate([
1064
452
  ( (__param(0, IInstantiationService))),
1065
453
  ( (__param(1, IUserDataProfileService))),
1066
- ( (__param(2, IViewsService))),
1067
- ( (__param(3, IEditorService))),
1068
- ( (__param(4, IContextKeyService))),
1069
- ( (__param(5, IUserDataProfileManagementService))),
1070
- ( (__param(6, IUserDataProfilesService))),
1071
- ( (__param(7, IExtensionService))),
1072
- ( (__param(8, IExtensionManagementService))),
1073
- ( (__param(9, IQuickInputService))),
1074
- ( (__param(10, INotificationService))),
1075
- ( (__param(11, IProgressService))),
1076
- ( (__param(12, IDialogService))),
1077
- ( (__param(13, IClipboardService))),
1078
- ( (__param(14, IOpenerService))),
1079
- ( (__param(15, IRequestService))),
1080
- ( (__param(16, IURLService))),
1081
- ( (__param(17, IProductService))),
1082
- ( (__param(18, IUriIdentityService))),
1083
- ( (__param(19, ITelemetryService))),
1084
- ( (__param(20, IContextViewService))),
1085
- ( (__param(21, IHoverService))),
1086
- ( (__param(22, ILogService)))
454
+ ( (__param(2, IUserDataProfileManagementService))),
455
+ ( (__param(3, IUserDataProfilesService))),
456
+ ( (__param(4, IExtensionService))),
457
+ ( (__param(5, IQuickInputService))),
458
+ ( (__param(6, IProgressService))),
459
+ ( (__param(7, IDialogService))),
460
+ ( (__param(8, IClipboardService))),
461
+ ( (__param(9, IOpenerService))),
462
+ ( (__param(10, IRequestService))),
463
+ ( (__param(11, IProductService))),
464
+ ( (__param(12, IUriIdentityService)))
1087
465
  ], UserDataProfileImportExportService)));
1088
466
  let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler {
1089
- constructor(fileDialogService, uriIdentityService, fileService, textFileService) {
467
+ constructor(fileDialogService, uriIdentityService, fileService, productService, textFileService) {
1090
468
  this.fileDialogService = fileDialogService;
1091
469
  this.uriIdentityService = uriIdentityService;
1092
470
  this.fileService = fileService;
471
+ this.productService = productService;
1093
472
  this.textFileService = textFileService;
1094
- this.name = ( localize(3728, "Local"));
1095
- this.description = ( localize(3729, "file"));
473
+ this.name = ( localize(3685, "Local"));
474
+ this.description = ( localize(3686, "file"));
1096
475
  }
1097
476
  async saveProfile(name, content, token) {
1098
477
  const link = await this.fileDialogService.showSaveDialog({
1099
- title: ( localize(3730, "Save Profile")),
478
+ title: ( localize(3687, "Save Profile")),
1100
479
  filters: PROFILE_FILTER,
1101
480
  defaultUri: this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(), `${name}.${PROFILE_EXTENSION}`),
1102
481
  });
@@ -1107,7 +486,7 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
1107
486
  return { link, id: ( (link.toString())) };
1108
487
  }
1109
488
  async canHandle(uri) {
1110
- return uri.scheme !== Schemas.http && uri.scheme !== Schemas.https && (await this.fileService.canHandleResource(uri));
489
+ return uri.scheme !== Schemas.http && uri.scheme !== Schemas.https && uri.scheme !== this.productService.urlProtocol && (await this.fileService.canHandleResource(uri));
1111
490
  }
1112
491
  async readProfile(uri, token) {
1113
492
  if (await this.canHandle(uri)) {
@@ -1123,7 +502,7 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
1123
502
  canSelectFiles: true,
1124
503
  canSelectMany: false,
1125
504
  filters: PROFILE_FILTER,
1126
- title: ( localize(3731, "Select Profile")),
505
+ title: ( localize(3688, "Select Profile")),
1127
506
  });
1128
507
  return profileLocation ? profileLocation[0] : null;
1129
508
  }
@@ -1132,121 +511,11 @@ FileUserDataProfileContentHandler = ( (__decorate([
1132
511
  ( (__param(0, IFileDialogService))),
1133
512
  ( (__param(1, IUriIdentityService))),
1134
513
  ( (__param(2, IFileService))),
1135
- ( (__param(3, ITextFileService)))
514
+ ( (__param(3, IProductService))),
515
+ ( (__param(4, ITextFileService)))
1136
516
  ], FileUserDataProfileContentHandler)));
1137
- let UserDataProfilePreviewViewPane = class UserDataProfilePreviewViewPane extends TreeViewPane {
1138
- constructor(userDataProfileData, primaryAction, secondaryAction, actionRunner, options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, hoverService, accessibleViewService) {
1139
- super(options, keybindingService, contextMenuService, configurationService, contextKeyService, viewDescriptorService, instantiationService, openerService, themeService, telemetryService, notificationService, hoverService, accessibleViewService);
1140
- this.userDataProfileData = userDataProfileData;
1141
- this.primaryAction = primaryAction;
1142
- this.secondaryAction = secondaryAction;
1143
- this.actionRunner = actionRunner;
1144
- this.totalTreeItemsCount = 0;
1145
- this.renderDisposables = this._register(( (new DisposableStore())));
1146
- }
1147
- renderTreeView(container) {
1148
- this.treeView.dataProvider = this.userDataProfileData;
1149
- super.renderTreeView(append(container, $('.profile-view-tree-container')));
1150
- this.messageContainer = append(container, $('.profile-view-message-container.hide'));
1151
- this.createButtons(container);
1152
- this._register(this.treeView.onDidChangeCheckboxState(() => this.updateConfirmButtonEnablement()));
1153
- this.computeAndLayout();
1154
- this._register(Event.any(this.userDataProfileData.onDidChangeRoots, this.treeView.onDidCollapseItem, this.treeView.onDidExpandItem)(() => this.computeAndLayout()));
1155
- }
1156
- async computeAndLayout() {
1157
- const roots = await this.userDataProfileData.getRoots();
1158
- const children = await Promise.all(( (roots.map(async (root) => {
1159
- let expanded = root.collapsibleState === TreeItemCollapsibleState.Expanded;
1160
- try {
1161
- expanded = !this.treeView.isCollapsed(root);
1162
- }
1163
- catch (error) { }
1164
- if (expanded) {
1165
- const children = await root.getChildren();
1166
- return children ?? [];
1167
- }
1168
- return [];
1169
- }))));
1170
- this.totalTreeItemsCount = roots.length + children.flat().length;
1171
- this.updateConfirmButtonEnablement();
1172
- if (this.dimension) {
1173
- this.layoutTreeView(this.dimension.height, this.dimension.width);
1174
- }
1175
- }
1176
- createButtons(container) {
1177
- this.buttonsContainer = append(container, $('.profile-view-buttons-container'));
1178
- this.primaryButton = this._register(( (new Button(this.buttonsContainer, { ...defaultButtonStyles }))));
1179
- this.primaryButton.element.classList.add('profile-view-button');
1180
- this.primaryButton.label = this.primaryAction.label;
1181
- this.primaryButton.enabled = this.primaryAction.enabled;
1182
- this._register(this.primaryButton.onDidClick(() => this.actionRunner.run(this.primaryAction)));
1183
- this._register(this.primaryAction.onDidChange(e => {
1184
- if (e.enabled !== undefined) {
1185
- this.primaryButton.enabled = e.enabled;
1186
- }
1187
- }));
1188
- this.secondaryButton = this._register(( (new Button(this.buttonsContainer, { secondary: true, ...defaultButtonStyles }))));
1189
- this.secondaryButton.label = this.secondaryAction.label;
1190
- this.secondaryButton.element.classList.add('profile-view-button');
1191
- this.secondaryButton.enabled = this.secondaryAction.enabled;
1192
- this._register(this.secondaryButton.onDidClick(() => this.actionRunner.run(this.secondaryAction)));
1193
- this._register(this.secondaryAction.onDidChange(e => {
1194
- if (e.enabled !== undefined) {
1195
- this.secondaryButton.enabled = e.enabled;
1196
- }
1197
- }));
1198
- }
1199
- layoutTreeView(height, width) {
1200
- this.dimension = new Dimension(width, height);
1201
- let messageContainerHeight = 0;
1202
- if (!this.messageContainer.classList.contains('hide')) {
1203
- messageContainerHeight = getClientArea(this.messageContainer).height;
1204
- }
1205
- const buttonContainerHeight = 108;
1206
- this.buttonsContainer.style.height = `${buttonContainerHeight}px`;
1207
- this.buttonsContainer.style.width = `${width}px`;
1208
- super.layoutTreeView(Math.min(height - buttonContainerHeight - messageContainerHeight, 22 * this.totalTreeItemsCount), width);
1209
- }
1210
- updateConfirmButtonEnablement() {
1211
- this.primaryButton.enabled = this.primaryAction.enabled && this.userDataProfileData.isEnabled();
1212
- }
1213
- setMessage(message) {
1214
- this.messageContainer.classList.toggle('hide', !message);
1215
- clearNode(this.messageContainer);
1216
- if (message) {
1217
- this.renderDisposables.clear();
1218
- const rendered = this.renderDisposables.add(renderMarkdown(message, {
1219
- actionHandler: {
1220
- callback: (content) => {
1221
- this.openerService.open(content, { allowCommands: true }).catch(onUnexpectedError);
1222
- },
1223
- disposables: this.renderDisposables
1224
- }
1225
- }));
1226
- append(this.messageContainer, rendered.element);
1227
- }
1228
- }
1229
- refresh() {
1230
- return this.treeView.refresh();
1231
- }
1232
- };
1233
- UserDataProfilePreviewViewPane = ( (__decorate([
1234
- ( (__param(5, IKeybindingService))),
1235
- ( (__param(6, IContextMenuService))),
1236
- ( (__param(7, IConfigurationService))),
1237
- ( (__param(8, IContextKeyService))),
1238
- ( (__param(9, IViewDescriptorService))),
1239
- ( (__param(10, IInstantiationService))),
1240
- ( (__param(11, IOpenerService))),
1241
- ( (__param(12, IThemeService))),
1242
- ( (__param(13, ITelemetryService))),
1243
- ( (__param(14, INotificationService))),
1244
- ( (__param(15, IHoverService))),
1245
- ( (__param(16, IAccessibleViewInformationService)))
1246
- ], UserDataProfilePreviewViewPane)));
1247
517
  const USER_DATA_PROFILE_EXPORT_SCHEME = 'userdataprofileexport';
1248
518
  const USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME = 'userdataprofileexportpreview';
1249
- const USER_DATA_PROFILE_IMPORT_PREVIEW_SCHEME = 'userdataprofileimportpreview';
1250
519
  let UserDataProfileImportExportState = class UserDataProfileImportExportState extends Disposable {
1251
520
  constructor(quickInputService) {
1252
521
  super();
@@ -1280,13 +549,13 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
1280
549
  for (const root of this.roots) {
1281
550
  root.checkbox = {
1282
551
  isChecked: !root.isFromDefaultProfile(),
1283
- tooltip: ( localize(3732, "Select {0}", root.label.label)),
552
+ tooltip: ( localize(3689, "Select {0}", root.label.label)),
1284
553
  accessibilityInformation: {
1285
- label: ( localize(3732, "Select {0}", root.label.label)),
554
+ label: ( localize(3689, "Select {0}", root.label.label)),
1286
555
  }
1287
556
  };
1288
557
  if (root.isFromDefaultProfile()) {
1289
- root.description = ( localize(3733, "From Default Profile"));
558
+ root.description = ( localize(3690, "From Default Profile"));
1290
559
  }
1291
560
  }
1292
561
  return this.roots;
@@ -1449,11 +718,11 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
1449
718
  let name = this.profile.name;
1450
719
  if (this.profile.isDefault) {
1451
720
  name = await this.quickInputService.input({
1452
- placeHolder: ( localize(3734, "Name the profile")),
1453
- title: ( localize(3735, "Export Profile")),
721
+ placeHolder: ( localize(3691, "Name the profile")),
722
+ title: ( localize(3692, "Export Profile")),
1454
723
  async validateInput(input) {
1455
724
  if (!input.trim()) {
1456
- return ( localize(3736, "Profile name must be provided."));
725
+ return ( localize(3693, "Profile name must be provided."));
1457
726
  }
1458
727
  return undefined;
1459
728
  },
@@ -1470,94 +739,5 @@ UserDataProfileExportState = ( (__decorate([
1470
739
  ( (__param(3, IFileService))),
1471
740
  ( (__param(4, IInstantiationService)))
1472
741
  ], UserDataProfileExportState)));
1473
- let UserDataProfileImportState = class UserDataProfileImportState extends UserDataProfileImportExportState {
1474
- constructor(profile, fileService, quickInputService, instantiationService) {
1475
- super(quickInputService);
1476
- this.profile = profile;
1477
- this.fileService = fileService;
1478
- this.instantiationService = instantiationService;
1479
- this.disposables = this._register(( (new DisposableStore())));
1480
- }
1481
- async fetchRoots() {
1482
- this.disposables.clear();
1483
- const inMemoryProvider = this._register(( (new InMemoryFileSystemProvider())));
1484
- this.disposables.add(this.fileService.registerProvider(USER_DATA_PROFILE_IMPORT_PREVIEW_SCHEME, inMemoryProvider));
1485
- const roots = [];
1486
- const importPreviewProfle = toUserDataProfile(generateUuid(), this.profile.name, URI.file('/root').with({ scheme: USER_DATA_PROFILE_IMPORT_PREVIEW_SCHEME }), URI.file('/cache').with({ scheme: USER_DATA_PROFILE_IMPORT_PREVIEW_SCHEME }));
1487
- if (this.profile.settings) {
1488
- const settingsResource = this.instantiationService.createInstance(SettingsResource);
1489
- await settingsResource.apply(this.profile.settings, importPreviewProfle);
1490
- const settingsResourceTreeItem = this.instantiationService.createInstance(SettingsResourceTreeItem, importPreviewProfle);
1491
- if (await settingsResourceTreeItem.hasContent()) {
1492
- roots.push(settingsResourceTreeItem);
1493
- }
1494
- }
1495
- if (this.profile.keybindings) {
1496
- const keybindingsResource = this.instantiationService.createInstance(KeybindingsResource);
1497
- await keybindingsResource.apply(this.profile.keybindings, importPreviewProfle);
1498
- const keybindingsResourceTreeItem = this.instantiationService.createInstance(KeybindingsResourceTreeItem, importPreviewProfle);
1499
- if (await keybindingsResourceTreeItem.hasContent()) {
1500
- roots.push(keybindingsResourceTreeItem);
1501
- }
1502
- }
1503
- if (this.profile.snippets) {
1504
- const snippetsResource = this.instantiationService.createInstance(SnippetsResource);
1505
- await snippetsResource.apply(this.profile.snippets, importPreviewProfle);
1506
- const snippetsResourceTreeItem = this.instantiationService.createInstance(SnippetsResourceTreeItem, importPreviewProfle);
1507
- if (await snippetsResourceTreeItem.hasContent()) {
1508
- roots.push(snippetsResourceTreeItem);
1509
- }
1510
- }
1511
- if (this.profile.tasks) {
1512
- const tasksResource = this.instantiationService.createInstance(TasksResource);
1513
- await tasksResource.apply(this.profile.tasks, importPreviewProfle);
1514
- const tasksResourceTreeItem = this.instantiationService.createInstance(TasksResourceTreeItem, importPreviewProfle);
1515
- if (await tasksResourceTreeItem.hasContent()) {
1516
- roots.push(tasksResourceTreeItem);
1517
- }
1518
- }
1519
- if (this.profile.globalState) {
1520
- const globalStateResource = joinPath(importPreviewProfle.globalStorageHome, 'globalState.json');
1521
- const content = VSBuffer.fromString(JSON.stringify(JSON.parse(this.profile.globalState), null, '\t'));
1522
- if (content) {
1523
- await this.fileService.writeFile(globalStateResource, content);
1524
- roots.push(this.instantiationService.createInstance(GlobalStateResourceImportTreeItem, this.profile.globalState, globalStateResource));
1525
- }
1526
- }
1527
- if (this.profile.extensions) {
1528
- const extensionsResourceTreeItem = this.instantiationService.createInstance(ExtensionsResourceImportTreeItem, this.profile.extensions);
1529
- if (await extensionsResourceTreeItem.hasContent()) {
1530
- roots.push(extensionsResourceTreeItem);
1531
- }
1532
- }
1533
- inMemoryProvider.setReadOnly(true);
1534
- return roots;
1535
- }
1536
- isEmpty() {
1537
- return !(this.profile.settings || this.profile.keybindings || this.profile.tasks || this.profile.snippets || this.profile.globalState || this.profile.extensions);
1538
- }
1539
- async getProfileTemplateToImport() {
1540
- return this.getProfileTemplate(this.profile.name, this.profile.icon);
1541
- }
1542
- };
1543
- UserDataProfileImportState = ( (__decorate([
1544
- ( (__param(1, IFileService))),
1545
- ( (__param(2, IQuickInputService))),
1546
- ( (__param(3, IInstantiationService)))
1547
- ], UserDataProfileImportState)));
1548
- class BarrierAction extends Action {
1549
- constructor(barrier, action, notificationService) {
1550
- super(action.id, action.label, action.class, action.enabled, async () => {
1551
- try {
1552
- await action.run();
1553
- }
1554
- catch (error) {
1555
- notificationService.error(error);
1556
- throw error;
1557
- }
1558
- barrier.open();
1559
- });
1560
- }
1561
- }
1562
742
 
1563
743
  export { UserDataProfileImportExportService };