@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
|
@@ -44,15 +44,24 @@ import { createCancelablePromise } from '@codingame/monaco-vscode-api/vscode/vs/
|
|
|
44
44
|
registerCss(userDataProfileView);
|
|
45
45
|
function isUserDataProfileTemplate(thing) {
|
|
46
46
|
const candidate = thing;
|
|
47
|
-
return !!(candidate && typeof candidate ===
|
|
48
|
-
&& (candidate.name && typeof candidate.name === 'string')
|
|
49
|
-
&& (isUndefined(candidate.icon) || typeof candidate.icon === 'string')
|
|
50
|
-
&& (isUndefined(candidate.settings) || typeof candidate.settings === 'string')
|
|
51
|
-
&& (isUndefined(candidate.globalState) || typeof candidate.globalState === 'string')
|
|
52
|
-
&& (isUndefined(candidate.extensions) || typeof candidate.extensions === 'string'));
|
|
47
|
+
return !!(candidate && typeof candidate === "object" && (candidate.name && typeof candidate.name === "string") && (isUndefined(candidate.icon) || typeof candidate.icon === "string") && (isUndefined(candidate.settings) || typeof candidate.settings === "string") && (isUndefined(candidate.globalState) || typeof candidate.globalState === "string") && (isUndefined(candidate.extensions) || typeof candidate.extensions === "string"));
|
|
53
48
|
}
|
|
54
49
|
let UserDataProfileImportExportService = class UserDataProfileImportExportService extends Disposable {
|
|
55
|
-
constructor(
|
|
50
|
+
constructor(
|
|
51
|
+
instantiationService,
|
|
52
|
+
userDataProfileService,
|
|
53
|
+
userDataProfileManagementService,
|
|
54
|
+
userDataProfilesService,
|
|
55
|
+
extensionService,
|
|
56
|
+
quickInputService,
|
|
57
|
+
progressService,
|
|
58
|
+
dialogService,
|
|
59
|
+
clipboardService,
|
|
60
|
+
openerService,
|
|
61
|
+
requestService,
|
|
62
|
+
productService,
|
|
63
|
+
uriIdentityService
|
|
64
|
+
) {
|
|
56
65
|
super();
|
|
57
66
|
this.instantiationService = instantiationService;
|
|
58
67
|
this.userDataProfileService = userDataProfileService;
|
|
@@ -68,7 +77,10 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
68
77
|
this.productService = productService;
|
|
69
78
|
this.uriIdentityService = uriIdentityService;
|
|
70
79
|
this.profileContentHandlers = ( new Map());
|
|
71
|
-
this.registerProfileContentHandler(
|
|
80
|
+
this.registerProfileContentHandler(
|
|
81
|
+
Schemas.file,
|
|
82
|
+
this.fileUserDataProfileContentHandler = instantiationService.createInstance(FileUserDataProfileContentHandler)
|
|
83
|
+
);
|
|
72
84
|
}
|
|
73
85
|
registerProfileContentHandler(id, profileContentHandler) {
|
|
74
86
|
if (( this.profileContentHandlers.has(id))) {
|
|
@@ -89,13 +101,23 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
89
101
|
location: ProgressLocation.Notification,
|
|
90
102
|
delay: 500,
|
|
91
103
|
sticky: true,
|
|
92
|
-
cancellable: true
|
|
93
|
-
}, async
|
|
94
|
-
const reportProgress =
|
|
95
|
-
|
|
96
|
-
|
|
104
|
+
cancellable: true
|
|
105
|
+
}, async progress => {
|
|
106
|
+
const reportProgress = message => progress.report({
|
|
107
|
+
message: ( localize(14919, "Create Profile: {0}", message))
|
|
108
|
+
});
|
|
109
|
+
creationPromise = createCancelablePromise(async token => {
|
|
110
|
+
const userDataProfilesExportState = disposables.add(
|
|
111
|
+
this.instantiationService.createInstance(UserDataProfileExportState, from, {
|
|
112
|
+
...options?.resourceTypeFlags,
|
|
113
|
+
extensions: false
|
|
114
|
+
})
|
|
115
|
+
);
|
|
97
116
|
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(options.name ?? from.name, options?.icon);
|
|
98
|
-
profile = await this.getProfileToImport({
|
|
117
|
+
profile = await this.getProfileToImport({
|
|
118
|
+
...profileTemplate,
|
|
119
|
+
name: options.name ?? profileTemplate.name
|
|
120
|
+
}, !!options.transient, options);
|
|
99
121
|
if (!profile) {
|
|
100
122
|
return;
|
|
101
123
|
}
|
|
@@ -107,11 +129,10 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
107
129
|
try {
|
|
108
130
|
await creationPromise;
|
|
109
131
|
if (profile && (options?.resourceTypeFlags?.extensions ?? true)) {
|
|
110
|
-
reportProgress(( localize(
|
|
132
|
+
reportProgress(( localize(14920, "Installing Extensions...")));
|
|
111
133
|
await this.instantiationService.createInstance(ExtensionsResource).copy(from, profile, false);
|
|
112
134
|
}
|
|
113
|
-
}
|
|
114
|
-
catch (error) {
|
|
135
|
+
} catch (error) {
|
|
115
136
|
if (profile) {
|
|
116
137
|
await this.userDataProfilesService.removeProfile(profile);
|
|
117
138
|
profile = undefined;
|
|
@@ -129,11 +150,16 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
129
150
|
location: ProgressLocation.Notification,
|
|
130
151
|
delay: 500,
|
|
131
152
|
sticky: true,
|
|
132
|
-
cancellable: true
|
|
133
|
-
}, async
|
|
134
|
-
const reportProgress =
|
|
135
|
-
|
|
136
|
-
|
|
153
|
+
cancellable: true
|
|
154
|
+
}, async progress => {
|
|
155
|
+
const reportProgress = message => progress.report({
|
|
156
|
+
message: ( localize(14919, "Create Profile: {0}", message))
|
|
157
|
+
});
|
|
158
|
+
creationPromise = createCancelablePromise(async token => {
|
|
159
|
+
profile = await this.getProfileToImport({
|
|
160
|
+
...profileTemplate,
|
|
161
|
+
name: options.name ?? profileTemplate.name
|
|
162
|
+
}, !!options.transient, options);
|
|
137
163
|
if (!profile) {
|
|
138
164
|
return;
|
|
139
165
|
}
|
|
@@ -144,8 +170,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
144
170
|
});
|
|
145
171
|
try {
|
|
146
172
|
await creationPromise;
|
|
147
|
-
}
|
|
148
|
-
catch (error) {
|
|
173
|
+
} catch (error) {
|
|
149
174
|
if (profile) {
|
|
150
175
|
await this.userDataProfilesService.removeProfile(profile);
|
|
151
176
|
profile = undefined;
|
|
@@ -156,75 +181,83 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
156
181
|
}
|
|
157
182
|
async applyProfileTemplate(profileTemplate, profile, options, reportProgress, token) {
|
|
158
183
|
if (profileTemplate.settings && (options.resourceTypeFlags?.settings ?? true) && !profile.useDefaultFlags?.settings) {
|
|
159
|
-
reportProgress(( localize(
|
|
184
|
+
reportProgress(( localize(14921, "Creating Settings...")));
|
|
160
185
|
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
161
186
|
}
|
|
162
187
|
if (token.isCancellationRequested) {
|
|
163
188
|
return;
|
|
164
189
|
}
|
|
165
190
|
if (profileTemplate.keybindings && (options.resourceTypeFlags?.keybindings ?? true) && !profile.useDefaultFlags?.keybindings) {
|
|
166
|
-
reportProgress(( localize(
|
|
191
|
+
reportProgress(( localize(14922, "Creating Keyboard Shortcuts...")));
|
|
167
192
|
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
168
193
|
}
|
|
169
194
|
if (token.isCancellationRequested) {
|
|
170
195
|
return;
|
|
171
196
|
}
|
|
172
197
|
if (profileTemplate.tasks && (options.resourceTypeFlags?.tasks ?? true) && !profile.useDefaultFlags?.tasks) {
|
|
173
|
-
reportProgress(( localize(
|
|
198
|
+
reportProgress(( localize(14923, "Creating Tasks...")));
|
|
174
199
|
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
175
200
|
}
|
|
176
201
|
if (token.isCancellationRequested) {
|
|
177
202
|
return;
|
|
178
203
|
}
|
|
179
204
|
if (profileTemplate.snippets && (options.resourceTypeFlags?.snippets ?? true) && !profile.useDefaultFlags?.snippets) {
|
|
180
|
-
reportProgress(( localize(
|
|
205
|
+
reportProgress(( localize(14924, "Creating Snippets...")));
|
|
181
206
|
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
182
207
|
}
|
|
183
208
|
if (token.isCancellationRequested) {
|
|
184
209
|
return;
|
|
185
210
|
}
|
|
186
211
|
if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
|
|
187
|
-
reportProgress(( localize(
|
|
212
|
+
reportProgress(( localize(14925, "Applying UI State...")));
|
|
188
213
|
await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
|
|
189
214
|
}
|
|
190
215
|
if (token.isCancellationRequested) {
|
|
191
216
|
return;
|
|
192
217
|
}
|
|
193
218
|
if (profileTemplate.extensions && (options.resourceTypeFlags?.extensions ?? true) && !profile.useDefaultFlags?.extensions) {
|
|
194
|
-
reportProgress(( localize(
|
|
219
|
+
reportProgress(( localize(14920, "Installing Extensions...")));
|
|
195
220
|
await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile, reportProgress, token);
|
|
196
221
|
}
|
|
197
222
|
}
|
|
198
223
|
async exportProfile(profile, exportFlags) {
|
|
199
224
|
const disposables = ( new DisposableStore());
|
|
200
225
|
try {
|
|
201
|
-
const userDataProfilesExportState = disposables.add(
|
|
226
|
+
const userDataProfilesExportState = disposables.add(
|
|
227
|
+
this.instantiationService.createInstance(UserDataProfileExportState, profile, exportFlags)
|
|
228
|
+
);
|
|
202
229
|
await this.doExportProfile(userDataProfilesExportState, ProgressLocation.Notification);
|
|
203
|
-
}
|
|
204
|
-
finally {
|
|
230
|
+
} finally {
|
|
205
231
|
disposables.dispose();
|
|
206
232
|
}
|
|
207
233
|
}
|
|
208
234
|
async createTroubleshootProfile() {
|
|
209
|
-
const userDataProfilesExportState = this.instantiationService.createInstance(
|
|
235
|
+
const userDataProfilesExportState = this.instantiationService.createInstance(
|
|
236
|
+
UserDataProfileExportState,
|
|
237
|
+
this.userDataProfileService.currentProfile,
|
|
238
|
+
undefined
|
|
239
|
+
);
|
|
210
240
|
try {
|
|
211
|
-
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(
|
|
241
|
+
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(14926, "Troubleshoot Issue")), undefined);
|
|
212
242
|
await this.progressService.withProgress({
|
|
213
243
|
location: ProgressLocation.Notification,
|
|
214
244
|
delay: 1000,
|
|
215
|
-
sticky: true
|
|
216
|
-
}, async
|
|
217
|
-
const reportProgress =
|
|
218
|
-
|
|
245
|
+
sticky: true
|
|
246
|
+
}, async progress => {
|
|
247
|
+
const reportProgress = message => progress.report({
|
|
248
|
+
message: ( localize(14927, "Setting up Troubleshoot Profile: {0}", message))
|
|
249
|
+
});
|
|
250
|
+
const profile = await this.doCreateProfile(profileTemplate, true, false, {
|
|
251
|
+
useDefaultFlags: this.userDataProfileService.currentProfile.useDefaultFlags
|
|
252
|
+
}, reportProgress);
|
|
219
253
|
if (profile) {
|
|
220
|
-
reportProgress(( localize(
|
|
254
|
+
reportProgress(( localize(14928, "Applying Extensions...")));
|
|
221
255
|
await this.instantiationService.createInstance(ExtensionsResource).copy(this.userDataProfileService.currentProfile, profile, true);
|
|
222
|
-
reportProgress(( localize(
|
|
256
|
+
reportProgress(( localize(14929, "Switching Profile...")));
|
|
223
257
|
await this.userDataProfileManagementService.switchProfile(profile);
|
|
224
258
|
}
|
|
225
259
|
});
|
|
226
|
-
}
|
|
227
|
-
finally {
|
|
260
|
+
} finally {
|
|
228
261
|
userDataProfilesExportState.dispose();
|
|
229
262
|
}
|
|
230
263
|
}
|
|
@@ -237,8 +270,8 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
237
270
|
try {
|
|
238
271
|
await this.progressService.withProgress({
|
|
239
272
|
location,
|
|
240
|
-
title: ( localize(
|
|
241
|
-
}, async
|
|
273
|
+
title: ( localize(14930, "{0}: Exporting...", PROFILES_CATEGORY.value))
|
|
274
|
+
}, async progress => {
|
|
242
275
|
const id = await this.pickProfileContentHandler(profile.name);
|
|
243
276
|
if (!id) {
|
|
244
277
|
return;
|
|
@@ -247,29 +280,32 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
247
280
|
if (!profileContentHandler) {
|
|
248
281
|
return;
|
|
249
282
|
}
|
|
250
|
-
const saveResult = await profileContentHandler.saveProfile(
|
|
283
|
+
const saveResult = await profileContentHandler.saveProfile(
|
|
284
|
+
profile.name.replace("/", "-"),
|
|
285
|
+
JSON.stringify(profile),
|
|
286
|
+
CancellationToken.None
|
|
287
|
+
);
|
|
251
288
|
if (!saveResult) {
|
|
252
289
|
return;
|
|
253
290
|
}
|
|
254
|
-
const message = ( localize(
|
|
291
|
+
const message = ( localize(14931, "Profile '{0}' was exported successfully.", profile.name));
|
|
255
292
|
if (profileContentHandler.extensionId) {
|
|
256
293
|
const buttons = [];
|
|
257
294
|
const link = this.productService.webUrl ? `${this.productService.webUrl}/${PROFILE_URL_AUTHORITY}/${id}/${saveResult.id}` : ( toUserDataProfileUri(`/${id}/${saveResult.id}`, this.productService).toString());
|
|
258
295
|
buttons.push({
|
|
259
|
-
label: ( localize(
|
|
296
|
+
label: ( localize(14932, "&&Copy Link")),
|
|
260
297
|
run: () => this.clipboardService.writeText(link)
|
|
261
298
|
});
|
|
262
299
|
if (this.productService.webUrl) {
|
|
263
300
|
buttons.push({
|
|
264
|
-
label: ( localize(
|
|
301
|
+
label: ( localize(14933, "&&Open Link")),
|
|
265
302
|
run: async () => {
|
|
266
303
|
await this.openerService.open(link);
|
|
267
304
|
}
|
|
268
305
|
});
|
|
269
|
-
}
|
|
270
|
-
else {
|
|
306
|
+
} else {
|
|
271
307
|
buttons.push({
|
|
272
|
-
label: ( localize(
|
|
308
|
+
label: ( localize(14934, "&&Open in {0}", profileContentHandler.name)),
|
|
273
309
|
run: async () => {
|
|
274
310
|
await this.openerService.open(( saveResult.link.toString()));
|
|
275
311
|
}
|
|
@@ -279,15 +315,13 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
279
315
|
type: Severity.Info,
|
|
280
316
|
message,
|
|
281
317
|
buttons,
|
|
282
|
-
cancelButton: ( localize(
|
|
318
|
+
cancelButton: ( localize(14935, "Close"))
|
|
283
319
|
});
|
|
284
|
-
}
|
|
285
|
-
else {
|
|
320
|
+
} else {
|
|
286
321
|
await this.dialogService.info(message);
|
|
287
322
|
}
|
|
288
323
|
});
|
|
289
|
-
}
|
|
290
|
-
finally {
|
|
324
|
+
} finally {
|
|
291
325
|
disposables.dispose();
|
|
292
326
|
}
|
|
293
327
|
}
|
|
@@ -299,12 +333,11 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
299
333
|
let profileTemplate;
|
|
300
334
|
try {
|
|
301
335
|
profileTemplate = JSON.parse(profileContent);
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
throw ( new Error(( localize(14539, "This profile is not valid."))));
|
|
336
|
+
} catch (error) {
|
|
337
|
+
throw ( new Error(( localize(14936, "This profile is not valid."))));
|
|
305
338
|
}
|
|
306
339
|
if (!isUserDataProfileTemplate(profileTemplate)) {
|
|
307
|
-
|
|
340
|
+
return null;
|
|
308
341
|
}
|
|
309
342
|
if (options?.name) {
|
|
310
343
|
profileTemplate.name = options.name;
|
|
@@ -338,27 +371,27 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
338
371
|
return undefined;
|
|
339
372
|
}
|
|
340
373
|
if (profileTemplate.settings && !profile.useDefaultFlags?.settings) {
|
|
341
|
-
progress(( localize(
|
|
374
|
+
progress(( localize(14937, "Applying Settings...")));
|
|
342
375
|
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
343
376
|
}
|
|
344
377
|
if (profileTemplate.keybindings && !profile.useDefaultFlags?.keybindings) {
|
|
345
|
-
progress(( localize(
|
|
378
|
+
progress(( localize(14938, "Applying Keyboard Shortcuts...")));
|
|
346
379
|
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
347
380
|
}
|
|
348
381
|
if (profileTemplate.tasks && !profile.useDefaultFlags?.tasks) {
|
|
349
|
-
progress(( localize(
|
|
382
|
+
progress(( localize(14939, "Applying Tasks...")));
|
|
350
383
|
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
351
384
|
}
|
|
352
385
|
if (profileTemplate.snippets && !profile.useDefaultFlags?.snippets) {
|
|
353
|
-
progress(( localize(
|
|
386
|
+
progress(( localize(14940, "Applying Snippets...")));
|
|
354
387
|
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
355
388
|
}
|
|
356
389
|
if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
|
|
357
|
-
progress(( localize(
|
|
390
|
+
progress(( localize(14941, "Applying State...")));
|
|
358
391
|
await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
|
|
359
392
|
}
|
|
360
393
|
if (profileTemplate.extensions && extensions && !profile.useDefaultFlags?.extensions) {
|
|
361
|
-
progress(( localize(
|
|
394
|
+
progress(( localize(14928, "Applying Extensions...")));
|
|
362
395
|
await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile);
|
|
363
396
|
}
|
|
364
397
|
return profile;
|
|
@@ -372,8 +405,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
372
405
|
if (resource.authority === PROFILE_URL_AUTHORITY) {
|
|
373
406
|
idOrUri = this.uriIdentityService.extUri.basename(resource);
|
|
374
407
|
handlerId = this.uriIdentityService.extUri.basename(this.uriIdentityService.extUri.dirname(resource));
|
|
375
|
-
}
|
|
376
|
-
else {
|
|
408
|
+
} else {
|
|
377
409
|
handlerId = resource.authority.substring(PROFILE_URL_AUTHORITY_PREFIX.length);
|
|
378
410
|
idOrUri = ( URI.parse(resource.path.substring(1)));
|
|
379
411
|
}
|
|
@@ -383,33 +415,39 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
383
415
|
return profileContentHandler.readProfile(idOrUri, CancellationToken.None);
|
|
384
416
|
}
|
|
385
417
|
}
|
|
386
|
-
await this.extensionService.activateByEvent(
|
|
418
|
+
await this.extensionService.activateByEvent("onProfile");
|
|
387
419
|
for (const profileContentHandler of ( this.profileContentHandlers.values())) {
|
|
388
420
|
const content = await profileContentHandler.readProfile(resource, CancellationToken.None);
|
|
389
421
|
if (content !== null) {
|
|
390
422
|
return content;
|
|
391
423
|
}
|
|
392
424
|
}
|
|
393
|
-
const context = await this.requestService.request({
|
|
425
|
+
const context = await this.requestService.request({
|
|
426
|
+
type: "GET",
|
|
427
|
+
url: ( resource.toString(true))
|
|
428
|
+
}, CancellationToken.None);
|
|
394
429
|
if (context.res.statusCode === 200) {
|
|
395
430
|
return await asText(context);
|
|
396
|
-
}
|
|
397
|
-
else {
|
|
431
|
+
} else {
|
|
398
432
|
const message = await asText(context);
|
|
399
433
|
throw ( new Error(`Failed to get profile from URL: ${( resource.toString())}. Status code: ${context.res.statusCode}. Message: ${message}`));
|
|
400
434
|
}
|
|
401
435
|
}
|
|
402
436
|
async pickProfileContentHandler(name) {
|
|
403
|
-
await this.extensionService.activateByEvent(
|
|
437
|
+
await this.extensionService.activateByEvent("onProfile");
|
|
404
438
|
if (this.profileContentHandlers.size === 1) {
|
|
405
439
|
return ( this.profileContentHandlers.keys()).next().value;
|
|
406
440
|
}
|
|
407
441
|
const options = [];
|
|
408
442
|
for (const [id, profileContentHandler] of this.profileContentHandlers) {
|
|
409
|
-
options.push({
|
|
443
|
+
options.push({
|
|
444
|
+
id,
|
|
445
|
+
label: profileContentHandler.name,
|
|
446
|
+
description: profileContentHandler.description
|
|
447
|
+
});
|
|
410
448
|
}
|
|
411
449
|
const result = await this.quickInputService.pick(options.reverse(), {
|
|
412
|
-
title: ( localize(
|
|
450
|
+
title: ( localize(14942, "Export '{0}' profile as...", name)),
|
|
413
451
|
hideInput: true
|
|
414
452
|
});
|
|
415
453
|
return result?.id;
|
|
@@ -419,24 +457,31 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
419
457
|
const profile = this.userDataProfilesService.profiles.find(p => p.name === profileName);
|
|
420
458
|
if (profile) {
|
|
421
459
|
if (temp) {
|
|
422
|
-
return this.userDataProfilesService.createNamedProfile(`${profileName} ${this.getProfileNameIndex(profileName)}`, {
|
|
460
|
+
return this.userDataProfilesService.createNamedProfile(`${profileName} ${this.getProfileNameIndex(profileName)}`, {
|
|
461
|
+
...options,
|
|
462
|
+
transient: temp
|
|
463
|
+
});
|
|
423
464
|
}
|
|
424
|
-
const {
|
|
465
|
+
const {
|
|
466
|
+
confirmed
|
|
467
|
+
} = await this.dialogService.confirm({
|
|
425
468
|
type: Severity.Info,
|
|
426
469
|
message: ( localize(
|
|
427
|
-
|
|
470
|
+
14943,
|
|
428
471
|
"Profile with name '{0}' already exists. Do you want to replace its contents?",
|
|
429
472
|
profileName
|
|
430
473
|
)),
|
|
431
|
-
primaryButton: ( localize(
|
|
474
|
+
primaryButton: ( localize(14944, "&&Replace"))
|
|
432
475
|
});
|
|
433
476
|
if (!confirmed) {
|
|
434
477
|
return undefined;
|
|
435
478
|
}
|
|
436
479
|
return profile.isDefault ? profile : this.userDataProfilesService.updateProfile(profile, options);
|
|
437
|
-
}
|
|
438
|
-
|
|
439
|
-
|
|
480
|
+
} else {
|
|
481
|
+
return this.userDataProfilesService.createNamedProfile(profileName, {
|
|
482
|
+
...options,
|
|
483
|
+
transient: temp
|
|
484
|
+
});
|
|
440
485
|
}
|
|
441
486
|
}
|
|
442
487
|
getProfileNameIndex(name) {
|
|
@@ -450,42 +495,46 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
450
495
|
return nameIndex + 1;
|
|
451
496
|
}
|
|
452
497
|
};
|
|
453
|
-
UserDataProfileImportExportService = ( __decorate([
|
|
454
|
-
( __param(0, IInstantiationService)),
|
|
455
|
-
( __param(1, IUserDataProfileService)),
|
|
456
|
-
( __param(2, IUserDataProfileManagementService)),
|
|
457
|
-
( __param(3, IUserDataProfilesService)),
|
|
458
|
-
( __param(4, IExtensionService)),
|
|
459
|
-
( __param(5, IQuickInputService)),
|
|
460
|
-
( __param(6, IProgressService)),
|
|
461
|
-
( __param(7, IDialogService)),
|
|
462
|
-
( __param(8, IClipboardService)),
|
|
463
|
-
( __param(9, IOpenerService)),
|
|
464
|
-
( __param(10, IRequestService)),
|
|
465
|
-
( __param(11, IProductService)),
|
|
466
|
-
( __param(12, IUriIdentityService))
|
|
467
|
-
], UserDataProfileImportExportService));
|
|
498
|
+
UserDataProfileImportExportService = ( __decorate([( __param(0, IInstantiationService)), ( __param(1, IUserDataProfileService)), ( __param(2, IUserDataProfileManagementService)), ( __param(3, IUserDataProfilesService)), ( __param(4, IExtensionService)), ( __param(5, IQuickInputService)), ( __param(6, IProgressService)), ( __param(7, IDialogService)), ( __param(8, IClipboardService)), ( __param(9, IOpenerService)), ( __param(10, IRequestService)), ( __param(11, IProductService)), ( __param(12, IUriIdentityService))], UserDataProfileImportExportService));
|
|
468
499
|
let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler {
|
|
469
|
-
constructor(
|
|
500
|
+
constructor(
|
|
501
|
+
fileDialogService,
|
|
502
|
+
uriIdentityService,
|
|
503
|
+
fileService,
|
|
504
|
+
productService,
|
|
505
|
+
textFileService
|
|
506
|
+
) {
|
|
470
507
|
this.fileDialogService = fileDialogService;
|
|
471
508
|
this.uriIdentityService = uriIdentityService;
|
|
472
509
|
this.fileService = fileService;
|
|
473
510
|
this.productService = productService;
|
|
474
511
|
this.textFileService = textFileService;
|
|
475
|
-
this.name = ( localize(
|
|
476
|
-
this.description = ( localize(
|
|
512
|
+
this.name = ( localize(14945, "Local"));
|
|
513
|
+
this.description = ( localize(14946, "file"));
|
|
477
514
|
}
|
|
478
515
|
async saveProfile(name, content, token) {
|
|
479
516
|
const link = await this.fileDialogService.showSaveDialog({
|
|
480
|
-
title: ( localize(
|
|
517
|
+
title: ( localize(14947, "Save Profile")),
|
|
481
518
|
filters: PROFILE_FILTER,
|
|
482
|
-
defaultUri: this.uriIdentityService.extUri.joinPath(
|
|
519
|
+
defaultUri: this.uriIdentityService.extUri.joinPath(
|
|
520
|
+
await this.fileDialogService.defaultFilePath(),
|
|
521
|
+
`${name}.${PROFILE_EXTENSION}`
|
|
522
|
+
)
|
|
483
523
|
});
|
|
484
524
|
if (!link) {
|
|
485
525
|
return null;
|
|
486
526
|
}
|
|
487
|
-
await this.textFileService.create([{
|
|
488
|
-
|
|
527
|
+
await this.textFileService.create([{
|
|
528
|
+
resource: link,
|
|
529
|
+
value: content,
|
|
530
|
+
options: {
|
|
531
|
+
overwrite: true
|
|
532
|
+
}
|
|
533
|
+
}]);
|
|
534
|
+
return {
|
|
535
|
+
link,
|
|
536
|
+
id: ( link.toString())
|
|
537
|
+
};
|
|
489
538
|
}
|
|
490
539
|
async canHandle(uri) {
|
|
491
540
|
return uri.scheme !== Schemas.http && uri.scheme !== Schemas.https && uri.scheme !== this.productService.urlProtocol && (await this.fileService.canHandleResource(uri));
|
|
@@ -502,20 +551,14 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
|
|
|
502
551
|
canSelectFiles: true,
|
|
503
552
|
canSelectMany: false,
|
|
504
553
|
filters: PROFILE_FILTER,
|
|
505
|
-
title: ( localize(
|
|
554
|
+
title: ( localize(14948, "Select Profile"))
|
|
506
555
|
});
|
|
507
556
|
return profileLocation ? profileLocation[0] : null;
|
|
508
557
|
}
|
|
509
558
|
};
|
|
510
|
-
FileUserDataProfileContentHandler = ( __decorate([
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
( __param(2, IFileService)),
|
|
514
|
-
( __param(3, IProductService)),
|
|
515
|
-
( __param(4, ITextFileService))
|
|
516
|
-
], FileUserDataProfileContentHandler));
|
|
517
|
-
const USER_DATA_PROFILE_EXPORT_SCHEME = 'userdataprofileexport';
|
|
518
|
-
const USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME = 'userdataprofileexportpreview';
|
|
559
|
+
FileUserDataProfileContentHandler = ( __decorate([( __param(0, IFileDialogService)), ( __param(1, IUriIdentityService)), ( __param(2, IFileService)), ( __param(3, IProductService)), ( __param(4, ITextFileService))], FileUserDataProfileContentHandler));
|
|
560
|
+
const USER_DATA_PROFILE_EXPORT_SCHEME = "userdataprofileexport";
|
|
561
|
+
const USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME = "userdataprofileexportpreview";
|
|
519
562
|
let UserDataProfileImportExportState = class UserDataProfileImportExportState extends Disposable {
|
|
520
563
|
constructor(quickInputService) {
|
|
521
564
|
super();
|
|
@@ -535,8 +578,7 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
535
578
|
}
|
|
536
579
|
}
|
|
537
580
|
return children;
|
|
538
|
-
}
|
|
539
|
-
else {
|
|
581
|
+
} else {
|
|
540
582
|
this.rootsPromise = undefined;
|
|
541
583
|
this._onDidChangeRoots.fire();
|
|
542
584
|
return this.getRoots();
|
|
@@ -550,13 +592,13 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
550
592
|
const labelText = isMarkdownString(root.label.label) ? root.label.label.value : root.label.label;
|
|
551
593
|
root.checkbox = {
|
|
552
594
|
isChecked: !root.isFromDefaultProfile(),
|
|
553
|
-
tooltip: ( localize(
|
|
595
|
+
tooltip: ( localize(14949, "Select {0}", labelText)),
|
|
554
596
|
accessibilityInformation: {
|
|
555
|
-
label: ( localize(
|
|
597
|
+
label: ( localize(14949, "Select {0}", labelText))
|
|
556
598
|
}
|
|
557
599
|
};
|
|
558
600
|
if (root.isFromDefaultProfile()) {
|
|
559
|
-
root.description = ( localize(
|
|
601
|
+
root.description = ( localize(14950, "From Default Profile"));
|
|
560
602
|
}
|
|
561
603
|
}
|
|
562
604
|
return this.roots;
|
|
@@ -584,20 +626,15 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
584
626
|
}
|
|
585
627
|
if (root instanceof SettingsResourceTreeItem) {
|
|
586
628
|
settings = await root.getContent();
|
|
587
|
-
}
|
|
588
|
-
else if (root instanceof KeybindingsResourceTreeItem) {
|
|
629
|
+
} else if (root instanceof KeybindingsResourceTreeItem) {
|
|
589
630
|
keybindings = await root.getContent();
|
|
590
|
-
}
|
|
591
|
-
else if (root instanceof TasksResourceTreeItem) {
|
|
631
|
+
} else if (root instanceof TasksResourceTreeItem) {
|
|
592
632
|
tasks = await root.getContent();
|
|
593
|
-
}
|
|
594
|
-
else if (root instanceof SnippetsResourceTreeItem) {
|
|
633
|
+
} else if (root instanceof SnippetsResourceTreeItem) {
|
|
595
634
|
snippets = await root.getContent();
|
|
596
|
-
}
|
|
597
|
-
else if (root instanceof ExtensionsResourceTreeItem) {
|
|
635
|
+
} else if (root instanceof ExtensionsResourceTreeItem) {
|
|
598
636
|
extensions = await root.getContent();
|
|
599
|
-
}
|
|
600
|
-
else if (root instanceof GlobalStateResourceTreeItem) {
|
|
637
|
+
} else if (root instanceof GlobalStateResourceTreeItem) {
|
|
601
638
|
globalState = await root.getContent();
|
|
602
639
|
}
|
|
603
640
|
}
|
|
@@ -619,9 +656,7 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
619
656
|
return true;
|
|
620
657
|
}
|
|
621
658
|
};
|
|
622
|
-
UserDataProfileImportExportState = ( __decorate([
|
|
623
|
-
( __param(0, IQuickInputService))
|
|
624
|
-
], UserDataProfileImportExportState));
|
|
659
|
+
UserDataProfileImportExportState = ( __decorate([( __param(0, IQuickInputService))], UserDataProfileImportExportState));
|
|
625
660
|
let UserDataProfileExportState = class UserDataProfileExportState extends UserDataProfileImportExportState {
|
|
626
661
|
constructor(profile, exportFlags, quickInputService, fileService, instantiationService) {
|
|
627
662
|
super(quickInputService);
|
|
@@ -633,9 +668,13 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
633
668
|
}
|
|
634
669
|
async fetchRoots() {
|
|
635
670
|
this.disposables.clear();
|
|
636
|
-
this.disposables.add(
|
|
671
|
+
this.disposables.add(
|
|
672
|
+
this.fileService.registerProvider(USER_DATA_PROFILE_EXPORT_SCHEME, this._register(( new InMemoryFileSystemProvider())))
|
|
673
|
+
);
|
|
637
674
|
const previewFileSystemProvider = this._register(( new InMemoryFileSystemProvider()));
|
|
638
|
-
this.disposables.add(
|
|
675
|
+
this.disposables.add(
|
|
676
|
+
this.fileService.registerProvider(USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME, previewFileSystemProvider)
|
|
677
|
+
);
|
|
639
678
|
const roots = [];
|
|
640
679
|
const exportPreviewProfle = this.createExportPreviewProfile(this.profile);
|
|
641
680
|
if (this.exportFlags?.settings ?? true) {
|
|
@@ -675,11 +714,20 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
675
714
|
}
|
|
676
715
|
}
|
|
677
716
|
if (this.exportFlags?.globalState ?? true) {
|
|
678
|
-
const globalStateResource = joinPath(exportPreviewProfle.globalStorageHome,
|
|
679
|
-
|
|
717
|
+
const globalStateResource = joinPath(exportPreviewProfle.globalStorageHome, "globalState.json").with({
|
|
718
|
+
scheme: USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME
|
|
719
|
+
});
|
|
720
|
+
const globalStateResourceTreeItem = this.instantiationService.createInstance(
|
|
721
|
+
GlobalStateResourceExportTreeItem,
|
|
722
|
+
exportPreviewProfle,
|
|
723
|
+
globalStateResource
|
|
724
|
+
);
|
|
680
725
|
const content = await globalStateResourceTreeItem.getContent();
|
|
681
726
|
if (content) {
|
|
682
|
-
await this.fileService.writeFile(
|
|
727
|
+
await this.fileService.writeFile(
|
|
728
|
+
globalStateResource,
|
|
729
|
+
VSBuffer.fromString(JSON.stringify(JSON.parse(content), null, "\t"))
|
|
730
|
+
);
|
|
683
731
|
roots.push(globalStateResourceTreeItem);
|
|
684
732
|
}
|
|
685
733
|
}
|
|
@@ -700,12 +748,24 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
700
748
|
isDefault: profile.isDefault,
|
|
701
749
|
icon: profile.icon,
|
|
702
750
|
globalStorageHome: profile.globalStorageHome,
|
|
703
|
-
settingsResource: profile.settingsResource.with({
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
751
|
+
settingsResource: profile.settingsResource.with({
|
|
752
|
+
scheme: USER_DATA_PROFILE_EXPORT_SCHEME
|
|
753
|
+
}),
|
|
754
|
+
keybindingsResource: profile.keybindingsResource.with({
|
|
755
|
+
scheme: USER_DATA_PROFILE_EXPORT_SCHEME
|
|
756
|
+
}),
|
|
757
|
+
tasksResource: profile.tasksResource.with({
|
|
758
|
+
scheme: USER_DATA_PROFILE_EXPORT_SCHEME
|
|
759
|
+
}),
|
|
760
|
+
mcpResource: profile.mcpResource.with({
|
|
761
|
+
scheme: USER_DATA_PROFILE_EXPORT_SCHEME
|
|
762
|
+
}),
|
|
763
|
+
snippetsHome: profile.snippetsHome.with({
|
|
764
|
+
scheme: USER_DATA_PROFILE_EXPORT_SCHEME
|
|
765
|
+
}),
|
|
766
|
+
promptsHome: profile.promptsHome.with({
|
|
767
|
+
scheme: USER_DATA_PROFILE_EXPORT_SCHEME
|
|
768
|
+
}),
|
|
709
769
|
extensionsResource: profile.extensionsResource,
|
|
710
770
|
cacheHome: profile.cacheHome,
|
|
711
771
|
useDefaultFlags: profile.useDefaultFlags,
|
|
@@ -716,14 +776,14 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
716
776
|
let name = this.profile.name;
|
|
717
777
|
if (this.profile.isDefault) {
|
|
718
778
|
name = await this.quickInputService.input({
|
|
719
|
-
placeHolder: ( localize(
|
|
720
|
-
title: ( localize(
|
|
779
|
+
placeHolder: ( localize(14951, "Name the profile")),
|
|
780
|
+
title: ( localize(14952, "Export Profile")),
|
|
721
781
|
async validateInput(input) {
|
|
722
782
|
if (!input.trim()) {
|
|
723
|
-
return localize(
|
|
783
|
+
return localize(14953, "Profile name must be provided.");
|
|
724
784
|
}
|
|
725
785
|
return undefined;
|
|
726
|
-
}
|
|
786
|
+
}
|
|
727
787
|
});
|
|
728
788
|
if (!name) {
|
|
729
789
|
return null;
|
|
@@ -732,10 +792,6 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
732
792
|
return super.getProfileTemplate(name, this.profile.icon);
|
|
733
793
|
}
|
|
734
794
|
};
|
|
735
|
-
UserDataProfileExportState = ( __decorate([
|
|
736
|
-
( __param(2, IQuickInputService)),
|
|
737
|
-
( __param(3, IFileService)),
|
|
738
|
-
( __param(4, IInstantiationService))
|
|
739
|
-
], UserDataProfileExportState));
|
|
795
|
+
UserDataProfileExportState = ( __decorate([( __param(2, IQuickInputService)), ( __param(3, IFileService)), ( __param(4, IInstantiationService))], UserDataProfileExportState));
|
|
740
796
|
|
|
741
797
|
export { UserDataProfileImportExportService };
|