@codingame/monaco-vscode-user-data-profile-service-override 25.1.2 → 26.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js +18 -15
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +31 -19
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css +9 -4
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +144 -115
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +16 -10
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +889 -623
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +449 -296
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +6 -8
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +135 -77
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +33 -32
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +33 -34
- package/vscode/src/vs/workbench/services/userDataProfile/browser/mcpProfileResource.js +28 -33
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +42 -40
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +23 -28
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +28 -33
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +209 -153
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +28 -25
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +55 -41
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +20 -9
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +111 -73
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +20 -15
- package/vscode/src/vs/base/browser/ui/radio/radio.css +0 -69
- package/vscode/src/vs/base/browser/ui/radio/radio.d.ts +0 -37
- package/vscode/src/vs/base/browser/ui/radio/radio.js +0 -72
package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js
CHANGED
|
@@ -55,7 +55,22 @@ function isProfileResourceChildElement(element) {
|
|
|
55
55
|
return element.label !== undefined;
|
|
56
56
|
}
|
|
57
57
|
let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extends Disposable {
|
|
58
|
-
constructor(
|
|
58
|
+
constructor(
|
|
59
|
+
name,
|
|
60
|
+
icon,
|
|
61
|
+
flags,
|
|
62
|
+
workspaces,
|
|
63
|
+
isActive,
|
|
64
|
+
userDataProfileManagementService,
|
|
65
|
+
userDataProfilesService,
|
|
66
|
+
commandService,
|
|
67
|
+
workspaceContextService,
|
|
68
|
+
hostService,
|
|
69
|
+
uriIdentityService,
|
|
70
|
+
fileService,
|
|
71
|
+
extensionManagementService,
|
|
72
|
+
instantiationService
|
|
73
|
+
) {
|
|
59
74
|
super();
|
|
60
75
|
this.userDataProfileManagementService = userDataProfileManagementService;
|
|
61
76
|
this.userDataProfilesService = userDataProfilesService;
|
|
@@ -69,7 +84,7 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
69
84
|
this._onDidChange = this._register(( new Emitter()));
|
|
70
85
|
this.onDidChange = this._onDidChange.event;
|
|
71
86
|
this.saveScheduler = this._register(( new RunOnceScheduler(() => this.doSave(), 500)));
|
|
72
|
-
this._name =
|
|
87
|
+
this._name = "";
|
|
73
88
|
this._active = false;
|
|
74
89
|
this._disabled = false;
|
|
75
90
|
this._name = name;
|
|
@@ -83,101 +98,140 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
83
98
|
}
|
|
84
99
|
this.save();
|
|
85
100
|
}));
|
|
86
|
-
this._register(
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
101
|
+
this._register(
|
|
102
|
+
this.extensionManagementService.onProfileAwareDidInstallExtensions(results => {
|
|
103
|
+
const profile = this.getProfileToWatch();
|
|
104
|
+
if (profile && ( results.some(
|
|
105
|
+
r => !r.error && (r.applicationScoped || this.uriIdentityService.extUri.isEqual(r.profileLocation, profile.extensionsResource))
|
|
106
|
+
))) {
|
|
107
|
+
this._onDidChange.fire({
|
|
108
|
+
extensions: true
|
|
109
|
+
});
|
|
110
|
+
}
|
|
111
|
+
})
|
|
112
|
+
);
|
|
94
113
|
this._register(this.extensionManagementService.onProfileAwareDidUninstallExtension(e => {
|
|
95
114
|
const profile = this.getProfileToWatch();
|
|
96
115
|
if (profile && !e.error && (e.applicationScoped || this.uriIdentityService.extUri.isEqual(e.profileLocation, profile.extensionsResource))) {
|
|
97
|
-
this._onDidChange.fire({
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
this._register(this.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata(e => {
|
|
101
|
-
const profile = this.getProfileToWatch();
|
|
102
|
-
if (profile && e.local.isApplicationScoped || this.uriIdentityService.extUri.isEqual(e.profileLocation, profile?.extensionsResource)) {
|
|
103
|
-
this._onDidChange.fire({ extensions: true });
|
|
116
|
+
this._onDidChange.fire({
|
|
117
|
+
extensions: true
|
|
118
|
+
});
|
|
104
119
|
}
|
|
105
120
|
}));
|
|
121
|
+
this._register(
|
|
122
|
+
this.extensionManagementService.onProfileAwareDidUpdateExtensionMetadata(e => {
|
|
123
|
+
const profile = this.getProfileToWatch();
|
|
124
|
+
if (profile && e.local.isApplicationScoped || this.uriIdentityService.extUri.isEqual(e.profileLocation, profile?.extensionsResource)) {
|
|
125
|
+
this._onDidChange.fire({
|
|
126
|
+
extensions: true
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
})
|
|
130
|
+
);
|
|
131
|
+
}
|
|
132
|
+
get name() {
|
|
133
|
+
return this._name;
|
|
106
134
|
}
|
|
107
|
-
get name() { return this._name; }
|
|
108
135
|
set name(name) {
|
|
109
136
|
name = name.trim();
|
|
110
137
|
if (this._name !== name) {
|
|
111
138
|
this._name = name;
|
|
112
|
-
this._onDidChange.fire({
|
|
139
|
+
this._onDidChange.fire({
|
|
140
|
+
name: true
|
|
141
|
+
});
|
|
113
142
|
}
|
|
114
143
|
}
|
|
115
|
-
get icon() {
|
|
144
|
+
get icon() {
|
|
145
|
+
return this._icon;
|
|
146
|
+
}
|
|
116
147
|
set icon(icon) {
|
|
117
148
|
if (this._icon !== icon) {
|
|
118
149
|
this._icon = icon;
|
|
119
|
-
this._onDidChange.fire({
|
|
150
|
+
this._onDidChange.fire({
|
|
151
|
+
icon: true
|
|
152
|
+
});
|
|
120
153
|
}
|
|
121
154
|
}
|
|
122
|
-
get workspaces() {
|
|
155
|
+
get workspaces() {
|
|
156
|
+
return this._workspaces;
|
|
157
|
+
}
|
|
123
158
|
set workspaces(workspaces) {
|
|
124
159
|
if (!equals(this._workspaces, workspaces, (a, b) => ( a.toString()) === ( b.toString()))) {
|
|
125
160
|
this._workspaces = workspaces;
|
|
126
|
-
this._onDidChange.fire({
|
|
161
|
+
this._onDidChange.fire({
|
|
162
|
+
workspaces: true
|
|
163
|
+
});
|
|
127
164
|
}
|
|
128
165
|
}
|
|
129
|
-
get flags() {
|
|
166
|
+
get flags() {
|
|
167
|
+
return this._flags;
|
|
168
|
+
}
|
|
130
169
|
set flags(flags) {
|
|
131
170
|
if (!equals$1(this._flags, flags)) {
|
|
132
171
|
this._flags = flags;
|
|
133
|
-
this._onDidChange.fire({
|
|
172
|
+
this._onDidChange.fire({
|
|
173
|
+
flags: true
|
|
174
|
+
});
|
|
134
175
|
}
|
|
135
176
|
}
|
|
136
|
-
get active() {
|
|
177
|
+
get active() {
|
|
178
|
+
return this._active;
|
|
179
|
+
}
|
|
137
180
|
set active(active) {
|
|
138
181
|
if (this._active !== active) {
|
|
139
182
|
this._active = active;
|
|
140
|
-
this._onDidChange.fire({
|
|
183
|
+
this._onDidChange.fire({
|
|
184
|
+
active: true
|
|
185
|
+
});
|
|
141
186
|
}
|
|
142
187
|
}
|
|
143
|
-
get message() {
|
|
188
|
+
get message() {
|
|
189
|
+
return this._message;
|
|
190
|
+
}
|
|
144
191
|
set message(message) {
|
|
145
192
|
if (this._message !== message) {
|
|
146
193
|
this._message = message;
|
|
147
|
-
this._onDidChange.fire({
|
|
194
|
+
this._onDidChange.fire({
|
|
195
|
+
message: true
|
|
196
|
+
});
|
|
148
197
|
}
|
|
149
198
|
}
|
|
150
|
-
get disabled() {
|
|
199
|
+
get disabled() {
|
|
200
|
+
return this._disabled;
|
|
201
|
+
}
|
|
151
202
|
set disabled(saving) {
|
|
152
203
|
if (this._disabled !== saving) {
|
|
153
204
|
this._disabled = saving;
|
|
154
|
-
this._onDidChange.fire({
|
|
205
|
+
this._onDidChange.fire({
|
|
206
|
+
disabled: true
|
|
207
|
+
});
|
|
155
208
|
}
|
|
156
209
|
}
|
|
157
210
|
getFlag(key) {
|
|
158
211
|
return this.flags?.[key] ?? false;
|
|
159
212
|
}
|
|
160
213
|
setFlag(key, value) {
|
|
161
|
-
const flags = this.flags ? {
|
|
214
|
+
const flags = this.flags ? {
|
|
215
|
+
...this.flags
|
|
216
|
+
} : {};
|
|
162
217
|
if (value) {
|
|
163
218
|
flags[key] = true;
|
|
164
|
-
}
|
|
165
|
-
else {
|
|
219
|
+
} else {
|
|
166
220
|
delete flags[key];
|
|
167
221
|
}
|
|
168
222
|
this.flags = flags;
|
|
169
223
|
}
|
|
170
224
|
validate() {
|
|
171
225
|
if (!this.name) {
|
|
172
|
-
this.message = ( localize(
|
|
226
|
+
this.message = ( localize(13384, "Profile name is required and must be a non-empty value."));
|
|
173
227
|
return;
|
|
174
228
|
}
|
|
175
229
|
if (this.shouldValidateName() && this.name !== this.getInitialName() && ( this.userDataProfilesService.profiles.some(p => p.name === this.name))) {
|
|
176
|
-
this.message = ( localize(
|
|
230
|
+
this.message = ( localize(13385, "Profile with name {0} already exists.", this.name));
|
|
177
231
|
return;
|
|
178
232
|
}
|
|
179
233
|
if (this.flags && this.flags.settings && this.flags.keybindings && this.flags.tasks && this.flags.snippets && this.flags.extensions) {
|
|
180
|
-
this.message = ( localize(
|
|
234
|
+
this.message = ( localize(13386, "The profile should contain at least one configuration."));
|
|
181
235
|
return;
|
|
182
236
|
}
|
|
183
237
|
this.message = undefined;
|
|
@@ -192,23 +246,18 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
192
246
|
ProfileResourceType.Snippets,
|
|
193
247
|
ProfileResourceType.Extensions
|
|
194
248
|
];
|
|
195
|
-
return Promise.all(( resourceTypes.map(async
|
|
196
|
-
const children = (r === ProfileResourceType.Settings
|
|
197
|
-
|| r === ProfileResourceType.Keybindings
|
|
198
|
-
|| r === ProfileResourceType.Tasks
|
|
199
|
-
|| r === ProfileResourceType.Mcp) ? await this.getChildrenForResourceType(r) : [];
|
|
249
|
+
return Promise.all(( resourceTypes.map(async r => {
|
|
250
|
+
const children = (r === ProfileResourceType.Settings || r === ProfileResourceType.Keybindings || r === ProfileResourceType.Tasks || r === ProfileResourceType.Mcp) ? await this.getChildrenForResourceType(r) : [];
|
|
200
251
|
return {
|
|
201
252
|
handle: r,
|
|
202
253
|
checkbox: undefined,
|
|
203
254
|
resourceType: r,
|
|
204
|
-
openAction: children.length
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
})
|
|
211
|
-
: undefined
|
|
255
|
+
openAction: children.length ? toAction({
|
|
256
|
+
id: "_open",
|
|
257
|
+
label: ( localize(13387, "Open to the Side")),
|
|
258
|
+
class: ThemeIcon.asClassName(Codicon.goToFile),
|
|
259
|
+
run: () => children[0]?.openAction?.run()
|
|
260
|
+
}) : undefined
|
|
212
261
|
};
|
|
213
262
|
})));
|
|
214
263
|
}
|
|
@@ -221,24 +270,24 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
221
270
|
profile = this.getFlag(resourceType) ? this.userDataProfilesService.defaultProfile : profile;
|
|
222
271
|
let children = [];
|
|
223
272
|
switch (resourceType) {
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
273
|
+
case ProfileResourceType.Settings:
|
|
274
|
+
children = await this.instantiationService.createInstance(SettingsResourceTreeItem, profile).getChildren();
|
|
275
|
+
break;
|
|
276
|
+
case ProfileResourceType.Keybindings:
|
|
277
|
+
children = await this.instantiationService.createInstance(KeybindingsResourceTreeItem, profile).getChildren();
|
|
278
|
+
break;
|
|
279
|
+
case ProfileResourceType.Snippets:
|
|
280
|
+
children = (await this.instantiationService.createInstance(SnippetsResourceTreeItem, profile).getChildren()) ?? [];
|
|
281
|
+
break;
|
|
282
|
+
case ProfileResourceType.Tasks:
|
|
283
|
+
children = await this.instantiationService.createInstance(TasksResourceTreeItem, profile).getChildren();
|
|
284
|
+
break;
|
|
285
|
+
case ProfileResourceType.Mcp:
|
|
286
|
+
children = await this.instantiationService.createInstance(McpResourceTreeItem, profile).getChildren();
|
|
287
|
+
break;
|
|
288
|
+
case ProfileResourceType.Extensions:
|
|
289
|
+
children = await this.instantiationService.createInstance(ExtensionsResourceExportTreeItem, profile).getChildren();
|
|
290
|
+
break;
|
|
242
291
|
}
|
|
243
292
|
return ( children.map(child => this.toUserDataProfileResourceChildElement(child)));
|
|
244
293
|
}
|
|
@@ -246,31 +295,30 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
246
295
|
return {
|
|
247
296
|
handle: child.handle,
|
|
248
297
|
checkbox: child.checkbox,
|
|
249
|
-
label: child.label ? (isMarkdownString(child.label.label) ? child.label.label.value : child.label.label) :
|
|
298
|
+
label: child.label ? (isMarkdownString(child.label.label) ? child.label.label.value : child.label.label) : "",
|
|
250
299
|
description: isString(child.description) ? child.description : undefined,
|
|
251
300
|
resource: URI.revive(child.resourceUri),
|
|
252
301
|
icon: child.themeIcon,
|
|
253
302
|
openAction: toAction({
|
|
254
|
-
id:
|
|
255
|
-
label: ( localize(
|
|
303
|
+
id: "_openChild",
|
|
304
|
+
label: ( localize(13387, "Open to the Side")),
|
|
256
305
|
class: ThemeIcon.asClassName(Codicon.goToFile),
|
|
257
306
|
run: async () => {
|
|
258
307
|
if (child.parent.type === ProfileResourceType.Extensions) {
|
|
259
|
-
await this.commandService.executeCommand(
|
|
260
|
-
}
|
|
261
|
-
else if (child.resourceUri) {
|
|
308
|
+
await this.commandService.executeCommand("extension.open", child.handle, undefined, true, undefined, true);
|
|
309
|
+
} else if (child.resourceUri) {
|
|
262
310
|
await this.commandService.executeCommand(API_OPEN_EDITOR_COMMAND_ID, child.resourceUri, [SIDE_GROUP], undefined);
|
|
263
311
|
}
|
|
264
312
|
}
|
|
265
313
|
}),
|
|
266
314
|
actions: {
|
|
267
315
|
primary: primaryActions,
|
|
268
|
-
contextMenu: contextMenuActions
|
|
316
|
+
contextMenu: contextMenuActions
|
|
269
317
|
}
|
|
270
318
|
};
|
|
271
319
|
}
|
|
272
320
|
getInitialName() {
|
|
273
|
-
return
|
|
321
|
+
return "";
|
|
274
322
|
}
|
|
275
323
|
shouldValidateName() {
|
|
276
324
|
return true;
|
|
@@ -281,10 +329,17 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
281
329
|
}
|
|
282
330
|
openWorkspace(workspace) {
|
|
283
331
|
if (this.uriIdentityService.extUri.extname(workspace) === WORKSPACE_SUFFIX) {
|
|
284
|
-
this.hostService.openWindow([{
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
332
|
+
this.hostService.openWindow([{
|
|
333
|
+
workspaceUri: workspace
|
|
334
|
+
}], {
|
|
335
|
+
forceNewWindow: true
|
|
336
|
+
});
|
|
337
|
+
} else {
|
|
338
|
+
this.hostService.openWindow([{
|
|
339
|
+
folderUri: workspace
|
|
340
|
+
}], {
|
|
341
|
+
forceNewWindow: true
|
|
342
|
+
});
|
|
288
343
|
}
|
|
289
344
|
}
|
|
290
345
|
save() {
|
|
@@ -313,9 +368,7 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
313
368
|
if (this.message) {
|
|
314
369
|
return;
|
|
315
370
|
}
|
|
316
|
-
const useDefaultFlags = this.flags
|
|
317
|
-
? this.flags.settings && this.flags.keybindings && this.flags.tasks && this.flags.globalState && this.flags.extensions ? undefined : this.flags
|
|
318
|
-
: undefined;
|
|
371
|
+
const useDefaultFlags = this.flags ? this.flags.settings && this.flags.keybindings && this.flags.tasks && this.flags.globalState && this.flags.extensions ? undefined : this.flags : undefined;
|
|
319
372
|
return await this.userDataProfileManagementService.updateProfile(profile, {
|
|
320
373
|
name: this.name,
|
|
321
374
|
icon: this.icon,
|
|
@@ -324,21 +377,43 @@ let AbstractUserDataProfileElement = class AbstractUserDataProfileElement extend
|
|
|
324
377
|
});
|
|
325
378
|
}
|
|
326
379
|
};
|
|
327
|
-
AbstractUserDataProfileElement = ( __decorate([
|
|
328
|
-
( __param(5, IUserDataProfileManagementService)),
|
|
329
|
-
( __param(6, IUserDataProfilesService)),
|
|
330
|
-
( __param(7, ICommandService)),
|
|
331
|
-
( __param(8, IWorkspaceContextService)),
|
|
332
|
-
( __param(9, IHostService)),
|
|
333
|
-
( __param(10, IUriIdentityService)),
|
|
334
|
-
( __param(11, IFileService)),
|
|
335
|
-
( __param(12, IWorkbenchExtensionManagementService)),
|
|
336
|
-
( __param(13, IInstantiationService))
|
|
337
|
-
], AbstractUserDataProfileElement));
|
|
380
|
+
AbstractUserDataProfileElement = ( __decorate([( __param(5, IUserDataProfileManagementService)), ( __param(6, IUserDataProfilesService)), ( __param(7, ICommandService)), ( __param(8, IWorkspaceContextService)), ( __param(9, IHostService)), ( __param(10, IUriIdentityService)), ( __param(11, IFileService)), ( __param(12, IWorkbenchExtensionManagementService)), ( __param(13, IInstantiationService))], AbstractUserDataProfileElement));
|
|
338
381
|
let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDataProfileElement {
|
|
339
|
-
get profile() {
|
|
340
|
-
|
|
341
|
-
|
|
382
|
+
get profile() {
|
|
383
|
+
return this._profile;
|
|
384
|
+
}
|
|
385
|
+
constructor(
|
|
386
|
+
_profile,
|
|
387
|
+
titleButtons,
|
|
388
|
+
actions,
|
|
389
|
+
userDataProfileService,
|
|
390
|
+
configurationService,
|
|
391
|
+
userDataProfileManagementService,
|
|
392
|
+
userDataProfilesService,
|
|
393
|
+
commandService,
|
|
394
|
+
workspaceContextService,
|
|
395
|
+
hostService,
|
|
396
|
+
uriIdentityService,
|
|
397
|
+
fileService,
|
|
398
|
+
extensionManagementService,
|
|
399
|
+
instantiationService
|
|
400
|
+
) {
|
|
401
|
+
super(
|
|
402
|
+
_profile.name,
|
|
403
|
+
_profile.icon,
|
|
404
|
+
_profile.useDefaultFlags,
|
|
405
|
+
_profile.workspaces,
|
|
406
|
+
userDataProfileService.currentProfile.id === _profile.id,
|
|
407
|
+
userDataProfileManagementService,
|
|
408
|
+
userDataProfilesService,
|
|
409
|
+
commandService,
|
|
410
|
+
workspaceContextService,
|
|
411
|
+
hostService,
|
|
412
|
+
uriIdentityService,
|
|
413
|
+
fileService,
|
|
414
|
+
extensionManagementService,
|
|
415
|
+
instantiationService
|
|
416
|
+
);
|
|
342
417
|
this._profile = _profile;
|
|
343
418
|
this.titleButtons = titleButtons;
|
|
344
419
|
this.actions = actions;
|
|
@@ -351,19 +426,29 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
|
|
|
351
426
|
this.isNewWindowProfile = this.configurationService.getValue(CONFIG_NEW_WINDOW_PROFILE) === this.profile.name;
|
|
352
427
|
}
|
|
353
428
|
}));
|
|
354
|
-
this._register(this.userDataProfileService.onDidChangeCurrentProfile(
|
|
355
|
-
|
|
429
|
+
this._register(this.userDataProfileService.onDidChangeCurrentProfile(
|
|
430
|
+
() => this.active = this.userDataProfileService.currentProfile.id === this.profile.id
|
|
431
|
+
));
|
|
432
|
+
this._register(this.userDataProfilesService.onDidChangeProfiles((
|
|
433
|
+
{
|
|
434
|
+
updated
|
|
435
|
+
}
|
|
436
|
+
) => {
|
|
356
437
|
const profile = updated.find(p => p.id === this.profile.id);
|
|
357
438
|
if (profile) {
|
|
358
439
|
this._profile = profile;
|
|
359
440
|
this.reset();
|
|
360
|
-
this._onDidChange.fire({
|
|
441
|
+
this._onDidChange.fire({
|
|
442
|
+
profile: true
|
|
443
|
+
});
|
|
361
444
|
}
|
|
362
445
|
}));
|
|
363
446
|
this._register(fileService.watch(this.profile.snippetsHome));
|
|
364
447
|
this._register(fileService.onDidFilesChange(e => {
|
|
365
448
|
if (e.affects(this.profile.snippetsHome)) {
|
|
366
|
-
this._onDidChange.fire({
|
|
449
|
+
this._onDidChange.fire({
|
|
450
|
+
snippets: true
|
|
451
|
+
});
|
|
367
452
|
}
|
|
368
453
|
}));
|
|
369
454
|
}
|
|
@@ -389,23 +474,25 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
|
|
|
389
474
|
async toggleNewWindowProfile() {
|
|
390
475
|
if (this._isNewWindowProfile) {
|
|
391
476
|
await this.configurationService.updateValue(CONFIG_NEW_WINDOW_PROFILE, null);
|
|
392
|
-
}
|
|
393
|
-
else {
|
|
477
|
+
} else {
|
|
394
478
|
await this.configurationService.updateValue(CONFIG_NEW_WINDOW_PROFILE, this.profile.name);
|
|
395
479
|
}
|
|
396
480
|
}
|
|
397
|
-
get isNewWindowProfile() {
|
|
481
|
+
get isNewWindowProfile() {
|
|
482
|
+
return this._isNewWindowProfile;
|
|
483
|
+
}
|
|
398
484
|
set isNewWindowProfile(isNewWindowProfile) {
|
|
399
485
|
if (this._isNewWindowProfile !== isNewWindowProfile) {
|
|
400
486
|
this._isNewWindowProfile = isNewWindowProfile;
|
|
401
|
-
this._onDidChange.fire({
|
|
487
|
+
this._onDidChange.fire({
|
|
488
|
+
newWindowProfile: true
|
|
489
|
+
});
|
|
402
490
|
}
|
|
403
491
|
}
|
|
404
492
|
async toggleCurrentWindowProfile() {
|
|
405
493
|
if (this.userDataProfileService.currentProfile.id === this.profile.id) {
|
|
406
494
|
await this.userDataProfileManagementService.switchProfile(this.userDataProfilesService.defaultProfile);
|
|
407
|
-
}
|
|
408
|
-
else {
|
|
495
|
+
} else {
|
|
409
496
|
await this.userDataProfileManagementService.switchProfile(this.profile);
|
|
410
497
|
}
|
|
411
498
|
}
|
|
@@ -416,20 +503,20 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
|
|
|
416
503
|
if (resourceType === ProfileResourceType.Extensions) {
|
|
417
504
|
const children = await this.instantiationService.createInstance(ExtensionsResourceExportTreeItem, this.profile).getChildren();
|
|
418
505
|
return (children.map(child => this.toUserDataProfileResourceChildElement(child, undefined, [{
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
|
|
427
|
-
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
}
|
|
506
|
+
id: "applyToAllProfiles",
|
|
507
|
+
label: ( localize(13388, "Apply Extension to all Profiles")),
|
|
508
|
+
checked: child.applicationScoped,
|
|
509
|
+
enabled: true,
|
|
510
|
+
class: "",
|
|
511
|
+
tooltip: "",
|
|
512
|
+
run: async () => {
|
|
513
|
+
const extensions = await this.extensionManagementService.getInstalled(undefined, this.profile.extensionsResource);
|
|
514
|
+
const extension = extensions.find(e => areSameExtensions(e.identifier, child.identifier));
|
|
515
|
+
if (extension) {
|
|
516
|
+
await this.extensionManagementService.toggleApplicationScope(extension, this.profile.extensionsResource);
|
|
431
517
|
}
|
|
432
|
-
}
|
|
518
|
+
}
|
|
519
|
+
}])));
|
|
433
520
|
}
|
|
434
521
|
return this.getChildrenFromProfile(this.profile, resourceType);
|
|
435
522
|
}
|
|
@@ -437,24 +524,43 @@ let UserDataProfileElement = class UserDataProfileElement extends AbstractUserDa
|
|
|
437
524
|
return this.profile.name;
|
|
438
525
|
}
|
|
439
526
|
};
|
|
440
|
-
UserDataProfileElement = ( __decorate([
|
|
441
|
-
|
|
442
|
-
( __param(4, IConfigurationService)),
|
|
443
|
-
( __param(5, IUserDataProfileManagementService)),
|
|
444
|
-
( __param(6, IUserDataProfilesService)),
|
|
445
|
-
( __param(7, ICommandService)),
|
|
446
|
-
( __param(8, IWorkspaceContextService)),
|
|
447
|
-
( __param(9, IHostService)),
|
|
448
|
-
( __param(10, IUriIdentityService)),
|
|
449
|
-
( __param(11, IFileService)),
|
|
450
|
-
( __param(12, IWorkbenchExtensionManagementService)),
|
|
451
|
-
( __param(13, IInstantiationService))
|
|
452
|
-
], UserDataProfileElement));
|
|
453
|
-
const USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME = 'userdataprofiletemplatepreview';
|
|
527
|
+
UserDataProfileElement = ( __decorate([( __param(3, IUserDataProfileService)), ( __param(4, IConfigurationService)), ( __param(5, IUserDataProfileManagementService)), ( __param(6, IUserDataProfilesService)), ( __param(7, ICommandService)), ( __param(8, IWorkspaceContextService)), ( __param(9, IHostService)), ( __param(10, IUriIdentityService)), ( __param(11, IFileService)), ( __param(12, IWorkbenchExtensionManagementService)), ( __param(13, IInstantiationService))], UserDataProfileElement));
|
|
528
|
+
const USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME = "userdataprofiletemplatepreview";
|
|
454
529
|
let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileElement {
|
|
455
|
-
get copyFromTemplates() {
|
|
456
|
-
|
|
457
|
-
|
|
530
|
+
get copyFromTemplates() {
|
|
531
|
+
return this._copyFromTemplates;
|
|
532
|
+
}
|
|
533
|
+
constructor(
|
|
534
|
+
copyFrom,
|
|
535
|
+
titleButtons,
|
|
536
|
+
actions,
|
|
537
|
+
userDataProfileImportExportService,
|
|
538
|
+
userDataProfileManagementService,
|
|
539
|
+
userDataProfilesService,
|
|
540
|
+
commandService,
|
|
541
|
+
workspaceContextService,
|
|
542
|
+
hostService,
|
|
543
|
+
uriIdentityService,
|
|
544
|
+
fileService,
|
|
545
|
+
extensionManagementService,
|
|
546
|
+
instantiationService
|
|
547
|
+
) {
|
|
548
|
+
super(
|
|
549
|
+
"",
|
|
550
|
+
undefined,
|
|
551
|
+
undefined,
|
|
552
|
+
undefined,
|
|
553
|
+
false,
|
|
554
|
+
userDataProfileManagementService,
|
|
555
|
+
userDataProfilesService,
|
|
556
|
+
commandService,
|
|
557
|
+
workspaceContextService,
|
|
558
|
+
hostService,
|
|
559
|
+
uriIdentityService,
|
|
560
|
+
fileService,
|
|
561
|
+
extensionManagementService,
|
|
562
|
+
instantiationService
|
|
563
|
+
);
|
|
458
564
|
this.titleButtons = titleButtons;
|
|
459
565
|
this.actions = actions;
|
|
460
566
|
this.userDataProfileImportExportService = userDataProfileImportExportService;
|
|
@@ -465,18 +571,24 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
465
571
|
this._copyFrom = copyFrom;
|
|
466
572
|
this._copyFlags = this.getCopyFlagsFrom(copyFrom);
|
|
467
573
|
this.initialize();
|
|
468
|
-
this._register(
|
|
574
|
+
this._register(
|
|
575
|
+
this.fileService.registerProvider(USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME, this._register(( new InMemoryFileSystemProvider())))
|
|
576
|
+
);
|
|
469
577
|
this._register(toDisposable(() => {
|
|
470
578
|
if (this.previewProfile) {
|
|
471
579
|
this.userDataProfilesService.removeProfile(this.previewProfile);
|
|
472
580
|
}
|
|
473
581
|
}));
|
|
474
582
|
}
|
|
475
|
-
get copyFrom() {
|
|
583
|
+
get copyFrom() {
|
|
584
|
+
return this._copyFrom;
|
|
585
|
+
}
|
|
476
586
|
set copyFrom(copyFrom) {
|
|
477
587
|
if (this._copyFrom !== copyFrom) {
|
|
478
588
|
this._copyFrom = copyFrom;
|
|
479
|
-
this._onDidChange.fire({
|
|
589
|
+
this._onDidChange.fire({
|
|
590
|
+
copyFrom: true
|
|
591
|
+
});
|
|
480
592
|
this.flags = undefined;
|
|
481
593
|
this.copyFlags = this.getCopyFlagsFrom(copyFrom);
|
|
482
594
|
if (copyFrom instanceof URI) {
|
|
@@ -486,18 +598,26 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
486
598
|
this.initialize();
|
|
487
599
|
}
|
|
488
600
|
}
|
|
489
|
-
get copyFlags() {
|
|
601
|
+
get copyFlags() {
|
|
602
|
+
return this._copyFlags;
|
|
603
|
+
}
|
|
490
604
|
set copyFlags(flags) {
|
|
491
605
|
if (!equals$1(this._copyFlags, flags)) {
|
|
492
606
|
this._copyFlags = flags;
|
|
493
|
-
this._onDidChange.fire({
|
|
607
|
+
this._onDidChange.fire({
|
|
608
|
+
copyFlags: true
|
|
609
|
+
});
|
|
494
610
|
}
|
|
495
611
|
}
|
|
496
|
-
get previewProfile() {
|
|
612
|
+
get previewProfile() {
|
|
613
|
+
return this._previewProfile;
|
|
614
|
+
}
|
|
497
615
|
set previewProfile(profile) {
|
|
498
616
|
if (this._previewProfile !== profile) {
|
|
499
617
|
this._previewProfile = profile;
|
|
500
|
-
this._onDidChange.fire({
|
|
618
|
+
this._onDidChange.fire({
|
|
619
|
+
preview: true
|
|
620
|
+
});
|
|
501
621
|
this.previewProfileWatchDisposables.clear();
|
|
502
622
|
if (this._previewProfile) {
|
|
503
623
|
this.previewProfileWatchDisposables.add(this.fileService.watch(this._previewProfile.snippetsHome));
|
|
@@ -506,7 +626,9 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
506
626
|
return;
|
|
507
627
|
}
|
|
508
628
|
if (e.affects(this._previewProfile.snippetsHome)) {
|
|
509
|
-
this._onDidChange.fire({
|
|
629
|
+
this._onDidChange.fire({
|
|
630
|
+
snippets: true
|
|
631
|
+
});
|
|
510
632
|
}
|
|
511
633
|
}));
|
|
512
634
|
}
|
|
@@ -533,7 +655,7 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
533
655
|
if (this.template) {
|
|
534
656
|
this.copyFromTemplates.set(this.copyFrom, this.template.name);
|
|
535
657
|
if (this.defaultName === this.name) {
|
|
536
|
-
this.name = this.defaultName = this.template.name ??
|
|
658
|
+
this.name = this.defaultName = this.template.name ?? "";
|
|
537
659
|
}
|
|
538
660
|
if (this.defaultIcon === this.icon) {
|
|
539
661
|
this.icon = this.defaultIcon = this.template.icon;
|
|
@@ -544,13 +666,15 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
544
666
|
this.setCopyFlag(ProfileResourceType.Snippets, !!this.template.snippets);
|
|
545
667
|
this.setCopyFlag(ProfileResourceType.Extensions, !!this.template.extensions);
|
|
546
668
|
this.setCopyFlag(ProfileResourceType.Mcp, !!this.template.mcp);
|
|
547
|
-
this._onDidChange.fire({
|
|
669
|
+
this._onDidChange.fire({
|
|
670
|
+
copyFromInfo: true
|
|
671
|
+
});
|
|
548
672
|
}
|
|
549
673
|
return;
|
|
550
674
|
}
|
|
551
675
|
if (isUserDataProfile(this.copyFrom)) {
|
|
552
676
|
if (this.defaultName === this.name) {
|
|
553
|
-
this.name = this.defaultName = ( localize(
|
|
677
|
+
this.name = this.defaultName = ( localize(13389, "{0} (Copy)", this.copyFrom.name));
|
|
554
678
|
}
|
|
555
679
|
if (this.defaultIcon === this.icon) {
|
|
556
680
|
this.icon = this.defaultIcon = this.copyFrom.icon;
|
|
@@ -561,7 +685,9 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
561
685
|
this.setCopyFlag(ProfileResourceType.Snippets, true);
|
|
562
686
|
this.setCopyFlag(ProfileResourceType.Extensions, true);
|
|
563
687
|
this.setCopyFlag(ProfileResourceType.Mcp, true);
|
|
564
|
-
this._onDidChange.fire({
|
|
688
|
+
this._onDidChange.fire({
|
|
689
|
+
copyFromInfo: true
|
|
690
|
+
});
|
|
565
691
|
return;
|
|
566
692
|
}
|
|
567
693
|
if (this.defaultName === this.name) {
|
|
@@ -576,14 +702,15 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
576
702
|
this.setCopyFlag(ProfileResourceType.Snippets, false);
|
|
577
703
|
this.setCopyFlag(ProfileResourceType.Extensions, false);
|
|
578
704
|
this.setCopyFlag(ProfileResourceType.Mcp, false);
|
|
579
|
-
this._onDidChange.fire({
|
|
580
|
-
|
|
581
|
-
|
|
705
|
+
this._onDidChange.fire({
|
|
706
|
+
copyFromInfo: true
|
|
707
|
+
});
|
|
708
|
+
} finally {
|
|
582
709
|
this.disabled = false;
|
|
583
710
|
}
|
|
584
711
|
}
|
|
585
712
|
getNewProfileName() {
|
|
586
|
-
const name = ( localize(
|
|
713
|
+
const name = ( localize(13390, "Untitled"));
|
|
587
714
|
const nameRegEx = ( new RegExp(`${name}\\s(\\d+)`));
|
|
588
715
|
let nameIndex = 0;
|
|
589
716
|
for (const profile of this.userDataProfilesService.profiles) {
|
|
@@ -595,7 +722,7 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
595
722
|
}
|
|
596
723
|
async resolveTemplate(uri) {
|
|
597
724
|
if (!this.templatePromise) {
|
|
598
|
-
this.templatePromise = createCancelablePromise(async
|
|
725
|
+
this.templatePromise = createCancelablePromise(async token => {
|
|
599
726
|
const template = await this.userDataProfileImportExportService.resolveProfileTemplate(uri);
|
|
600
727
|
if (!token.isCancellationRequested) {
|
|
601
728
|
this.template = template;
|
|
@@ -608,16 +735,16 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
608
735
|
hasResource(resourceType) {
|
|
609
736
|
if (this.template) {
|
|
610
737
|
switch (resourceType) {
|
|
611
|
-
|
|
612
|
-
|
|
613
|
-
|
|
614
|
-
|
|
615
|
-
|
|
616
|
-
|
|
617
|
-
|
|
618
|
-
|
|
619
|
-
|
|
620
|
-
|
|
738
|
+
case ProfileResourceType.Settings:
|
|
739
|
+
return !!this.template.settings;
|
|
740
|
+
case ProfileResourceType.Keybindings:
|
|
741
|
+
return !!this.template.keybindings;
|
|
742
|
+
case ProfileResourceType.Snippets:
|
|
743
|
+
return !!this.template.snippets;
|
|
744
|
+
case ProfileResourceType.Tasks:
|
|
745
|
+
return !!this.template.tasks;
|
|
746
|
+
case ProfileResourceType.Extensions:
|
|
747
|
+
return !!this.template.extensions;
|
|
621
748
|
}
|
|
622
749
|
}
|
|
623
750
|
return true;
|
|
@@ -626,7 +753,9 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
626
753
|
return this.copyFlags?.[key] ?? false;
|
|
627
754
|
}
|
|
628
755
|
setCopyFlag(key, value) {
|
|
629
|
-
const flags = this.copyFlags ? {
|
|
756
|
+
const flags = this.copyFlags ? {
|
|
757
|
+
...this.copyFlags
|
|
758
|
+
} : {};
|
|
630
759
|
flags[key] = value;
|
|
631
760
|
this.copyFlags = flags;
|
|
632
761
|
}
|
|
@@ -662,50 +791,52 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
662
791
|
return [];
|
|
663
792
|
}
|
|
664
793
|
async getChildrenFromProfileTemplate(profileTemplate, resourceType) {
|
|
665
|
-
const location = ( URI.from(
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
669
|
-
|
|
670
|
-
|
|
794
|
+
const location = ( URI.from({
|
|
795
|
+
scheme: USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME,
|
|
796
|
+
path: `/root/profiles/${profileTemplate.name}`
|
|
797
|
+
}));
|
|
798
|
+
const cacheLocation = ( URI.from({
|
|
799
|
+
scheme: USER_DATA_PROFILE_TEMPLATE_PREVIEW_SCHEME,
|
|
800
|
+
path: `/root/cache/${profileTemplate.name}`
|
|
801
|
+
}));
|
|
671
802
|
const profile = toUserDataProfile(generateUuid(), this.name, location, cacheLocation);
|
|
672
803
|
switch (resourceType) {
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
682
|
-
|
|
683
|
-
|
|
684
|
-
|
|
685
|
-
|
|
686
|
-
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
804
|
+
case ProfileResourceType.Settings:
|
|
805
|
+
if (profileTemplate.settings) {
|
|
806
|
+
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
807
|
+
return this.getChildrenFromProfile(profile, resourceType);
|
|
808
|
+
}
|
|
809
|
+
return [];
|
|
810
|
+
case ProfileResourceType.Keybindings:
|
|
811
|
+
if (profileTemplate.keybindings) {
|
|
812
|
+
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
813
|
+
return this.getChildrenFromProfile(profile, resourceType);
|
|
814
|
+
}
|
|
815
|
+
return [];
|
|
816
|
+
case ProfileResourceType.Snippets:
|
|
817
|
+
if (profileTemplate.snippets) {
|
|
818
|
+
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
819
|
+
return this.getChildrenFromProfile(profile, resourceType);
|
|
820
|
+
}
|
|
821
|
+
return [];
|
|
822
|
+
case ProfileResourceType.Tasks:
|
|
823
|
+
if (profileTemplate.tasks) {
|
|
824
|
+
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
825
|
+
return this.getChildrenFromProfile(profile, resourceType);
|
|
826
|
+
}
|
|
827
|
+
return [];
|
|
828
|
+
case ProfileResourceType.Mcp:
|
|
829
|
+
if (profileTemplate.mcp) {
|
|
830
|
+
await this.instantiationService.createInstance(McpProfileResource).apply(profileTemplate.mcp, profile);
|
|
831
|
+
return this.getChildrenFromProfile(profile, resourceType);
|
|
832
|
+
}
|
|
833
|
+
return [];
|
|
834
|
+
case ProfileResourceType.Extensions:
|
|
835
|
+
if (profileTemplate.extensions) {
|
|
836
|
+
const children = await this.instantiationService.createInstance(ExtensionsResourceImportTreeItem, profileTemplate.extensions).getChildren();
|
|
837
|
+
return ( children.map(child => this.toUserDataProfileResourceChildElement(child)));
|
|
838
|
+
}
|
|
839
|
+
return [];
|
|
709
840
|
}
|
|
710
841
|
return [];
|
|
711
842
|
}
|
|
@@ -713,7 +844,7 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
713
844
|
return !this.copyFrom;
|
|
714
845
|
}
|
|
715
846
|
getInitialName() {
|
|
716
|
-
return this.previewProfile?.name ??
|
|
847
|
+
return this.previewProfile?.name ?? "";
|
|
717
848
|
}
|
|
718
849
|
async doSave() {
|
|
719
850
|
if (this.previewProfile) {
|
|
@@ -724,20 +855,11 @@ let NewProfileElement = class NewProfileElement extends AbstractUserDataProfileE
|
|
|
724
855
|
}
|
|
725
856
|
}
|
|
726
857
|
};
|
|
727
|
-
NewProfileElement = ( __decorate([
|
|
728
|
-
( __param(3, IUserDataProfileImportExportService)),
|
|
729
|
-
( __param(4, IUserDataProfileManagementService)),
|
|
730
|
-
( __param(5, IUserDataProfilesService)),
|
|
731
|
-
( __param(6, ICommandService)),
|
|
732
|
-
( __param(7, IWorkspaceContextService)),
|
|
733
|
-
( __param(8, IHostService)),
|
|
734
|
-
( __param(9, IUriIdentityService)),
|
|
735
|
-
( __param(10, IFileService)),
|
|
736
|
-
( __param(11, IWorkbenchExtensionManagementService)),
|
|
737
|
-
( __param(12, IInstantiationService))
|
|
738
|
-
], NewProfileElement));
|
|
858
|
+
NewProfileElement = ( __decorate([( __param(3, IUserDataProfileImportExportService)), ( __param(4, IUserDataProfileManagementService)), ( __param(5, IUserDataProfilesService)), ( __param(6, ICommandService)), ( __param(7, IWorkspaceContextService)), ( __param(8, IHostService)), ( __param(9, IUriIdentityService)), ( __param(10, IFileService)), ( __param(11, IWorkbenchExtensionManagementService)), ( __param(12, IInstantiationService))], NewProfileElement));
|
|
739
859
|
let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends EditorModel {
|
|
740
|
-
static {
|
|
860
|
+
static {
|
|
861
|
+
UserDataProfilesEditorModel_1 = this;
|
|
862
|
+
}
|
|
741
863
|
static getInstance(instantiationService) {
|
|
742
864
|
if (!UserDataProfilesEditorModel_1.INSTANCE) {
|
|
743
865
|
UserDataProfilesEditorModel_1.INSTANCE = instantiationService.createInstance(UserDataProfilesEditorModel_1);
|
|
@@ -745,9 +867,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
745
867
|
return UserDataProfilesEditorModel_1.INSTANCE;
|
|
746
868
|
}
|
|
747
869
|
get profiles() {
|
|
748
|
-
return ( this._profiles
|
|
749
|
-
.map(([profile]) => profile))
|
|
750
|
-
.sort((a, b) => {
|
|
870
|
+
return ( this._profiles.map(([profile]) => profile)).sort((a, b) => {
|
|
751
871
|
if (a instanceof NewProfileElement) {
|
|
752
872
|
return 1;
|
|
753
873
|
}
|
|
@@ -763,7 +883,18 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
763
883
|
return a.name.localeCompare(b.name);
|
|
764
884
|
});
|
|
765
885
|
}
|
|
766
|
-
constructor(
|
|
886
|
+
constructor(
|
|
887
|
+
userDataProfileService,
|
|
888
|
+
userDataProfilesService,
|
|
889
|
+
userDataProfileManagementService,
|
|
890
|
+
userDataProfileImportExportService,
|
|
891
|
+
dialogService,
|
|
892
|
+
telemetryService,
|
|
893
|
+
hostService,
|
|
894
|
+
productService,
|
|
895
|
+
openerService,
|
|
896
|
+
instantiationService
|
|
897
|
+
) {
|
|
767
898
|
super();
|
|
768
899
|
this.userDataProfileService = userDataProfileService;
|
|
769
900
|
this.userDataProfilesService = userDataProfilesService;
|
|
@@ -784,7 +915,9 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
784
915
|
}
|
|
785
916
|
}
|
|
786
917
|
this._register(toDisposable(() => ( this._profiles.splice(0, this._profiles.length).map(([, disposables]) => disposables.dispose()))));
|
|
787
|
-
this._register(
|
|
918
|
+
this._register(
|
|
919
|
+
userDataProfilesService.onDidChangeProfiles(e => this.onDidChangeProfiles(e))
|
|
920
|
+
);
|
|
788
921
|
}
|
|
789
922
|
onDidChangeProfiles(e) {
|
|
790
923
|
let changed = false;
|
|
@@ -798,7 +931,9 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
798
931
|
if (profile.id === this.newProfileElement?.previewProfile?.id) {
|
|
799
932
|
this.newProfileElement.previewProfile = undefined;
|
|
800
933
|
}
|
|
801
|
-
const index = this._profiles.findIndex(
|
|
934
|
+
const index = this._profiles.findIndex(
|
|
935
|
+
([p]) => p instanceof UserDataProfileElement && p.profile.id === profile.id
|
|
936
|
+
);
|
|
802
937
|
if (index !== -1) {
|
|
803
938
|
changed = true;
|
|
804
939
|
}
|
|
@@ -815,11 +950,11 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
815
950
|
}
|
|
816
951
|
createProfileElement(profile) {
|
|
817
952
|
const disposables = ( new DisposableStore());
|
|
818
|
-
const activateAction = disposables.add(( new Action(
|
|
819
|
-
const copyFromProfileAction = disposables.add(( new Action(
|
|
820
|
-
const exportAction = disposables.add(( new Action(
|
|
821
|
-
const deleteAction = disposables.add(( new Action(
|
|
822
|
-
const newWindowAction = disposables.add(( new Action(
|
|
953
|
+
const activateAction = disposables.add(( new Action("userDataProfile.activate", ( localize(13391, "Use this Profile for Current Window")), ThemeIcon.asClassName(Codicon.check), true, () => this.userDataProfileManagementService.switchProfile(profileElement.profile))));
|
|
954
|
+
const copyFromProfileAction = disposables.add(( new Action("userDataProfile.copyFromProfile", ( localize(13392, "Duplicate...")), ThemeIcon.asClassName(Codicon.copy), true, () => this.createNewProfile(profileElement.profile))));
|
|
955
|
+
const exportAction = disposables.add(( new Action("userDataProfile.export", ( localize(13393, "Export...")), ThemeIcon.asClassName(Codicon.export), true, () => this.userDataProfileImportExportService.exportProfile(profile))));
|
|
956
|
+
const deleteAction = disposables.add(( new Action("userDataProfile.delete", ( localize(13394, "Delete")), ThemeIcon.asClassName(Codicon.trash), true, () => this.removeProfile(profileElement.profile))));
|
|
957
|
+
const newWindowAction = disposables.add(( new Action("userDataProfile.newWindow", ( localize(13395, "Open New Window with this Profile")), ThemeIcon.asClassName(Codicon.emptyWindow), true, () => this.openWindow(profileElement.profile))));
|
|
823
958
|
const primaryActions = [];
|
|
824
959
|
primaryActions.push(activateAction);
|
|
825
960
|
primaryActions.push(newWindowAction);
|
|
@@ -830,21 +965,28 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
830
965
|
secondaryActions.push(( new Separator()));
|
|
831
966
|
secondaryActions.push(deleteAction);
|
|
832
967
|
}
|
|
833
|
-
const profileElement = disposables.add(this.instantiationService.createInstance(
|
|
968
|
+
const profileElement = disposables.add(this.instantiationService.createInstance(
|
|
969
|
+
UserDataProfileElement,
|
|
970
|
+
profile,
|
|
971
|
+
[[], []],
|
|
972
|
+
[primaryActions, secondaryActions]
|
|
973
|
+
));
|
|
834
974
|
activateAction.enabled = this.userDataProfileService.currentProfile.id !== profileElement.profile.id;
|
|
835
|
-
disposables.add(this.userDataProfileService.onDidChangeCurrentProfile(
|
|
975
|
+
disposables.add(this.userDataProfileService.onDidChangeCurrentProfile(
|
|
976
|
+
() => activateAction.enabled = this.userDataProfileService.currentProfile.id !== profileElement.profile.id
|
|
977
|
+
));
|
|
836
978
|
return [profileElement, disposables];
|
|
837
979
|
}
|
|
838
980
|
async createNewProfile(copyFrom) {
|
|
839
981
|
if (this.newProfileElement) {
|
|
840
982
|
const result = await this.dialogService.confirm({
|
|
841
|
-
type:
|
|
983
|
+
type: "info",
|
|
842
984
|
message: ( localize(
|
|
843
|
-
|
|
985
|
+
13396,
|
|
844
986
|
"A new profile is already being created. Do you want to discard it and create a new one?"
|
|
845
987
|
)),
|
|
846
|
-
primaryButton: ( localize(
|
|
847
|
-
cancelButton: ( localize(
|
|
988
|
+
primaryButton: ( localize(13397, "Discard & Create")),
|
|
989
|
+
cancelButton: ( localize(13398, "Cancel"))
|
|
848
990
|
});
|
|
849
991
|
if (!result.confirmed) {
|
|
850
992
|
return;
|
|
@@ -854,8 +996,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
854
996
|
if (copyFrom instanceof URI) {
|
|
855
997
|
try {
|
|
856
998
|
await this.userDataProfileImportExportService.resolveProfileTemplate(copyFrom);
|
|
857
|
-
}
|
|
858
|
-
catch (error) {
|
|
999
|
+
} catch (error) {
|
|
859
1000
|
this.dialogService.error(getErrorMessage(error));
|
|
860
1001
|
return;
|
|
861
1002
|
}
|
|
@@ -866,24 +1007,30 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
866
1007
|
disposables.add(toDisposable(() => cancellationTokenSource.dispose(true)));
|
|
867
1008
|
const primaryActions = [];
|
|
868
1009
|
const secondaryActions = [];
|
|
869
|
-
const createAction = disposables.add(( new Action(
|
|
1010
|
+
const createAction = disposables.add(( new Action("userDataProfile.create", ( localize(13399, "Create")), undefined, true, () => this.saveNewProfile(false, cancellationTokenSource.token))));
|
|
870
1011
|
primaryActions.push(createAction);
|
|
871
1012
|
if (isWeb && copyFrom instanceof URI && isProfileURL(copyFrom)) {
|
|
872
|
-
primaryActions.push(disposables.add(( new Action(
|
|
1013
|
+
primaryActions.push(disposables.add(( new Action("userDataProfile.createInDesktop", ( localize(13400, "Create in {0}", this.productService.nameLong)), undefined, true, () => this.openerService.open(copyFrom, {
|
|
1014
|
+
openExternal: true
|
|
1015
|
+
})))));
|
|
873
1016
|
}
|
|
874
|
-
const cancelAction = disposables.add(( new Action(
|
|
1017
|
+
const cancelAction = disposables.add(( new Action("userDataProfile.cancel", ( localize(13398, "Cancel")), ThemeIcon.asClassName(Codicon.trash), true, () => this.discardNewProfile())));
|
|
875
1018
|
secondaryActions.push(cancelAction);
|
|
876
|
-
const previewProfileAction = disposables.add(( new Action(
|
|
1019
|
+
const previewProfileAction = disposables.add(( new Action("userDataProfile.preview", ( localize(13401, "Preview")), ThemeIcon.asClassName(Codicon.openPreview), true, () => this.previewNewProfile(cancellationTokenSource.token))));
|
|
877
1020
|
secondaryActions.push(previewProfileAction);
|
|
878
|
-
const exportAction = disposables.add(( new Action(
|
|
879
|
-
this.newProfileElement = disposables.add(this.instantiationService.createInstance(
|
|
1021
|
+
const exportAction = disposables.add(( new Action("userDataProfile.export", ( localize(13393, "Export...")), ThemeIcon.asClassName(Codicon.export), isUserDataProfile(copyFrom), () => this.exportNewProfile(cancellationTokenSource.token))));
|
|
1022
|
+
this.newProfileElement = disposables.add(this.instantiationService.createInstance(
|
|
1023
|
+
NewProfileElement,
|
|
1024
|
+
copyFrom,
|
|
1025
|
+
[primaryActions, secondaryActions],
|
|
1026
|
+
[[cancelAction], [exportAction]]
|
|
1027
|
+
));
|
|
880
1028
|
const updateCreateActionLabel = () => {
|
|
881
1029
|
if (createAction.enabled) {
|
|
882
1030
|
if (this.newProfileElement?.copyFrom && ( this.userDataProfilesService.profiles.some(p => !p.isTransient && p.name === this.newProfileElement?.name))) {
|
|
883
|
-
createAction.label = ( localize(
|
|
884
|
-
}
|
|
885
|
-
|
|
886
|
-
createAction.label = ( localize(13037, "Create"));
|
|
1031
|
+
createAction.label = ( localize(13402, "Replace"));
|
|
1032
|
+
} else {
|
|
1033
|
+
createAction.label = ( localize(13399, "Create"));
|
|
887
1034
|
}
|
|
888
1035
|
}
|
|
889
1036
|
};
|
|
@@ -898,7 +1045,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
898
1045
|
exportAction.enabled = isUserDataProfile(this.newProfileElement?.copyFrom);
|
|
899
1046
|
}
|
|
900
1047
|
}));
|
|
901
|
-
disposables.add(this.userDataProfilesService.onDidChangeProfiles(
|
|
1048
|
+
disposables.add(this.userDataProfilesService.onDidChangeProfiles(e => {
|
|
902
1049
|
updateCreateActionLabel();
|
|
903
1050
|
this.newProfileElement?.validate();
|
|
904
1051
|
}));
|
|
@@ -929,8 +1076,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
929
1076
|
this.newProfileElement.previewProfile = profile;
|
|
930
1077
|
if (isWeb) {
|
|
931
1078
|
await this.userDataProfileManagementService.switchProfile(profile);
|
|
932
|
-
}
|
|
933
|
-
else {
|
|
1079
|
+
} else {
|
|
934
1080
|
await this.openWindow(profile);
|
|
935
1081
|
}
|
|
936
1082
|
}
|
|
@@ -942,10 +1088,17 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
942
1088
|
if (!isUserDataProfile(this.newProfileElement.copyFrom)) {
|
|
943
1089
|
return;
|
|
944
1090
|
}
|
|
945
|
-
const profile = toUserDataProfile(
|
|
946
|
-
|
|
947
|
-
|
|
948
|
-
|
|
1091
|
+
const profile = toUserDataProfile(
|
|
1092
|
+
generateUuid(),
|
|
1093
|
+
this.newProfileElement.name,
|
|
1094
|
+
this.newProfileElement.copyFrom.location,
|
|
1095
|
+
this.newProfileElement.copyFrom.cacheHome,
|
|
1096
|
+
{
|
|
1097
|
+
icon: this.newProfileElement.icon,
|
|
1098
|
+
useDefaultFlags: this.newProfileElement.flags
|
|
1099
|
+
},
|
|
1100
|
+
this.userDataProfilesService.defaultProfile
|
|
1101
|
+
);
|
|
949
1102
|
await this.userDataProfileImportExportService.exportProfile(profile, this.newProfileElement.copyFlags);
|
|
950
1103
|
}
|
|
951
1104
|
async saveNewProfile(transient, token) {
|
|
@@ -961,19 +1114,25 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
961
1114
|
try {
|
|
962
1115
|
if (this.newProfileElement.previewProfile) {
|
|
963
1116
|
if (!transient) {
|
|
964
|
-
profile = await this.userDataProfileManagementService.updateProfile(this.newProfileElement.previewProfile, {
|
|
1117
|
+
profile = await this.userDataProfileManagementService.updateProfile(this.newProfileElement.previewProfile, {
|
|
1118
|
+
transient: false
|
|
1119
|
+
});
|
|
965
1120
|
}
|
|
966
|
-
}
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
1121
|
+
} else {
|
|
1122
|
+
const {
|
|
1123
|
+
flags,
|
|
1124
|
+
icon,
|
|
1125
|
+
name,
|
|
1126
|
+
copyFrom
|
|
1127
|
+
} = this.newProfileElement;
|
|
1128
|
+
const useDefaultFlags = flags ? flags.settings && flags.keybindings && flags.tasks && flags.globalState && flags.extensions ? undefined : flags : undefined;
|
|
1129
|
+
const createProfileTelemetryData = {
|
|
1130
|
+
source: copyFrom instanceof URI ? "template" : isUserDataProfile(copyFrom) ? "profile" : copyFrom ? "external" : undefined
|
|
1131
|
+
};
|
|
973
1132
|
if (copyFrom instanceof URI) {
|
|
974
1133
|
const template = await this.newProfileElement.resolveTemplate(copyFrom);
|
|
975
1134
|
if (template) {
|
|
976
|
-
this.telemetryService.publicLog2(
|
|
1135
|
+
this.telemetryService.publicLog2("userDataProfile.createFromTemplate", createProfileTelemetryData);
|
|
977
1136
|
profile = await this.userDataProfileImportExportService.createProfileFromTemplate(template, {
|
|
978
1137
|
name,
|
|
979
1138
|
useDefaultFlags,
|
|
@@ -982,8 +1141,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
982
1141
|
transient
|
|
983
1142
|
}, token ?? CancellationToken.None);
|
|
984
1143
|
}
|
|
985
|
-
}
|
|
986
|
-
else if (isUserDataProfile(copyFrom)) {
|
|
1144
|
+
} else if (isUserDataProfile(copyFrom)) {
|
|
987
1145
|
profile = await this.userDataProfileImportExportService.createFromProfile(copyFrom, {
|
|
988
1146
|
name,
|
|
989
1147
|
useDefaultFlags,
|
|
@@ -991,13 +1149,15 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
991
1149
|
resourceTypeFlags: this.newProfileElement.copyFlags,
|
|
992
1150
|
transient
|
|
993
1151
|
}, token ?? CancellationToken.None);
|
|
994
|
-
}
|
|
995
|
-
|
|
996
|
-
|
|
1152
|
+
} else {
|
|
1153
|
+
profile = await this.userDataProfileManagementService.createProfile(name, {
|
|
1154
|
+
useDefaultFlags,
|
|
1155
|
+
icon,
|
|
1156
|
+
transient
|
|
1157
|
+
});
|
|
997
1158
|
}
|
|
998
1159
|
}
|
|
999
|
-
}
|
|
1000
|
-
finally {
|
|
1160
|
+
} finally {
|
|
1001
1161
|
if (this.newProfileElement) {
|
|
1002
1162
|
this.newProfileElement.disabled = false;
|
|
1003
1163
|
}
|
|
@@ -1006,9 +1166,7 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
1006
1166
|
if (profile) {
|
|
1007
1167
|
try {
|
|
1008
1168
|
await this.userDataProfileManagementService.removeProfile(profile);
|
|
1009
|
-
}
|
|
1010
|
-
catch (error) {
|
|
1011
|
-
}
|
|
1169
|
+
} catch (error) {}
|
|
1012
1170
|
}
|
|
1013
1171
|
return;
|
|
1014
1172
|
}
|
|
@@ -1017,9 +1175,13 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
1017
1175
|
const existing = this._profiles.find(([p]) => p.name === profile.name);
|
|
1018
1176
|
if (existing) {
|
|
1019
1177
|
this._onDidChange.fire(existing[0]);
|
|
1020
|
-
}
|
|
1021
|
-
|
|
1022
|
-
|
|
1178
|
+
} else {
|
|
1179
|
+
this.onDidChangeProfiles({
|
|
1180
|
+
added: [profile],
|
|
1181
|
+
removed: [],
|
|
1182
|
+
updated: [],
|
|
1183
|
+
all: this.userDataProfilesService.profiles
|
|
1184
|
+
});
|
|
1023
1185
|
}
|
|
1024
1186
|
}
|
|
1025
1187
|
return profile;
|
|
@@ -1037,30 +1199,21 @@ let UserDataProfilesEditorModel = class UserDataProfilesEditorModel extends Edit
|
|
|
1037
1199
|
}
|
|
1038
1200
|
async removeProfile(profile) {
|
|
1039
1201
|
const result = await this.dialogService.confirm({
|
|
1040
|
-
type:
|
|
1041
|
-
message: ( localize(
|
|
1042
|
-
primaryButton: ( localize(
|
|
1043
|
-
cancelButton: ( localize(
|
|
1202
|
+
type: "info",
|
|
1203
|
+
message: ( localize(13403, "Are you sure you want to delete the profile '{0}'?", profile.name)),
|
|
1204
|
+
primaryButton: ( localize(13394, "Delete")),
|
|
1205
|
+
cancelButton: ( localize(13398, "Cancel"))
|
|
1044
1206
|
});
|
|
1045
1207
|
if (result.confirmed) {
|
|
1046
1208
|
await this.userDataProfileManagementService.removeProfile(profile);
|
|
1047
1209
|
}
|
|
1048
1210
|
}
|
|
1049
1211
|
async openWindow(profile) {
|
|
1050
|
-
await this.hostService.openWindow({
|
|
1212
|
+
await this.hostService.openWindow({
|
|
1213
|
+
forceProfile: profile.name
|
|
1214
|
+
});
|
|
1051
1215
|
}
|
|
1052
1216
|
};
|
|
1053
|
-
UserDataProfilesEditorModel = UserDataProfilesEditorModel_1 = ( __decorate([
|
|
1054
|
-
( __param(0, IUserDataProfileService)),
|
|
1055
|
-
( __param(1, IUserDataProfilesService)),
|
|
1056
|
-
( __param(2, IUserDataProfileManagementService)),
|
|
1057
|
-
( __param(3, IUserDataProfileImportExportService)),
|
|
1058
|
-
( __param(4, IDialogService)),
|
|
1059
|
-
( __param(5, ITelemetryService)),
|
|
1060
|
-
( __param(6, IHostService)),
|
|
1061
|
-
( __param(7, IProductService)),
|
|
1062
|
-
( __param(8, IOpenerService)),
|
|
1063
|
-
( __param(9, IInstantiationService))
|
|
1064
|
-
], UserDataProfilesEditorModel));
|
|
1217
|
+
UserDataProfilesEditorModel = UserDataProfilesEditorModel_1 = ( __decorate([( __param(0, IUserDataProfileService)), ( __param(1, IUserDataProfilesService)), ( __param(2, IUserDataProfileManagementService)), ( __param(3, IUserDataProfileImportExportService)), ( __param(4, IDialogService)), ( __param(5, ITelemetryService)), ( __param(6, IHostService)), ( __param(7, IProductService)), ( __param(8, IOpenerService)), ( __param(9, IInstantiationService))], UserDataProfilesEditorModel));
|
|
1065
1218
|
|
|
1066
1219
|
export { AbstractUserDataProfileElement, NewProfileElement, UserDataProfileElement, UserDataProfilesEditorModel, isProfileResourceChildElement, isProfileResourceTypeElement };
|