@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
|
@@ -36,7 +36,18 @@ import { IBrowserWorkbenchEnvironmentService } from '@codingame/monaco-vscode-ap
|
|
|
36
36
|
import { ISecretStorageService } from '@codingame/monaco-vscode-api/vscode/vs/platform/secrets/common/secrets.service';
|
|
37
37
|
|
|
38
38
|
let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
39
|
-
constructor(
|
|
39
|
+
constructor(
|
|
40
|
+
environmentService,
|
|
41
|
+
secretStorageService,
|
|
42
|
+
userDataSyncStoreManagementService,
|
|
43
|
+
fileService,
|
|
44
|
+
userDataProfilesService,
|
|
45
|
+
storageService,
|
|
46
|
+
productService,
|
|
47
|
+
requestService,
|
|
48
|
+
logService,
|
|
49
|
+
uriIdentityService
|
|
50
|
+
) {
|
|
40
51
|
this.environmentService = environmentService;
|
|
41
52
|
this.secretStorageService = secretStorageService;
|
|
42
53
|
this.userDataSyncStoreManagementService = userDataSyncStoreManagementService;
|
|
@@ -79,8 +90,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
79
90
|
let authenticationSession;
|
|
80
91
|
try {
|
|
81
92
|
authenticationSession = await getCurrentAuthenticationSessionInfo(this.secretStorageService, this.productService);
|
|
82
|
-
}
|
|
83
|
-
catch (error) {
|
|
93
|
+
} catch (error) {
|
|
84
94
|
this.logService.error(error);
|
|
85
95
|
}
|
|
86
96
|
if (!authenticationSession) {
|
|
@@ -111,8 +121,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
111
121
|
}
|
|
112
122
|
this.logService.info(`Using settings sync service ${( userDataSyncStore.url.toString())} for initialization`);
|
|
113
123
|
return userDataSyncStoreClient;
|
|
114
|
-
}
|
|
115
|
-
catch (error) {
|
|
124
|
+
} catch (error) {
|
|
116
125
|
this.logService.error(error);
|
|
117
126
|
return;
|
|
118
127
|
}
|
|
@@ -148,14 +157,16 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
148
157
|
)).getSyncStoreType(this.globalStateUserData);
|
|
149
158
|
if (userDataSyncStoreType) {
|
|
150
159
|
await this.userDataSyncStoreManagementService.switch(userDataSyncStoreType);
|
|
151
|
-
if (!isEqual(
|
|
152
|
-
|
|
160
|
+
if (!isEqual(
|
|
161
|
+
userDataSyncStore.url,
|
|
162
|
+
this.userDataSyncStoreManagementService.userDataSyncStore?.url
|
|
163
|
+
)) {
|
|
164
|
+
this.logService.info("Switched settings sync store");
|
|
153
165
|
this.globalStateUserData = null;
|
|
154
166
|
}
|
|
155
167
|
}
|
|
156
168
|
}
|
|
157
|
-
}
|
|
158
|
-
finally {
|
|
169
|
+
} finally {
|
|
159
170
|
disposables.dispose();
|
|
160
171
|
}
|
|
161
172
|
}
|
|
@@ -174,17 +185,21 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
174
185
|
async initializeOtherResources(instantiationService) {
|
|
175
186
|
try {
|
|
176
187
|
this.logService.trace(`UserDataInitializationService#initializeOtherResources`);
|
|
177
|
-
await Promise.allSettled([
|
|
178
|
-
|
|
179
|
-
|
|
188
|
+
await Promise.allSettled([
|
|
189
|
+
this.initialize([SyncResource.Keybindings, SyncResource.Snippets, SyncResource.Tasks]),
|
|
190
|
+
this.initializeExtensions(instantiationService)
|
|
191
|
+
]);
|
|
192
|
+
} finally {
|
|
180
193
|
this.initializationFinished.open();
|
|
181
194
|
}
|
|
182
195
|
}
|
|
183
196
|
async initializeExtensions(instantiationService) {
|
|
184
197
|
try {
|
|
185
|
-
await Promise.all([
|
|
186
|
-
|
|
187
|
-
|
|
198
|
+
await Promise.all([
|
|
199
|
+
this.initializeInstalledExtensions(instantiationService),
|
|
200
|
+
this.initializeNewExtensions(instantiationService)
|
|
201
|
+
]);
|
|
202
|
+
} finally {
|
|
188
203
|
this.initialized.push(SyncResource.Extensions);
|
|
189
204
|
}
|
|
190
205
|
}
|
|
@@ -230,7 +245,7 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
230
245
|
if (!userDataSyncStoreClient) {
|
|
231
246
|
return;
|
|
232
247
|
}
|
|
233
|
-
await Promises.settled(( syncResources.map(async
|
|
248
|
+
await Promises.settled(( syncResources.map(async syncResource => {
|
|
234
249
|
try {
|
|
235
250
|
if (this.initialized.includes(syncResource)) {
|
|
236
251
|
this.logService.info(`${getSyncAreaLabel(syncResource)} initialized already.`);
|
|
@@ -239,11 +254,13 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
239
254
|
this.initialized.push(syncResource);
|
|
240
255
|
this.logService.trace(`Initializing ${getSyncAreaLabel(syncResource)}`);
|
|
241
256
|
const initializer = this.createSyncResourceInitializer(syncResource);
|
|
242
|
-
const userData = await userDataSyncStoreClient.readResource(
|
|
257
|
+
const userData = await userDataSyncStoreClient.readResource(
|
|
258
|
+
syncResource,
|
|
259
|
+
syncResource === SyncResource.GlobalState ? this.globalStateUserData : null
|
|
260
|
+
);
|
|
243
261
|
await initializer.initialize(userData);
|
|
244
262
|
this.logService.info(`Initialized ${getSyncAreaLabel(syncResource)}`);
|
|
245
|
-
}
|
|
246
|
-
catch (error) {
|
|
263
|
+
} catch (error) {
|
|
247
264
|
this.logService.info(`Error while initializing ${getSyncAreaLabel(syncResource)}`);
|
|
248
265
|
this.logService.error(error);
|
|
249
266
|
}
|
|
@@ -251,7 +268,8 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
251
268
|
}
|
|
252
269
|
createSyncResourceInitializer(syncResource) {
|
|
253
270
|
switch (syncResource) {
|
|
254
|
-
|
|
271
|
+
case SyncResource.Settings:
|
|
272
|
+
return ( new SettingsInitializer(
|
|
255
273
|
this.fileService,
|
|
256
274
|
this.userDataProfilesService,
|
|
257
275
|
this.environmentService,
|
|
@@ -259,7 +277,8 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
259
277
|
this.storageService,
|
|
260
278
|
this.uriIdentityService
|
|
261
279
|
));
|
|
262
|
-
|
|
280
|
+
case SyncResource.Keybindings:
|
|
281
|
+
return ( new KeybindingsInitializer(
|
|
263
282
|
this.fileService,
|
|
264
283
|
this.userDataProfilesService,
|
|
265
284
|
this.environmentService,
|
|
@@ -267,7 +286,8 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
267
286
|
this.storageService,
|
|
268
287
|
this.uriIdentityService
|
|
269
288
|
));
|
|
270
|
-
|
|
289
|
+
case SyncResource.Tasks:
|
|
290
|
+
return ( new TasksInitializer(
|
|
271
291
|
this.fileService,
|
|
272
292
|
this.userDataProfilesService,
|
|
273
293
|
this.environmentService,
|
|
@@ -275,7 +295,8 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
275
295
|
this.storageService,
|
|
276
296
|
this.uriIdentityService
|
|
277
297
|
));
|
|
278
|
-
|
|
298
|
+
case SyncResource.Snippets:
|
|
299
|
+
return ( new SnippetsInitializer(
|
|
279
300
|
this.fileService,
|
|
280
301
|
this.userDataProfilesService,
|
|
281
302
|
this.environmentService,
|
|
@@ -283,7 +304,8 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
283
304
|
this.storageService,
|
|
284
305
|
this.uriIdentityService
|
|
285
306
|
));
|
|
286
|
-
|
|
307
|
+
case SyncResource.GlobalState:
|
|
308
|
+
return ( new GlobalStateInitializer(
|
|
287
309
|
this.storageService,
|
|
288
310
|
this.fileService,
|
|
289
311
|
this.userDataProfilesService,
|
|
@@ -295,21 +317,29 @@ let UserDataSyncInitializer = class UserDataSyncInitializer {
|
|
|
295
317
|
throw ( new Error(`Cannot create initializer for ${syncResource}`));
|
|
296
318
|
}
|
|
297
319
|
};
|
|
298
|
-
UserDataSyncInitializer = ( __decorate([
|
|
299
|
-
( __param(0, IBrowserWorkbenchEnvironmentService)),
|
|
300
|
-
( __param(1, ISecretStorageService)),
|
|
301
|
-
( __param(2, IUserDataSyncStoreManagementService)),
|
|
302
|
-
( __param(3, IFileService)),
|
|
303
|
-
( __param(4, IUserDataProfilesService)),
|
|
304
|
-
( __param(5, IStorageService)),
|
|
305
|
-
( __param(6, IProductService)),
|
|
306
|
-
( __param(7, IRequestService)),
|
|
307
|
-
( __param(8, ILogService)),
|
|
308
|
-
( __param(9, IUriIdentityService))
|
|
309
|
-
], UserDataSyncInitializer));
|
|
320
|
+
UserDataSyncInitializer = ( __decorate([( __param(0, IBrowserWorkbenchEnvironmentService)), ( __param(1, ISecretStorageService)), ( __param(2, IUserDataSyncStoreManagementService)), ( __param(3, IFileService)), ( __param(4, IUserDataProfilesService)), ( __param(5, IStorageService)), ( __param(6, IProductService)), ( __param(7, IRequestService)), ( __param(8, ILogService)), ( __param(9, IUriIdentityService))], UserDataSyncInitializer));
|
|
310
321
|
let ExtensionsPreviewInitializer = class ExtensionsPreviewInitializer extends AbstractExtensionsInitializer {
|
|
311
|
-
constructor(
|
|
312
|
-
|
|
322
|
+
constructor(
|
|
323
|
+
extensionsData,
|
|
324
|
+
extensionManagementService,
|
|
325
|
+
ignoredExtensionsManagementService,
|
|
326
|
+
fileService,
|
|
327
|
+
userDataProfilesService,
|
|
328
|
+
environmentService,
|
|
329
|
+
logService,
|
|
330
|
+
storageService,
|
|
331
|
+
uriIdentityService
|
|
332
|
+
) {
|
|
333
|
+
super(
|
|
334
|
+
extensionManagementService,
|
|
335
|
+
ignoredExtensionsManagementService,
|
|
336
|
+
fileService,
|
|
337
|
+
userDataProfilesService,
|
|
338
|
+
environmentService,
|
|
339
|
+
logService,
|
|
340
|
+
storageService,
|
|
341
|
+
uriIdentityService
|
|
342
|
+
);
|
|
313
343
|
this.extensionsData = extensionsData;
|
|
314
344
|
this.preview = null;
|
|
315
345
|
}
|
|
@@ -320,30 +350,28 @@ let ExtensionsPreviewInitializer = class ExtensionsPreviewInitializer extends Ab
|
|
|
320
350
|
return this.previewPromise;
|
|
321
351
|
}
|
|
322
352
|
initialize() {
|
|
323
|
-
throw ( new Error(
|
|
353
|
+
throw ( new Error("should not be called directly"));
|
|
324
354
|
}
|
|
325
355
|
async doInitialize(remoteUserData) {
|
|
326
356
|
const remoteExtensions = await this.parseExtensions(remoteUserData);
|
|
327
357
|
if (!remoteExtensions) {
|
|
328
|
-
this.logService.info(
|
|
358
|
+
this.logService.info(
|
|
359
|
+
"Skipping initializing extensions because remote extensions does not exist."
|
|
360
|
+
);
|
|
329
361
|
return;
|
|
330
362
|
}
|
|
331
363
|
const installedExtensions = await this.extensionManagementService.getInstalled();
|
|
332
364
|
this.preview = this.generatePreview(remoteExtensions, installedExtensions);
|
|
333
365
|
}
|
|
334
366
|
};
|
|
335
|
-
ExtensionsPreviewInitializer = ( __decorate([
|
|
336
|
-
( __param(1, IExtensionManagementService)),
|
|
337
|
-
( __param(2, IIgnoredExtensionsManagementService)),
|
|
338
|
-
( __param(3, IFileService)),
|
|
339
|
-
( __param(4, IUserDataProfilesService)),
|
|
340
|
-
( __param(5, IEnvironmentService)),
|
|
341
|
-
( __param(6, IUserDataSyncLogService)),
|
|
342
|
-
( __param(7, IStorageService)),
|
|
343
|
-
( __param(8, IUriIdentityService))
|
|
344
|
-
], ExtensionsPreviewInitializer));
|
|
367
|
+
ExtensionsPreviewInitializer = ( __decorate([( __param(1, IExtensionManagementService)), ( __param(2, IIgnoredExtensionsManagementService)), ( __param(3, IFileService)), ( __param(4, IUserDataProfilesService)), ( __param(5, IEnvironmentService)), ( __param(6, IUserDataSyncLogService)), ( __param(7, IStorageService)), ( __param(8, IUriIdentityService))], ExtensionsPreviewInitializer));
|
|
345
368
|
let InstalledExtensionsInitializer = class InstalledExtensionsInitializer {
|
|
346
|
-
constructor(
|
|
369
|
+
constructor(
|
|
370
|
+
extensionsPreviewInitializer,
|
|
371
|
+
extensionEnablementService,
|
|
372
|
+
extensionStorageService,
|
|
373
|
+
logService
|
|
374
|
+
) {
|
|
347
375
|
this.extensionsPreviewInitializer = extensionsPreviewInitializer;
|
|
348
376
|
this.extensionEnablementService = extensionEnablementService;
|
|
349
377
|
this.extensionStorageService = extensionStorageService;
|
|
@@ -355,7 +383,11 @@ let InstalledExtensionsInitializer = class InstalledExtensionsInitializer {
|
|
|
355
383
|
return;
|
|
356
384
|
}
|
|
357
385
|
for (const installedExtension of preview.installedExtensions) {
|
|
358
|
-
const syncExtension = preview.remoteExtensions.find((
|
|
386
|
+
const syncExtension = preview.remoteExtensions.find((
|
|
387
|
+
{
|
|
388
|
+
identifier
|
|
389
|
+
}
|
|
390
|
+
) => areSameExtensions(identifier, installedExtension.identifier));
|
|
359
391
|
if (syncExtension?.state) {
|
|
360
392
|
const extensionState = this.extensionStorageService.getExtensionState(installedExtension, true) || {};
|
|
361
393
|
( Object.keys(syncExtension.state)).forEach(key => extensionState[key] = syncExtension.state[key]);
|
|
@@ -371,13 +403,16 @@ let InstalledExtensionsInitializer = class InstalledExtensionsInitializer {
|
|
|
371
403
|
}
|
|
372
404
|
}
|
|
373
405
|
};
|
|
374
|
-
InstalledExtensionsInitializer = ( __decorate([
|
|
375
|
-
( __param(1, IGlobalExtensionEnablementService)),
|
|
376
|
-
( __param(2, IExtensionStorageService)),
|
|
377
|
-
( __param(3, IUserDataSyncLogService))
|
|
378
|
-
], InstalledExtensionsInitializer));
|
|
406
|
+
InstalledExtensionsInitializer = ( __decorate([( __param(1, IGlobalExtensionEnablementService)), ( __param(2, IExtensionStorageService)), ( __param(3, IUserDataSyncLogService))], InstalledExtensionsInitializer));
|
|
379
407
|
let NewExtensionsInitializer = class NewExtensionsInitializer {
|
|
380
|
-
constructor(
|
|
408
|
+
constructor(
|
|
409
|
+
extensionsPreviewInitializer,
|
|
410
|
+
extensionService,
|
|
411
|
+
extensionStorageService,
|
|
412
|
+
galleryService,
|
|
413
|
+
extensionManagementService,
|
|
414
|
+
logService
|
|
415
|
+
) {
|
|
381
416
|
this.extensionsPreviewInitializer = extensionsPreviewInitializer;
|
|
382
417
|
this.extensionService = extensionService;
|
|
383
418
|
this.extensionStorageService = extensionStorageService;
|
|
@@ -392,10 +427,17 @@ let NewExtensionsInitializer = class NewExtensionsInitializer {
|
|
|
392
427
|
}
|
|
393
428
|
const newlyEnabledExtensions = [];
|
|
394
429
|
const targetPlatform = await this.extensionManagementService.getTargetPlatform();
|
|
395
|
-
const galleryExtensions = await this.galleryService.getExtensions(preview.newExtensions, {
|
|
430
|
+
const galleryExtensions = await this.galleryService.getExtensions(preview.newExtensions, {
|
|
431
|
+
targetPlatform,
|
|
432
|
+
compatible: true
|
|
433
|
+
}, CancellationToken.None);
|
|
396
434
|
for (const galleryExtension of galleryExtensions) {
|
|
397
435
|
try {
|
|
398
|
-
const extensionToSync = preview.remoteExtensions.find((
|
|
436
|
+
const extensionToSync = preview.remoteExtensions.find((
|
|
437
|
+
{
|
|
438
|
+
identifier
|
|
439
|
+
}
|
|
440
|
+
) => areSameExtensions(identifier, galleryExtension.identifier));
|
|
399
441
|
if (!extensionToSync) {
|
|
400
442
|
continue;
|
|
401
443
|
}
|
|
@@ -408,14 +450,15 @@ let NewExtensionsInitializer = class NewExtensionsInitializer {
|
|
|
408
450
|
donotIncludePackAndDependencies: true,
|
|
409
451
|
installGivenVersion: !!extensionToSync.version,
|
|
410
452
|
installPreReleaseVersion: extensionToSync.preRelease,
|
|
411
|
-
context: {
|
|
453
|
+
context: {
|
|
454
|
+
[EXTENSION_INSTALL_SKIP_PUBLISHER_TRUST_CONTEXT]: true
|
|
455
|
+
}
|
|
412
456
|
});
|
|
413
457
|
if (!( preview.disabledExtensions.some(identifier => areSameExtensions(identifier, galleryExtension.identifier)))) {
|
|
414
458
|
newlyEnabledExtensions.push(local);
|
|
415
459
|
}
|
|
416
460
|
this.logService.info(`Installed extension.`, galleryExtension.identifier.id);
|
|
417
|
-
}
|
|
418
|
-
catch (error) {
|
|
461
|
+
} catch (error) {
|
|
419
462
|
this.logService.error(error);
|
|
420
463
|
}
|
|
421
464
|
}
|
|
@@ -428,8 +471,7 @@ let NewExtensionsInitializer = class NewExtensionsInitializer {
|
|
|
428
471
|
disposable.dispose();
|
|
429
472
|
c();
|
|
430
473
|
}
|
|
431
|
-
}
|
|
432
|
-
catch (error) {
|
|
474
|
+
} catch (error) {
|
|
433
475
|
e(error);
|
|
434
476
|
}
|
|
435
477
|
});
|
|
@@ -439,15 +481,11 @@ let NewExtensionsInitializer = class NewExtensionsInitializer {
|
|
|
439
481
|
async areExtensionsRunning(extensions) {
|
|
440
482
|
await this.extensionService.whenInstalledExtensionsRegistered();
|
|
441
483
|
const runningExtensions = this.extensionService.extensions;
|
|
442
|
-
return extensions.every(e => ( runningExtensions.some(r => areSameExtensions({
|
|
484
|
+
return extensions.every(e => ( runningExtensions.some(r => areSameExtensions({
|
|
485
|
+
id: r.identifier.value
|
|
486
|
+
}, e.identifier))));
|
|
443
487
|
}
|
|
444
488
|
};
|
|
445
|
-
NewExtensionsInitializer = ( __decorate([
|
|
446
|
-
( __param(1, IExtensionService)),
|
|
447
|
-
( __param(2, IExtensionStorageService)),
|
|
448
|
-
( __param(3, IExtensionGalleryService)),
|
|
449
|
-
( __param(4, IExtensionManagementService)),
|
|
450
|
-
( __param(5, IUserDataSyncLogService))
|
|
451
|
-
], NewExtensionsInitializer));
|
|
489
|
+
NewExtensionsInitializer = ( __decorate([( __param(1, IExtensionService)), ( __param(2, IExtensionStorageService)), ( __param(3, IExtensionGalleryService)), ( __param(4, IExtensionManagementService)), ( __param(5, IUserDataSyncLogService))], NewExtensionsInitializer));
|
|
452
490
|
|
|
453
491
|
export { UserDataSyncInitializer };
|
|
@@ -8,7 +8,12 @@ import { ITextModelService } from '@codingame/monaco-vscode-api/vscode/vs/editor
|
|
|
8
8
|
import { ITextResourcePropertiesService, ITextResourceConfigurationService } from '@codingame/monaco-vscode-api/vscode/vs/editor/common/services/textResourceConfiguration.service';
|
|
9
9
|
|
|
10
10
|
let UserDataSyncUtilService = class UserDataSyncUtilService {
|
|
11
|
-
constructor(
|
|
11
|
+
constructor(
|
|
12
|
+
keybindingsService,
|
|
13
|
+
textModelService,
|
|
14
|
+
textResourcePropertiesService,
|
|
15
|
+
textResourceConfigurationService
|
|
16
|
+
) {
|
|
12
17
|
this.keybindingsService = keybindingsService;
|
|
13
18
|
this.textModelService = textModelService;
|
|
14
19
|
this.textResourcePropertiesService = textResourcePropertiesService;
|
|
@@ -20,32 +25,32 @@ let UserDataSyncUtilService = class UserDataSyncUtilService {
|
|
|
20
25
|
async resolveUserBindings(userBindings) {
|
|
21
26
|
const keys = {};
|
|
22
27
|
for (const userbinding of userBindings) {
|
|
23
|
-
keys[userbinding] = ( this.keybindingsService.resolveUserBinding(userbinding).map(part => part.getUserSettingsLabel())).join(
|
|
28
|
+
keys[userbinding] = ( this.keybindingsService.resolveUserBinding(userbinding).map(part => part.getUserSettingsLabel())).join(" ");
|
|
24
29
|
}
|
|
25
30
|
return keys;
|
|
26
31
|
}
|
|
27
32
|
async resolveFormattingOptions(resource) {
|
|
28
33
|
try {
|
|
29
34
|
const modelReference = await this.textModelService.createModelReference(resource);
|
|
30
|
-
const {
|
|
35
|
+
const {
|
|
36
|
+
insertSpaces,
|
|
37
|
+
tabSize
|
|
38
|
+
} = modelReference.object.textEditorModel.getOptions();
|
|
31
39
|
const eol = modelReference.object.textEditorModel.getEOL();
|
|
32
40
|
modelReference.dispose();
|
|
33
|
-
return {
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
41
|
+
return {
|
|
42
|
+
eol,
|
|
43
|
+
insertSpaces,
|
|
44
|
+
tabSize
|
|
45
|
+
};
|
|
46
|
+
} catch (e) {}
|
|
37
47
|
return {
|
|
38
48
|
eol: this.textResourcePropertiesService.getEOL(resource),
|
|
39
|
-
insertSpaces: !!this.textResourceConfigurationService.getValue(resource,
|
|
40
|
-
tabSize: this.textResourceConfigurationService.getValue(resource,
|
|
49
|
+
insertSpaces: !!this.textResourceConfigurationService.getValue(resource, "editor.insertSpaces"),
|
|
50
|
+
tabSize: this.textResourceConfigurationService.getValue(resource, "editor.tabSize")
|
|
41
51
|
};
|
|
42
52
|
}
|
|
43
53
|
};
|
|
44
|
-
UserDataSyncUtilService = ( __decorate([
|
|
45
|
-
( __param(0, IKeybindingService)),
|
|
46
|
-
( __param(1, ITextModelService)),
|
|
47
|
-
( __param(2, ITextResourcePropertiesService)),
|
|
48
|
-
( __param(3, ITextResourceConfigurationService))
|
|
49
|
-
], UserDataSyncUtilService));
|
|
54
|
+
UserDataSyncUtilService = ( __decorate([( __param(0, IKeybindingService)), ( __param(1, ITextModelService)), ( __param(2, ITextResourcePropertiesService)), ( __param(3, ITextResourceConfigurationService))], UserDataSyncUtilService));
|
|
50
55
|
|
|
51
56
|
export { UserDataSyncUtilService };
|
|
@@ -1,69 +0,0 @@
|
|
|
1
|
-
/*---------------------------------------------------------------------------------------------
|
|
2
|
-
* Copyright (c) Microsoft Corporation. All rights reserved.
|
|
3
|
-
* Licensed under the MIT License. See License.txt in the project root for license information.
|
|
4
|
-
*--------------------------------------------------------------------------------------------*/
|
|
5
|
-
|
|
6
|
-
.monaco-custom-radio {
|
|
7
|
-
display: flex;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
.monaco-custom-radio > .monaco-button {
|
|
11
|
-
border-radius: 0;
|
|
12
|
-
font-size: 0.9em;
|
|
13
|
-
line-height: 1em;
|
|
14
|
-
padding-left: 0.5em;
|
|
15
|
-
padding-right: 0.5em;
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
.monaco-custom-radio > .monaco-button:first-child {
|
|
19
|
-
border-top-left-radius: 3px;
|
|
20
|
-
border-bottom-left-radius: 3px;
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
.monaco-custom-radio > .monaco-button:last-child {
|
|
24
|
-
border-top-right-radius: 3px;
|
|
25
|
-
border-bottom-right-radius: 3px;
|
|
26
|
-
}
|
|
27
|
-
|
|
28
|
-
.monaco-custom-radio > .monaco-button:not(.active):not(:last-child) {
|
|
29
|
-
border-right: none;
|
|
30
|
-
}
|
|
31
|
-
|
|
32
|
-
.monaco-custom-radio > .monaco-button.previous-active {
|
|
33
|
-
border-left: none;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
/* default color styles - based on CSS variables */
|
|
37
|
-
|
|
38
|
-
.monaco-custom-radio > .monaco-button {
|
|
39
|
-
color: var(--vscode-radio-inactiveForeground);
|
|
40
|
-
background-color: var(--vscode-radio-inactiveBackground);
|
|
41
|
-
border-color: var(--vscode-radio-inactiveBorder, transparent);
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
.monaco-custom-radio > .monaco-button.active:hover,
|
|
45
|
-
.monaco-custom-radio > .monaco-button.active {
|
|
46
|
-
color: var(--vscode-radio-activeForeground);
|
|
47
|
-
background-color: var(--vscode-radio-activeBackground);
|
|
48
|
-
border-color: var(--vscode-radio-activeBorder, transparent);
|
|
49
|
-
}
|
|
50
|
-
|
|
51
|
-
.hc-black .monaco-custom-radio > .monaco-button.active,
|
|
52
|
-
.hc-light .monaco-custom-radio > .monaco-button.active {
|
|
53
|
-
border-color: var(--vscode-radio-activeBorder, transparent);
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
.hc-black .monaco-custom-radio > .monaco-button:not(.active),
|
|
57
|
-
.hc-light .monaco-custom-radio > .monaco-button:not(.active) {
|
|
58
|
-
border-color: var(--vscode-radio-inactiveBorder, transparent);
|
|
59
|
-
}
|
|
60
|
-
|
|
61
|
-
.hc-black .monaco-custom-radio > .monaco-button:not(.active):hover,
|
|
62
|
-
.hc-light .monaco-custom-radio > .monaco-button:not(.active):hover {
|
|
63
|
-
outline: 1px dashed var(--vscode-toolbar-hoverOutline);
|
|
64
|
-
outline-offset: -1px
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
.monaco-custom-radio > .monaco-button:hover:not(.active) {
|
|
68
|
-
background-color: var(--vscode-radio-inactiveHoverBackground);
|
|
69
|
-
}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { Widget } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/widget";
|
|
2
|
-
import { ThemeIcon } from "@codingame/monaco-vscode-api/vscode/vs/base/common/themables";
|
|
3
|
-
import { IHoverDelegate } from "@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegate";
|
|
4
|
-
export interface IRadioStyles {
|
|
5
|
-
readonly activeForeground?: string;
|
|
6
|
-
readonly activeBackground?: string;
|
|
7
|
-
readonly activeBorder?: string;
|
|
8
|
-
readonly inactiveForeground?: string;
|
|
9
|
-
readonly inactiveBackground?: string;
|
|
10
|
-
readonly inactiveHoverBackground?: string;
|
|
11
|
-
readonly inactiveBorder?: string;
|
|
12
|
-
}
|
|
13
|
-
export interface IRadioOptionItem {
|
|
14
|
-
readonly text: string;
|
|
15
|
-
readonly tooltip?: string;
|
|
16
|
-
readonly isActive?: boolean;
|
|
17
|
-
readonly disabled?: boolean;
|
|
18
|
-
}
|
|
19
|
-
export interface IRadioOptions {
|
|
20
|
-
readonly items: ReadonlyArray<IRadioOptionItem>;
|
|
21
|
-
readonly activeIcon?: ThemeIcon;
|
|
22
|
-
readonly hoverDelegate?: IHoverDelegate;
|
|
23
|
-
}
|
|
24
|
-
export declare class Radio extends Widget {
|
|
25
|
-
private readonly _onDidSelect;
|
|
26
|
-
readonly onDidSelect: import("@codingame/monaco-vscode-api/vscode/vs/base/common/event").Event<number>;
|
|
27
|
-
readonly domNode: HTMLElement;
|
|
28
|
-
private readonly hoverDelegate;
|
|
29
|
-
private items;
|
|
30
|
-
private activeItem;
|
|
31
|
-
private readonly buttons;
|
|
32
|
-
constructor(opts: IRadioOptions);
|
|
33
|
-
setItems(items: ReadonlyArray<IRadioOptionItem>): void;
|
|
34
|
-
setActiveItem(index: number): void;
|
|
35
|
-
setEnabled(enabled: boolean): void;
|
|
36
|
-
private updateButtons;
|
|
37
|
-
}
|
|
@@ -1,72 +0,0 @@
|
|
|
1
|
-
|
|
2
|
-
import { registerCss } from '@codingame/monaco-vscode-api/css';
|
|
3
|
-
import { Widget } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/widget';
|
|
4
|
-
import { Emitter } from '@codingame/monaco-vscode-api/vscode/vs/base/common/event';
|
|
5
|
-
import * as radio from './radio.css';
|
|
6
|
-
import { $ } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/dom';
|
|
7
|
-
import { Button } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/button/button';
|
|
8
|
-
import { DisposableMap, DisposableStore } from '@codingame/monaco-vscode-api/vscode/vs/base/common/lifecycle';
|
|
9
|
-
import { createInstantHoverDelegate } from '@codingame/monaco-vscode-api/vscode/vs/base/browser/ui/hover/hoverDelegateFactory';
|
|
10
|
-
|
|
11
|
-
registerCss(radio);
|
|
12
|
-
class Radio extends Widget {
|
|
13
|
-
constructor(opts) {
|
|
14
|
-
super();
|
|
15
|
-
this._onDidSelect = this._register(( new Emitter()));
|
|
16
|
-
this.onDidSelect = this._onDidSelect.event;
|
|
17
|
-
this.items = [];
|
|
18
|
-
this.buttons = this._register(( new DisposableMap()));
|
|
19
|
-
this.hoverDelegate = opts.hoverDelegate ?? this._register(createInstantHoverDelegate());
|
|
20
|
-
this.domNode = $('.monaco-custom-radio');
|
|
21
|
-
this.domNode.setAttribute('role', 'radio');
|
|
22
|
-
this.setItems(opts.items);
|
|
23
|
-
}
|
|
24
|
-
setItems(items) {
|
|
25
|
-
this.buttons.clearAndDisposeAll();
|
|
26
|
-
this.items = items;
|
|
27
|
-
this.activeItem = this.items.find(item => item.isActive) ?? this.items[0];
|
|
28
|
-
for (let index = 0; index < this.items.length; index++) {
|
|
29
|
-
const item = this.items[index];
|
|
30
|
-
const disposables = ( new DisposableStore());
|
|
31
|
-
const button = disposables.add(( new Button(this.domNode, {
|
|
32
|
-
hoverDelegate: this.hoverDelegate,
|
|
33
|
-
title: item.tooltip,
|
|
34
|
-
supportIcons: true,
|
|
35
|
-
})));
|
|
36
|
-
button.enabled = !item.disabled;
|
|
37
|
-
disposables.add(button.onDidClick(() => {
|
|
38
|
-
if (this.activeItem !== item) {
|
|
39
|
-
this.activeItem = item;
|
|
40
|
-
this.updateButtons();
|
|
41
|
-
this._onDidSelect.fire(index);
|
|
42
|
-
}
|
|
43
|
-
}));
|
|
44
|
-
this.buttons.set(button, { item, dispose: () => disposables.dispose() });
|
|
45
|
-
}
|
|
46
|
-
this.updateButtons();
|
|
47
|
-
}
|
|
48
|
-
setActiveItem(index) {
|
|
49
|
-
if (index < 0 || index >= this.items.length) {
|
|
50
|
-
throw ( new Error('Invalid Index'));
|
|
51
|
-
}
|
|
52
|
-
this.activeItem = this.items[index];
|
|
53
|
-
this.updateButtons();
|
|
54
|
-
}
|
|
55
|
-
setEnabled(enabled) {
|
|
56
|
-
for (const [button] of this.buttons) {
|
|
57
|
-
button.enabled = enabled;
|
|
58
|
-
}
|
|
59
|
-
}
|
|
60
|
-
updateButtons() {
|
|
61
|
-
let isActive = false;
|
|
62
|
-
for (const [button, { item }] of this.buttons) {
|
|
63
|
-
const isPreviousActive = isActive;
|
|
64
|
-
isActive = item === this.activeItem;
|
|
65
|
-
button.element.classList.toggle('active', isActive);
|
|
66
|
-
button.element.classList.toggle('previous-active', isPreviousActive);
|
|
67
|
-
button.label = item.text;
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
export { Radio };
|