@codingame/monaco-vscode-user-data-profile-service-override 11.1.2 → 12.0.1
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/index.d.ts +2 -1
- package/index.js +126 -1
- package/package.json +31 -8
- package/vscode/src/vs/base/browser/ui/radio/radio.css.js +1 -1
- package/vscode/src/vs/base/browser/ui/radio/radio.d.ts +37 -0
- package/vscode/src/vs/base/browser/ui/radio/radio.js +1 -0
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.d.ts +16 -0
- package/vscode/src/vs/platform/userDataProfile/browser/userDataProfile.js +3 -2
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.d.ts +42 -0
- package/vscode/src/vs/platform/userDataProfile/common/userDataProfileStorageService.js +10 -11
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/media/userDataProfilesEditor.css.js +1 -1
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.contribution.js +3 -2
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.d.ts +53 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfile.js +65 -63
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.d.ts +1 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfileActions.js +5 -4
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.d.ts +73 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditor.js +298 -307
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.d.ts +236 -0
- package/vscode/src/vs/workbench/contrib/userDataProfile/browser/userDataProfilesEditorModel.js +168 -166
- package/vscode/src/vs/workbench/contrib/userDataProfile/common/userDataProfile.d.ts +7 -0
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.d.ts +19 -0
- package/vscode/src/vs/workbench/services/userData/browser/userDataInit.js +4 -2
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.d.ts +77 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/extensionsResource.js +83 -82
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.d.ts +58 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/globalStateResource.js +31 -28
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.d.ts +47 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/keybindingsResource.js +24 -24
- package/vscode/src/vs/workbench/services/userDataProfile/browser/media/userDataProfileView.css.js +1 -1
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.d.ts +48 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/settingsResource.js +29 -29
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.d.ts +43 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/snippetsResource.js +54 -54
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.d.ts +45 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/tasksResource.js +24 -24
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.d.ts +63 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileImportExportService.js +106 -111
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.d.ts +32 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileInit.js +11 -8
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.d.ts +58 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileManagement.js +35 -33
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.d.ts +18 -0
- package/vscode/src/vs/workbench/services/userDataProfile/browser/userDataProfileStorageService.js +7 -5
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.d.ts +45 -0
- package/vscode/src/vs/workbench/services/userDataSync/browser/userDataSyncInit.js +25 -22
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.d.ts +18 -0
- package/vscode/src/vs/workbench/services/userDataSync/common/userDataSyncUtil.js +3 -1
- package/userDataProfile.js +0 -125
|
@@ -1,9 +1,11 @@
|
|
|
1
|
-
|
|
1
|
+
|
|
2
|
+
import { __decorate, __param } from 'vscode/external/tslib/tslib.es6';
|
|
2
3
|
import './media/userDataProfileView.css.js';
|
|
3
4
|
import { localize } from 'vscode/vscode/vs/nls';
|
|
5
|
+
import 'vscode/vscode/vs/platform/instantiation/common/extensions';
|
|
4
6
|
import { IInstantiationService } from 'vscode/vscode/vs/platform/instantiation/common/instantiation';
|
|
5
7
|
import { Emitter } from 'vscode/vscode/vs/base/common/event';
|
|
6
|
-
import { PROFILES_CATEGORY, PROFILE_URL_AUTHORITY, toUserDataProfileUri, isProfileURL, PROFILE_URL_AUTHORITY_PREFIX, PROFILE_FILTER, PROFILE_EXTENSION } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
8
|
+
import { PROFILES_CATEGORY, PROFILE_URL_AUTHORITY, toUserDataProfileUri, isProfileURL, PROFILE_URL_AUTHORITY_PREFIX, PROFILE_FILTER, PROFILE_EXTENSION } from '@codingame/monaco-vscode-e72c94ca-257a-5b75-8b68-5a5fa3c18255-common/vscode/vs/workbench/services/userDataProfile/common/userDataProfile';
|
|
7
9
|
import { IUserDataProfileService, IUserDataProfileManagementService } from 'vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service';
|
|
8
10
|
import { Disposable, toDisposable, DisposableStore } from 'vscode/vscode/vs/base/common/lifecycle';
|
|
9
11
|
import { IDialogService, IFileDialogService } from 'vscode/vscode/vs/platform/dialogs/common/dialogs.service';
|
|
@@ -18,8 +20,9 @@ import { SnippetsResource, SnippetsResourceTreeItem } from './snippetsResource.j
|
|
|
18
20
|
import { TasksResource, TasksResourceTreeItem } from './tasksResource.js';
|
|
19
21
|
import { ExtensionsResource, ExtensionsResourceTreeItem, ExtensionsResourceExportTreeItem } from './extensionsResource.js';
|
|
20
22
|
import { GlobalStateResource, GlobalStateResourceTreeItem, GlobalStateResourceExportTreeItem } from './globalStateResource.js';
|
|
21
|
-
import { InMemoryFileSystemProvider } from 'vscode/vscode/vs/platform/files/common/inMemoryFilesystemProvider';
|
|
23
|
+
import { InMemoryFileSystemProvider } from '@codingame/monaco-vscode-2f06fe84-148e-5e6b-a7ca-c7989c5f128a-common/vscode/vs/platform/files/common/inMemoryFilesystemProvider';
|
|
22
24
|
import { IOpenerService } from 'vscode/vscode/vs/platform/opener/common/opener.service';
|
|
25
|
+
import { ProgressLocation } from 'vscode/vscode/vs/platform/progress/common/progress';
|
|
23
26
|
import { IProgressService } from 'vscode/vscode/vs/platform/progress/common/progress.service';
|
|
24
27
|
import { IExtensionService } from 'vscode/vscode/vs/workbench/services/extensions/common/extensions.service';
|
|
25
28
|
import { IQuickInputService } from 'vscode/vscode/vs/platform/quickinput/common/quickInput.service';
|
|
@@ -28,7 +31,7 @@ import { joinPath } from 'vscode/vscode/vs/base/common/resources';
|
|
|
28
31
|
import { escapeRegExpCharacters } from 'vscode/vscode/vs/base/common/strings';
|
|
29
32
|
import { Schemas } from 'vscode/vscode/vs/base/common/network';
|
|
30
33
|
import { CancellationToken } from 'vscode/vscode/vs/base/common/cancellation';
|
|
31
|
-
import Severity
|
|
34
|
+
import Severity from 'vscode/vscode/vs/base/common/severity';
|
|
32
35
|
import { IClipboardService } from 'vscode/vscode/vs/platform/clipboard/common/clipboardService.service';
|
|
33
36
|
import { asText } from 'vscode/vscode/vs/platform/request/common/request';
|
|
34
37
|
import { IRequestService } from 'vscode/vscode/vs/platform/request/common/request.service';
|
|
@@ -61,12 +64,12 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
61
64
|
this.requestService = requestService;
|
|
62
65
|
this.productService = productService;
|
|
63
66
|
this.uriIdentityService = uriIdentityService;
|
|
64
|
-
this.profileContentHandlers = (
|
|
67
|
+
this.profileContentHandlers = ( new Map());
|
|
65
68
|
this.registerProfileContentHandler(Schemas.file, this.fileUserDataProfileContentHandler = instantiationService.createInstance(FileUserDataProfileContentHandler));
|
|
66
69
|
}
|
|
67
70
|
registerProfileContentHandler(id, profileContentHandler) {
|
|
68
|
-
if ((
|
|
69
|
-
throw (
|
|
71
|
+
if (( this.profileContentHandlers.has(id))) {
|
|
72
|
+
throw ( new Error(`Profile content handler with id '${id}' already registered.`));
|
|
70
73
|
}
|
|
71
74
|
this.profileContentHandlers.set(id, profileContentHandler);
|
|
72
75
|
return toDisposable(() => this.unregisterProfileContentHandler(id));
|
|
@@ -75,17 +78,17 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
75
78
|
this.profileContentHandlers.delete(id);
|
|
76
79
|
}
|
|
77
80
|
async createFromProfile(from, options, token) {
|
|
78
|
-
const disposables = (
|
|
81
|
+
const disposables = ( new DisposableStore());
|
|
79
82
|
let creationPromise;
|
|
80
83
|
disposables.add(token.onCancellationRequested(() => creationPromise.cancel()));
|
|
81
84
|
let profile;
|
|
82
85
|
return this.progressService.withProgress({
|
|
83
|
-
location:
|
|
86
|
+
location: ProgressLocation.Notification,
|
|
84
87
|
delay: 500,
|
|
85
88
|
sticky: true,
|
|
86
89
|
cancellable: true,
|
|
87
90
|
}, async (progress) => {
|
|
88
|
-
const reportProgress = (message) => progress.report({ message: ( localize(
|
|
91
|
+
const reportProgress = (message) => progress.report({ message: ( localize(11983, "Create Profile: {0}", message)) });
|
|
89
92
|
creationPromise = createCancelablePromise(async (token) => {
|
|
90
93
|
const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, from, { ...options?.resourceTypeFlags, extensions: false }));
|
|
91
94
|
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(options.name ?? from.name, options?.icon);
|
|
@@ -101,7 +104,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
101
104
|
try {
|
|
102
105
|
await creationPromise;
|
|
103
106
|
if (profile && (options?.resourceTypeFlags?.extensions ?? true)) {
|
|
104
|
-
reportProgress(( localize(
|
|
107
|
+
reportProgress(( localize(11984, "Installing Extensions...")));
|
|
105
108
|
await this.instantiationService.createInstance(ExtensionsResource).copy(from, profile, false);
|
|
106
109
|
}
|
|
107
110
|
}
|
|
@@ -115,17 +118,17 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
115
118
|
}, () => creationPromise.cancel()).finally(() => disposables.dispose());
|
|
116
119
|
}
|
|
117
120
|
async createProfileFromTemplate(profileTemplate, options, token) {
|
|
118
|
-
const disposables = (
|
|
121
|
+
const disposables = ( new DisposableStore());
|
|
119
122
|
let creationPromise;
|
|
120
123
|
disposables.add(token.onCancellationRequested(() => creationPromise.cancel()));
|
|
121
124
|
let profile;
|
|
122
125
|
return this.progressService.withProgress({
|
|
123
|
-
location:
|
|
126
|
+
location: ProgressLocation.Notification,
|
|
124
127
|
delay: 500,
|
|
125
128
|
sticky: true,
|
|
126
129
|
cancellable: true,
|
|
127
130
|
}, async (progress) => {
|
|
128
|
-
const reportProgress = (message) => progress.report({ message: ( localize(
|
|
131
|
+
const reportProgress = (message) => progress.report({ message: ( localize(11983, "Create Profile: {0}", message)) });
|
|
129
132
|
creationPromise = createCancelablePromise(async (token) => {
|
|
130
133
|
profile = await this.getProfileToImport({ ...profileTemplate, name: options.name ?? profileTemplate.name }, !!options.transient, options);
|
|
131
134
|
if (!profile) {
|
|
@@ -150,50 +153,50 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
150
153
|
}
|
|
151
154
|
async applyProfileTemplate(profileTemplate, profile, options, reportProgress, token) {
|
|
152
155
|
if (profileTemplate.settings && (options.resourceTypeFlags?.settings ?? true) && !profile.useDefaultFlags?.settings) {
|
|
153
|
-
reportProgress(( localize(
|
|
156
|
+
reportProgress(( localize(11985, "Creating Settings...")));
|
|
154
157
|
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
155
158
|
}
|
|
156
159
|
if (token.isCancellationRequested) {
|
|
157
160
|
return;
|
|
158
161
|
}
|
|
159
162
|
if (profileTemplate.keybindings && (options.resourceTypeFlags?.keybindings ?? true) && !profile.useDefaultFlags?.keybindings) {
|
|
160
|
-
reportProgress(( localize(
|
|
163
|
+
reportProgress(( localize(11986, "Creating Keyboard Shortcuts...")));
|
|
161
164
|
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
162
165
|
}
|
|
163
166
|
if (token.isCancellationRequested) {
|
|
164
167
|
return;
|
|
165
168
|
}
|
|
166
169
|
if (profileTemplate.tasks && (options.resourceTypeFlags?.tasks ?? true) && !profile.useDefaultFlags?.tasks) {
|
|
167
|
-
reportProgress(( localize(
|
|
170
|
+
reportProgress(( localize(11987, "Creating Tasks...")));
|
|
168
171
|
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
169
172
|
}
|
|
170
173
|
if (token.isCancellationRequested) {
|
|
171
174
|
return;
|
|
172
175
|
}
|
|
173
176
|
if (profileTemplate.snippets && (options.resourceTypeFlags?.snippets ?? true) && !profile.useDefaultFlags?.snippets) {
|
|
174
|
-
reportProgress(( localize(
|
|
177
|
+
reportProgress(( localize(11988, "Creating Snippets...")));
|
|
175
178
|
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
176
179
|
}
|
|
177
180
|
if (token.isCancellationRequested) {
|
|
178
181
|
return;
|
|
179
182
|
}
|
|
180
183
|
if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
|
|
181
|
-
reportProgress(( localize(
|
|
184
|
+
reportProgress(( localize(11989, "Applying UI State...")));
|
|
182
185
|
await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
|
|
183
186
|
}
|
|
184
187
|
if (token.isCancellationRequested) {
|
|
185
188
|
return;
|
|
186
189
|
}
|
|
187
190
|
if (profileTemplate.extensions && (options.resourceTypeFlags?.extensions ?? true) && !profile.useDefaultFlags?.extensions) {
|
|
188
|
-
reportProgress(( localize(
|
|
191
|
+
reportProgress(( localize(11984, "Installing Extensions...")));
|
|
189
192
|
await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile, reportProgress, token);
|
|
190
193
|
}
|
|
191
194
|
}
|
|
192
195
|
async exportProfile(profile, exportFlags) {
|
|
193
|
-
const disposables = (
|
|
196
|
+
const disposables = ( new DisposableStore());
|
|
194
197
|
try {
|
|
195
198
|
const userDataProfilesExportState = disposables.add(this.instantiationService.createInstance(UserDataProfileExportState, profile, exportFlags));
|
|
196
|
-
await this.doExportProfile(userDataProfilesExportState,
|
|
199
|
+
await this.doExportProfile(userDataProfilesExportState, ProgressLocation.Notification);
|
|
197
200
|
}
|
|
198
201
|
finally {
|
|
199
202
|
disposables.dispose();
|
|
@@ -202,18 +205,18 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
202
205
|
async createTroubleshootProfile() {
|
|
203
206
|
const userDataProfilesExportState = this.instantiationService.createInstance(UserDataProfileExportState, this.userDataProfileService.currentProfile, undefined);
|
|
204
207
|
try {
|
|
205
|
-
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(
|
|
208
|
+
const profileTemplate = await userDataProfilesExportState.getProfileTemplate(( localize(11990, "Troubleshoot Issue")), undefined);
|
|
206
209
|
await this.progressService.withProgress({
|
|
207
|
-
location:
|
|
210
|
+
location: ProgressLocation.Notification,
|
|
208
211
|
delay: 1000,
|
|
209
212
|
sticky: true,
|
|
210
213
|
}, async (progress) => {
|
|
211
|
-
const reportProgress = (message) => progress.report({ message: ( localize(
|
|
214
|
+
const reportProgress = (message) => progress.report({ message: ( localize(11991, "Setting up Troubleshoot Profile: {0}", message)) });
|
|
212
215
|
const profile = await this.doCreateProfile(profileTemplate, true, false, { useDefaultFlags: this.userDataProfileService.currentProfile.useDefaultFlags }, reportProgress);
|
|
213
216
|
if (profile) {
|
|
214
|
-
reportProgress(( localize(
|
|
217
|
+
reportProgress(( localize(11992, "Applying Extensions...")));
|
|
215
218
|
await this.instantiationService.createInstance(ExtensionsResource).copy(this.userDataProfileService.currentProfile, profile, true);
|
|
216
|
-
reportProgress(( localize(
|
|
219
|
+
reportProgress(( localize(11993, "Switching Profile...")));
|
|
217
220
|
await this.userDataProfileManagementService.switchProfile(profile);
|
|
218
221
|
}
|
|
219
222
|
});
|
|
@@ -227,11 +230,11 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
227
230
|
if (!profile) {
|
|
228
231
|
return;
|
|
229
232
|
}
|
|
230
|
-
const disposables = (
|
|
233
|
+
const disposables = ( new DisposableStore());
|
|
231
234
|
try {
|
|
232
235
|
await this.progressService.withProgress({
|
|
233
236
|
location,
|
|
234
|
-
title: ( localize(
|
|
237
|
+
title: ( localize(11994, "{0}: Exporting...", PROFILES_CATEGORY.value)),
|
|
235
238
|
}, async (progress) => {
|
|
236
239
|
const id = await this.pickProfileContentHandler(profile.name);
|
|
237
240
|
if (!id) {
|
|
@@ -245,17 +248,17 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
245
248
|
if (!saveResult) {
|
|
246
249
|
return;
|
|
247
250
|
}
|
|
248
|
-
const message = ( localize(
|
|
251
|
+
const message = ( localize(11995, "Profile '{0}' was exported successfully.", profile.name));
|
|
249
252
|
if (profileContentHandler.extensionId) {
|
|
250
253
|
const buttons = [];
|
|
251
|
-
const link = this.productService.webUrl ? `${this.productService.webUrl}/${PROFILE_URL_AUTHORITY}/${id}/${saveResult.id}` : (
|
|
254
|
+
const link = this.productService.webUrl ? `${this.productService.webUrl}/${PROFILE_URL_AUTHORITY}/${id}/${saveResult.id}` : ( toUserDataProfileUri(`/${id}/${saveResult.id}`, this.productService).toString());
|
|
252
255
|
buttons.push({
|
|
253
|
-
label: ( localize(
|
|
256
|
+
label: ( localize(11996, "&&Copy Link")),
|
|
254
257
|
run: () => this.clipboardService.writeText(link)
|
|
255
258
|
});
|
|
256
259
|
if (this.productService.webUrl) {
|
|
257
260
|
buttons.push({
|
|
258
|
-
label: ( localize(
|
|
261
|
+
label: ( localize(11997, "&&Open Link")),
|
|
259
262
|
run: async () => {
|
|
260
263
|
await this.openerService.open(link);
|
|
261
264
|
}
|
|
@@ -263,17 +266,17 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
263
266
|
}
|
|
264
267
|
else {
|
|
265
268
|
buttons.push({
|
|
266
|
-
label: ( localize(
|
|
269
|
+
label: ( localize(11998, "&&Open in {0}", profileContentHandler.name)),
|
|
267
270
|
run: async () => {
|
|
268
|
-
await this.openerService.open((
|
|
271
|
+
await this.openerService.open(( saveResult.link.toString()));
|
|
269
272
|
}
|
|
270
273
|
});
|
|
271
274
|
}
|
|
272
275
|
await this.dialogService.prompt({
|
|
273
|
-
type: Severity
|
|
276
|
+
type: Severity.Info,
|
|
274
277
|
message,
|
|
275
278
|
buttons,
|
|
276
|
-
cancelButton: ( localize(
|
|
279
|
+
cancelButton: ( localize(11999, "Close"))
|
|
277
280
|
});
|
|
278
281
|
}
|
|
279
282
|
else {
|
|
@@ -295,10 +298,10 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
295
298
|
profileTemplate = JSON.parse(profileContent);
|
|
296
299
|
}
|
|
297
300
|
catch (error) {
|
|
298
|
-
throw (
|
|
301
|
+
throw ( new Error(( localize(12000, "This profile is not valid."))));
|
|
299
302
|
}
|
|
300
303
|
if (!isUserDataProfileTemplate(profileTemplate)) {
|
|
301
|
-
throw (
|
|
304
|
+
throw ( new Error(( localize(12000, "This profile is not valid."))));
|
|
302
305
|
}
|
|
303
306
|
if (options?.name) {
|
|
304
307
|
profileTemplate.name = options.name;
|
|
@@ -332,27 +335,27 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
332
335
|
return undefined;
|
|
333
336
|
}
|
|
334
337
|
if (profileTemplate.settings && !profile.useDefaultFlags?.settings) {
|
|
335
|
-
progress(( localize(
|
|
338
|
+
progress(( localize(12001, "Applying Settings...")));
|
|
336
339
|
await this.instantiationService.createInstance(SettingsResource).apply(profileTemplate.settings, profile);
|
|
337
340
|
}
|
|
338
341
|
if (profileTemplate.keybindings && !profile.useDefaultFlags?.keybindings) {
|
|
339
|
-
progress(( localize(
|
|
342
|
+
progress(( localize(12002, "Applying Keyboard Shortcuts...")));
|
|
340
343
|
await this.instantiationService.createInstance(KeybindingsResource).apply(profileTemplate.keybindings, profile);
|
|
341
344
|
}
|
|
342
345
|
if (profileTemplate.tasks && !profile.useDefaultFlags?.tasks) {
|
|
343
|
-
progress(( localize(
|
|
346
|
+
progress(( localize(12003, "Applying Tasks...")));
|
|
344
347
|
await this.instantiationService.createInstance(TasksResource).apply(profileTemplate.tasks, profile);
|
|
345
348
|
}
|
|
346
349
|
if (profileTemplate.snippets && !profile.useDefaultFlags?.snippets) {
|
|
347
|
-
progress(( localize(
|
|
350
|
+
progress(( localize(12004, "Applying Snippets...")));
|
|
348
351
|
await this.instantiationService.createInstance(SnippetsResource).apply(profileTemplate.snippets, profile);
|
|
349
352
|
}
|
|
350
353
|
if (profileTemplate.globalState && !profile.useDefaultFlags?.globalState) {
|
|
351
|
-
progress(( localize(
|
|
354
|
+
progress(( localize(12005, "Applying State...")));
|
|
352
355
|
await this.instantiationService.createInstance(GlobalStateResource).apply(profileTemplate.globalState, profile);
|
|
353
356
|
}
|
|
354
357
|
if (profileTemplate.extensions && extensions && !profile.useDefaultFlags?.extensions) {
|
|
355
|
-
progress(( localize(
|
|
358
|
+
progress(( localize(11992, "Applying Extensions...")));
|
|
356
359
|
await this.instantiationService.createInstance(ExtensionsResource).apply(profileTemplate.extensions, profile);
|
|
357
360
|
}
|
|
358
361
|
return profile;
|
|
@@ -369,7 +372,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
369
372
|
}
|
|
370
373
|
else {
|
|
371
374
|
handlerId = resource.authority.substring(PROFILE_URL_AUTHORITY_PREFIX.length);
|
|
372
|
-
idOrUri = (
|
|
375
|
+
idOrUri = ( URI.parse(resource.path.substring(1)));
|
|
373
376
|
}
|
|
374
377
|
await this.extensionService.activateByEvent(`onProfile:${handlerId}`);
|
|
375
378
|
const profileContentHandler = this.profileContentHandlers.get(handlerId);
|
|
@@ -378,34 +381,32 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
378
381
|
}
|
|
379
382
|
}
|
|
380
383
|
await this.extensionService.activateByEvent('onProfile');
|
|
381
|
-
for (const profileContentHandler of (
|
|
384
|
+
for (const profileContentHandler of ( this.profileContentHandlers.values())) {
|
|
382
385
|
const content = await profileContentHandler.readProfile(resource, CancellationToken.None);
|
|
383
386
|
if (content !== null) {
|
|
384
387
|
return content;
|
|
385
388
|
}
|
|
386
389
|
}
|
|
387
|
-
const context = await this.requestService.request({ type: 'GET', url: (
|
|
390
|
+
const context = await this.requestService.request({ type: 'GET', url: ( resource.toString(true)) }, CancellationToken.None);
|
|
388
391
|
if (context.res.statusCode === 200) {
|
|
389
392
|
return await asText(context);
|
|
390
393
|
}
|
|
391
394
|
else {
|
|
392
395
|
const message = await asText(context);
|
|
393
|
-
throw (
|
|
394
|
-
`Failed to get profile from URL: ${( (resource.toString()))}. Status code: ${context.res.statusCode}. Message: ${message}`
|
|
395
|
-
)));
|
|
396
|
+
throw ( new Error(`Failed to get profile from URL: ${( resource.toString())}. Status code: ${context.res.statusCode}. Message: ${message}`));
|
|
396
397
|
}
|
|
397
398
|
}
|
|
398
399
|
async pickProfileContentHandler(name) {
|
|
399
400
|
await this.extensionService.activateByEvent('onProfile');
|
|
400
401
|
if (this.profileContentHandlers.size === 1) {
|
|
401
|
-
return (
|
|
402
|
+
return ( this.profileContentHandlers.keys()).next().value;
|
|
402
403
|
}
|
|
403
404
|
const options = [];
|
|
404
405
|
for (const [id, profileContentHandler] of this.profileContentHandlers) {
|
|
405
406
|
options.push({ id, label: profileContentHandler.name, description: profileContentHandler.description });
|
|
406
407
|
}
|
|
407
408
|
const result = await this.quickInputService.pick(options.reverse(), {
|
|
408
|
-
title: ( localize(
|
|
409
|
+
title: ( localize(12006, "Export '{0}' profile as...", name)),
|
|
409
410
|
hideInput: true
|
|
410
411
|
});
|
|
411
412
|
return result?.id;
|
|
@@ -418,13 +419,13 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
418
419
|
return this.userDataProfilesService.createNamedProfile(`${profileName} ${this.getProfileNameIndex(profileName)}`, { ...options, transient: temp });
|
|
419
420
|
}
|
|
420
421
|
const { confirmed } = await this.dialogService.confirm({
|
|
421
|
-
type: Severity
|
|
422
|
+
type: Severity.Info,
|
|
422
423
|
message: ( localize(
|
|
423
|
-
|
|
424
|
+
12007,
|
|
424
425
|
"Profile with name '{0}' already exists. Do you want to replace its contents?",
|
|
425
426
|
profileName
|
|
426
427
|
)),
|
|
427
|
-
primaryButton: ( localize(
|
|
428
|
+
primaryButton: ( localize(12008, "&&Replace"))
|
|
428
429
|
});
|
|
429
430
|
if (!confirmed) {
|
|
430
431
|
return undefined;
|
|
@@ -436,7 +437,7 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
436
437
|
}
|
|
437
438
|
}
|
|
438
439
|
getProfileNameIndex(name) {
|
|
439
|
-
const nameRegEx = (
|
|
440
|
+
const nameRegEx = ( new RegExp(`${escapeRegExpCharacters(name)}\\s(\\d+)`));
|
|
440
441
|
let nameIndex = 0;
|
|
441
442
|
for (const profile of this.userDataProfilesService.profiles) {
|
|
442
443
|
const matches = nameRegEx.exec(profile.name);
|
|
@@ -446,21 +447,21 @@ let UserDataProfileImportExportService = class UserDataProfileImportExportServic
|
|
|
446
447
|
return nameIndex + 1;
|
|
447
448
|
}
|
|
448
449
|
};
|
|
449
|
-
UserDataProfileImportExportService = (
|
|
450
|
-
(
|
|
451
|
-
(
|
|
452
|
-
(
|
|
453
|
-
(
|
|
454
|
-
(
|
|
455
|
-
(
|
|
456
|
-
(
|
|
457
|
-
(
|
|
458
|
-
(
|
|
459
|
-
(
|
|
460
|
-
(
|
|
461
|
-
(
|
|
462
|
-
(
|
|
463
|
-
], UserDataProfileImportExportService))
|
|
450
|
+
UserDataProfileImportExportService = ( __decorate([
|
|
451
|
+
( __param(0, IInstantiationService)),
|
|
452
|
+
( __param(1, IUserDataProfileService)),
|
|
453
|
+
( __param(2, IUserDataProfileManagementService)),
|
|
454
|
+
( __param(3, IUserDataProfilesService)),
|
|
455
|
+
( __param(4, IExtensionService)),
|
|
456
|
+
( __param(5, IQuickInputService)),
|
|
457
|
+
( __param(6, IProgressService)),
|
|
458
|
+
( __param(7, IDialogService)),
|
|
459
|
+
( __param(8, IClipboardService)),
|
|
460
|
+
( __param(9, IOpenerService)),
|
|
461
|
+
( __param(10, IRequestService)),
|
|
462
|
+
( __param(11, IProductService)),
|
|
463
|
+
( __param(12, IUriIdentityService))
|
|
464
|
+
], UserDataProfileImportExportService));
|
|
464
465
|
let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler {
|
|
465
466
|
constructor(fileDialogService, uriIdentityService, fileService, productService, textFileService) {
|
|
466
467
|
this.fileDialogService = fileDialogService;
|
|
@@ -468,12 +469,12 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
|
|
|
468
469
|
this.fileService = fileService;
|
|
469
470
|
this.productService = productService;
|
|
470
471
|
this.textFileService = textFileService;
|
|
471
|
-
this.name = ( localize(
|
|
472
|
-
this.description = ( localize(
|
|
472
|
+
this.name = ( localize(12009, "Local"));
|
|
473
|
+
this.description = ( localize(12010, "file"));
|
|
473
474
|
}
|
|
474
475
|
async saveProfile(name, content, token) {
|
|
475
476
|
const link = await this.fileDialogService.showSaveDialog({
|
|
476
|
-
title: ( localize(
|
|
477
|
+
title: ( localize(12011, "Save Profile")),
|
|
477
478
|
filters: PROFILE_FILTER,
|
|
478
479
|
defaultUri: this.uriIdentityService.extUri.joinPath(await this.fileDialogService.defaultFilePath(), `${name}.${PROFILE_EXTENSION}`),
|
|
479
480
|
});
|
|
@@ -481,16 +482,14 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
|
|
|
481
482
|
return null;
|
|
482
483
|
}
|
|
483
484
|
await this.textFileService.create([{ resource: link, value: content, options: { overwrite: true } }]);
|
|
484
|
-
return { link, id: (
|
|
485
|
+
return { link, id: ( link.toString()) };
|
|
485
486
|
}
|
|
486
487
|
async canHandle(uri) {
|
|
487
488
|
return uri.scheme !== Schemas.http && uri.scheme !== Schemas.https && uri.scheme !== this.productService.urlProtocol && (await this.fileService.canHandleResource(uri));
|
|
488
489
|
}
|
|
489
490
|
async readProfile(uri, token) {
|
|
490
491
|
if (await this.canHandle(uri)) {
|
|
491
|
-
return (
|
|
492
|
-
((await this.fileService.readFile(uri, undefined, token)).value.toString())
|
|
493
|
-
);
|
|
492
|
+
return ( (await this.fileService.readFile(uri, undefined, token)).value.toString());
|
|
494
493
|
}
|
|
495
494
|
return null;
|
|
496
495
|
}
|
|
@@ -500,25 +499,25 @@ let FileUserDataProfileContentHandler = class FileUserDataProfileContentHandler
|
|
|
500
499
|
canSelectFiles: true,
|
|
501
500
|
canSelectMany: false,
|
|
502
501
|
filters: PROFILE_FILTER,
|
|
503
|
-
title: ( localize(
|
|
502
|
+
title: ( localize(12012, "Select Profile")),
|
|
504
503
|
});
|
|
505
504
|
return profileLocation ? profileLocation[0] : null;
|
|
506
505
|
}
|
|
507
506
|
};
|
|
508
|
-
FileUserDataProfileContentHandler = (
|
|
509
|
-
(
|
|
510
|
-
(
|
|
511
|
-
(
|
|
512
|
-
(
|
|
513
|
-
(
|
|
514
|
-
], FileUserDataProfileContentHandler))
|
|
507
|
+
FileUserDataProfileContentHandler = ( __decorate([
|
|
508
|
+
( __param(0, IFileDialogService)),
|
|
509
|
+
( __param(1, IUriIdentityService)),
|
|
510
|
+
( __param(2, IFileService)),
|
|
511
|
+
( __param(3, IProductService)),
|
|
512
|
+
( __param(4, ITextFileService))
|
|
513
|
+
], FileUserDataProfileContentHandler));
|
|
515
514
|
const USER_DATA_PROFILE_EXPORT_SCHEME = 'userdataprofileexport';
|
|
516
515
|
const USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME = 'userdataprofileexportpreview';
|
|
517
516
|
let UserDataProfileImportExportState = class UserDataProfileImportExportState extends Disposable {
|
|
518
517
|
constructor(quickInputService) {
|
|
519
518
|
super();
|
|
520
519
|
this.quickInputService = quickInputService;
|
|
521
|
-
this._onDidChangeRoots = this._register((
|
|
520
|
+
this._onDidChangeRoots = this._register(( new Emitter()));
|
|
522
521
|
this.onDidChangeRoots = this._onDidChangeRoots.event;
|
|
523
522
|
this.roots = [];
|
|
524
523
|
}
|
|
@@ -547,13 +546,13 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
547
546
|
for (const root of this.roots) {
|
|
548
547
|
root.checkbox = {
|
|
549
548
|
isChecked: !root.isFromDefaultProfile(),
|
|
550
|
-
tooltip: ( localize(
|
|
549
|
+
tooltip: ( localize(12013, "Select {0}", root.label.label)),
|
|
551
550
|
accessibilityInformation: {
|
|
552
|
-
label: ( localize(
|
|
551
|
+
label: ( localize(12013, "Select {0}", root.label.label)),
|
|
553
552
|
}
|
|
554
553
|
};
|
|
555
554
|
if (root.isFromDefaultProfile()) {
|
|
556
|
-
root.description = ( localize(
|
|
555
|
+
root.description = ( localize(12014, "From Default Profile"));
|
|
557
556
|
}
|
|
558
557
|
}
|
|
559
558
|
return this.roots;
|
|
@@ -563,13 +562,9 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
563
562
|
}
|
|
564
563
|
isEnabled(resourceType) {
|
|
565
564
|
if (resourceType !== undefined) {
|
|
566
|
-
return (
|
|
567
|
-
(this.roots.some(root => root.type === resourceType && this.isSelected(root)))
|
|
568
|
-
);
|
|
565
|
+
return ( this.roots.some(root => root.type === resourceType && this.isSelected(root)));
|
|
569
566
|
}
|
|
570
|
-
return (
|
|
571
|
-
(this.roots.some(root => this.isSelected(root)))
|
|
572
|
-
);
|
|
567
|
+
return ( this.roots.some(root => this.isSelected(root)));
|
|
573
568
|
}
|
|
574
569
|
async getProfileTemplate(name, icon) {
|
|
575
570
|
const roots = await this.getRoots();
|
|
@@ -620,9 +615,9 @@ let UserDataProfileImportExportState = class UserDataProfileImportExportState ex
|
|
|
620
615
|
return true;
|
|
621
616
|
}
|
|
622
617
|
};
|
|
623
|
-
UserDataProfileImportExportState = (
|
|
624
|
-
(
|
|
625
|
-
], UserDataProfileImportExportState))
|
|
618
|
+
UserDataProfileImportExportState = ( __decorate([
|
|
619
|
+
( __param(0, IQuickInputService))
|
|
620
|
+
], UserDataProfileImportExportState));
|
|
626
621
|
let UserDataProfileExportState = class UserDataProfileExportState extends UserDataProfileImportExportState {
|
|
627
622
|
constructor(profile, exportFlags, quickInputService, fileService, instantiationService) {
|
|
628
623
|
super(quickInputService);
|
|
@@ -630,12 +625,12 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
630
625
|
this.exportFlags = exportFlags;
|
|
631
626
|
this.fileService = fileService;
|
|
632
627
|
this.instantiationService = instantiationService;
|
|
633
|
-
this.disposables = this._register((
|
|
628
|
+
this.disposables = this._register(( new DisposableStore()));
|
|
634
629
|
}
|
|
635
630
|
async fetchRoots() {
|
|
636
631
|
this.disposables.clear();
|
|
637
|
-
this.disposables.add(this.fileService.registerProvider(USER_DATA_PROFILE_EXPORT_SCHEME, this._register((
|
|
638
|
-
const previewFileSystemProvider = this._register((
|
|
632
|
+
this.disposables.add(this.fileService.registerProvider(USER_DATA_PROFILE_EXPORT_SCHEME, this._register(( new InMemoryFileSystemProvider()))));
|
|
633
|
+
const previewFileSystemProvider = this._register(( new InMemoryFileSystemProvider()));
|
|
639
634
|
this.disposables.add(this.fileService.registerProvider(USER_DATA_PROFILE_EXPORT_PREVIEW_SCHEME, previewFileSystemProvider));
|
|
640
635
|
const roots = [];
|
|
641
636
|
const exportPreviewProfle = this.createExportPreviewProfile(this.profile);
|
|
@@ -715,11 +710,11 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
715
710
|
let name = this.profile.name;
|
|
716
711
|
if (this.profile.isDefault) {
|
|
717
712
|
name = await this.quickInputService.input({
|
|
718
|
-
placeHolder: ( localize(
|
|
719
|
-
title: ( localize(
|
|
713
|
+
placeHolder: ( localize(12015, "Name the profile")),
|
|
714
|
+
title: ( localize(12016, "Export Profile")),
|
|
720
715
|
async validateInput(input) {
|
|
721
716
|
if (!input.trim()) {
|
|
722
|
-
return
|
|
717
|
+
return localize(12017, "Profile name must be provided.");
|
|
723
718
|
}
|
|
724
719
|
return undefined;
|
|
725
720
|
},
|
|
@@ -731,10 +726,10 @@ let UserDataProfileExportState = class UserDataProfileExportState extends UserDa
|
|
|
731
726
|
return super.getProfileTemplate(name, this.profile.icon);
|
|
732
727
|
}
|
|
733
728
|
};
|
|
734
|
-
UserDataProfileExportState = (
|
|
735
|
-
(
|
|
736
|
-
(
|
|
737
|
-
(
|
|
738
|
-
], UserDataProfileExportState))
|
|
729
|
+
UserDataProfileExportState = ( __decorate([
|
|
730
|
+
( __param(2, IQuickInputService)),
|
|
731
|
+
( __param(3, IFileService)),
|
|
732
|
+
( __param(4, IInstantiationService))
|
|
733
|
+
], UserDataProfileExportState));
|
|
739
734
|
|
|
740
735
|
export { UserDataProfileImportExportService };
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
import { IStorageService } from "vscode/vscode/vs/platform/storage/common/storage.service";
|
|
2
|
+
import { IFileService } from "vscode/vscode/vs/platform/files/common/files.service";
|
|
3
|
+
import { IInstantiationService } from "vscode/vscode/vs/platform/instantiation/common/instantiation";
|
|
4
|
+
import { ILogService } from "vscode/vscode/vs/platform/log/common/log.service";
|
|
5
|
+
import { IUriIdentityService } from "vscode/vscode/vs/platform/uriIdentity/common/uriIdentity.service";
|
|
6
|
+
import { IUserDataInitializer } from "../../userData/browser/userDataInit.js";
|
|
7
|
+
import { IUserDataProfileService } from "vscode/vscode/vs/workbench/services/userDataProfile/common/userDataProfile.service";
|
|
8
|
+
import { IBrowserWorkbenchEnvironmentService } from "vscode/vscode/vs/workbench/services/environment/browser/environmentService.service";
|
|
9
|
+
import { IRequestService } from "vscode/vscode/vs/platform/request/common/request.service";
|
|
10
|
+
export declare class UserDataProfileInitializer implements IUserDataInitializer {
|
|
11
|
+
private readonly environmentService;
|
|
12
|
+
private readonly fileService;
|
|
13
|
+
private readonly userDataProfileService;
|
|
14
|
+
private readonly storageService;
|
|
15
|
+
private readonly logService;
|
|
16
|
+
private readonly uriIdentityService;
|
|
17
|
+
private readonly requestService;
|
|
18
|
+
_serviceBrand: any;
|
|
19
|
+
private readonly initialized;
|
|
20
|
+
private readonly initializationFinished;
|
|
21
|
+
constructor(environmentService: IBrowserWorkbenchEnvironmentService, fileService: IFileService, userDataProfileService: IUserDataProfileService, storageService: IStorageService, logService: ILogService, uriIdentityService: IUriIdentityService, requestService: IRequestService);
|
|
22
|
+
whenInitializationFinished(): Promise<void>;
|
|
23
|
+
requiresInitialization(): Promise<boolean>;
|
|
24
|
+
initializeRequiredResources(): Promise<void>;
|
|
25
|
+
initializeOtherResources(instantiationService: IInstantiationService): Promise<void>;
|
|
26
|
+
private initializeInstalledExtensionsPromise;
|
|
27
|
+
initializeInstalledExtensions(instantiationService: IInstantiationService): Promise<void>;
|
|
28
|
+
private profileTemplatePromise;
|
|
29
|
+
private getProfileTemplate;
|
|
30
|
+
private doGetProfileTemplate;
|
|
31
|
+
private initialize;
|
|
32
|
+
}
|