@@ -225,7 +225,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
225
225
}
226
226
const disposables = new DisposableStore ( ) ;
227
227
try {
228
- const userDataProfilesExportState = disposables . add ( this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile , false ) ) ;
228
+ const userDataProfilesExportState = disposables . add ( this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile ) ) ;
229
229
const barrier = new Barrier ( ) ;
230
230
const exportAction = new BarrierAction ( barrier , new Action ( 'export' , localize ( 'export' , "Export" ) , undefined , true , async ( ) => {
231
231
exportAction . enabled = false ;
@@ -247,7 +247,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
247
247
}
248
248
249
249
async createFromCurrentProfile ( name : string ) : Promise < void > {
250
- const userDataProfilesExportState = this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile , false ) ;
250
+ const userDataProfilesExportState = this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile ) ;
251
251
try {
252
252
const profileTemplate = await userDataProfilesExportState . getProfileTemplate ( name , undefined ) ;
253
253
await this . doImportProfile ( profileTemplate ) ;
@@ -257,15 +257,24 @@ export class UserDataProfileImportExportService extends Disposable implements IU
257
257
}
258
258
259
259
async createTroubleshootProfile ( ) : Promise < void > {
260
- const userDataProfilesExportState = this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile , true ) ;
260
+ const userDataProfilesExportState = this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile ) ;
261
261
try {
262
262
const profileTemplate = await userDataProfilesExportState . getProfileTemplate ( localize ( 'troubleshoot issue' , "Troubleshoot Issue" ) , undefined ) ;
263
263
await this . progressService . withProgress ( {
264
264
location : ProgressLocation . Notification ,
265
265
delay : 1000 ,
266
266
sticky : true ,
267
- } , progress =>
268
- this . importAndSwitchWithProgress ( profileTemplate , true , true , true , message => progress . report ( { message : localize ( 'troubleshoot profile progress' , "Setting up Troubleshoot Profile: {0}" , message ) } ) ) ) ;
267
+ } , async progress => {
268
+ const reportProgress = ( message : string ) => progress . report ( { message : localize ( 'troubleshoot profile progress' , "Setting up Troubleshoot Profile: {0}" , message ) } ) ;
269
+ const profile = await this . importWithProgress ( profileTemplate , true , false , reportProgress ) ;
270
+ if ( profile ) {
271
+ reportProgress ( localize ( 'progress extensions' , "Applying Extensions..." ) ) ;
272
+ await this . instantiationService . createInstance ( ExtensionsResource ) . copy ( this . userDataProfileService . currentProfile , profile , true ) ;
273
+
274
+ reportProgress ( localize ( 'switching profile' , "Switching Profile..." ) ) ;
275
+ await this . userDataProfileManagementService . switchProfile ( profile ) ;
276
+ }
277
+ } ) ;
269
278
} finally {
270
279
userDataProfilesExportState . dispose ( ) ;
271
280
}
@@ -357,7 +366,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
357
366
const userDataProfileImportState = disposables . add ( this . instantiationService . createInstance ( UserDataProfileImportState , profileTemplate ) ) ;
358
367
profileTemplate = await userDataProfileImportState . getProfileTemplateToImport ( ) ;
359
368
360
- const importedProfile = await this . importAndSwitch ( profileTemplate , true , false , false , localize ( 'preview profile' , "Preview Profile" ) ) ;
369
+ const importedProfile = await this . importAndSwitch ( profileTemplate , true , false , localize ( 'preview profile' , "Preview Profile" ) ) ;
361
370
362
371
if ( ! importedProfile ) {
363
372
return ;
@@ -400,15 +409,15 @@ export class UserDataProfileImportExportService extends Disposable implements IU
400
409
view . setMessage ( undefined ) ;
401
410
const profileTemplate = await userDataProfileImportState . getProfileTemplateToImport ( ) ;
402
411
if ( profileTemplate . extensions ) {
403
- await that . instantiationService . createInstance ( ExtensionsResource , false ) . apply ( profileTemplate . extensions , importedProfile ) ;
412
+ await that . instantiationService . createInstance ( ExtensionsResource ) . apply ( profileTemplate . extensions , importedProfile ) ;
404
413
}
405
414
} ) ;
406
415
}
407
416
} ) ) ;
408
417
disposables . add ( Event . debounce ( this . extensionManagementService . onDidInstallExtensions , ( ) => undefined , 100 ) ( async ( ) => {
409
418
const profileTemplate = await userDataProfileImportState . getProfileTemplateToImport ( ) ;
410
419
if ( profileTemplate . extensions ) {
411
- const profileExtensions = await that . instantiationService . createInstance ( ExtensionsResource , false ) . getProfileExtensions ( profileTemplate . extensions ! ) ;
420
+ const profileExtensions = await that . instantiationService . createInstance ( ExtensionsResource ) . getProfileExtensions ( profileTemplate . extensions ! ) ;
412
421
const installed = await this . extensionManagementService . getInstalled ( ExtensionType . User ) ;
413
422
if ( profileExtensions . every ( e => installed . some ( i => areSameExtensions ( e . identifier , i . identifier ) ) ) ) {
414
423
disposable . dispose ( ) ;
@@ -447,7 +456,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
447
456
const importProfileFn = async ( ) => {
448
457
importAction . enabled = false ;
449
458
const profileTemplate = await userDataProfileImportState . getProfileTemplateToImport ( ) ;
450
- const importedProfile = await this . importAndSwitch ( profileTemplate , false , true , false , title ) ;
459
+ const importedProfile = await this . importAndSwitch ( profileTemplate , false , true , title ) ;
451
460
if ( ! importedProfile ) {
452
461
return ;
453
462
}
@@ -463,17 +472,29 @@ export class UserDataProfileImportExportService extends Disposable implements IU
463
472
return importAction ;
464
473
}
465
474
466
- private async importAndSwitch ( profileTemplate : IUserDataProfileTemplate , temporaryProfile : boolean , extensions : boolean , extensionsDisabled : boolean , title : string ) : Promise < IUserDataProfile | undefined > {
475
+ private async importAndSwitch ( profileTemplate : IUserDataProfileTemplate , temporaryProfile : boolean , extensions : boolean , title : string ) : Promise < IUserDataProfile | undefined > {
467
476
return this . progressService . withProgress ( {
468
477
location : ProgressLocation . Window ,
469
478
command : showWindowLogActionId ,
470
479
} , async ( progress ) => {
471
480
progress . report ( { message : localize ( 'Importing profile' , "{0} ({1})..." , title , profileTemplate . name ) } ) ;
472
- return this . importAndSwitchWithProgress ( profileTemplate , temporaryProfile , extensions , extensionsDisabled , message => progress . report ( { message : `${ title } (${ profileTemplate . name } ): ${ message } ` } ) ) ;
481
+ return this . importAndSwitchWithProgress ( profileTemplate , temporaryProfile , extensions , message => progress . report ( { message : `${ title } (${ profileTemplate . name } ): ${ message } ` } ) ) ;
473
482
} ) ;
474
483
}
475
484
476
- private async importAndSwitchWithProgress ( profileTemplate : IUserDataProfileTemplate , temporaryProfile : boolean , extensions : boolean , extensionsDisabled : boolean , progress : ( message : string ) => void ) : Promise < IUserDataProfile | undefined > {
485
+ private async importAndSwitchWithProgress ( profileTemplate : IUserDataProfileTemplate , temporaryProfile : boolean , extensions : boolean , progress : ( message : string ) => void ) : Promise < IUserDataProfile | undefined > {
486
+ const profile = await this . importWithProgress ( profileTemplate , temporaryProfile , extensions , progress ) ;
487
+
488
+ if ( ! profile ) {
489
+ return ;
490
+ }
491
+
492
+ progress ( localize ( 'switching profile' , "Switching Profile..." ) ) ;
493
+ await this . userDataProfileManagementService . switchProfile ( profile ) ;
494
+ return profile ;
495
+ }
496
+
497
+ private async importWithProgress ( profileTemplate : IUserDataProfileTemplate , temporaryProfile : boolean , extensions : boolean , progress : ( message : string ) => void ) : Promise < IUserDataProfile | undefined > {
477
498
const profile = await this . getProfileToImport ( profileTemplate , temporaryProfile ) ;
478
499
if ( ! profile ) {
479
500
return undefined ;
@@ -484,7 +505,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
484
505
await this . instantiationService . createInstance ( SettingsResource ) . apply ( profileTemplate . settings , profile ) ;
485
506
}
486
507
if ( profileTemplate . keybindings ) {
487
- progress ( localize ( 'progress keybindings' , "{0}ying Keyboard Shortcuts..." ) ) ;
508
+ progress ( localize ( 'progress keybindings' , "Applying Keyboard Shortcuts..." ) ) ;
488
509
await this . instantiationService . createInstance ( KeybindingsResource ) . apply ( profileTemplate . keybindings , profile ) ;
489
510
}
490
511
if ( profileTemplate . tasks ) {
@@ -501,11 +522,9 @@ export class UserDataProfileImportExportService extends Disposable implements IU
501
522
}
502
523
if ( profileTemplate . extensions && extensions ) {
503
524
progress ( localize ( 'progress extensions' , "Applying Extensions..." ) ) ;
504
- await this . instantiationService . createInstance ( ExtensionsResource , extensionsDisabled ) . apply ( profileTemplate . extensions , profile ) ;
525
+ await this . instantiationService . createInstance ( ExtensionsResource ) . apply ( profileTemplate . extensions , profile ) ;
505
526
}
506
527
507
- progress ( localize ( 'switching profile' , " Applying..." ) ) ;
508
- await this . userDataProfileManagementService . switchProfile ( profile ) ;
509
528
return profile ;
510
529
}
511
530
@@ -685,7 +704,7 @@ export class UserDataProfileImportExportService extends Disposable implements IU
685
704
await this . instantiationService . createInstance ( GlobalStateResource ) . apply ( profile . globalState , this . userDataProfileService . currentProfile ) ;
686
705
}
687
706
if ( profile . extensions ) {
688
- await this . instantiationService . createInstance ( ExtensionsResource , false ) . apply ( profile . extensions , this . userDataProfileService . currentProfile ) ;
707
+ await this . instantiationService . createInstance ( ExtensionsResource ) . apply ( profile . extensions , this . userDataProfileService . currentProfile ) ;
689
708
}
690
709
} ) ;
691
710
this . notificationService . info ( localize ( 'applied profile' , "{0}: Applied successfully." , PROFILES_CATEGORY . value ) ) ;
@@ -979,7 +998,6 @@ class UserDataProfileExportState extends UserDataProfileImportExportState {
979
998
980
999
constructor (
981
1000
readonly profile : IUserDataProfile ,
982
- private readonly disableExtensions : boolean ,
983
1001
@IQuickInputService quickInputService : IQuickInputService ,
984
1002
@IFileService private readonly fileService : IFileService ,
985
1003
@IInstantiationService private readonly instantiationService : IInstantiationService
@@ -1035,7 +1053,7 @@ class UserDataProfileExportState extends UserDataProfileImportExportState {
1035
1053
roots . push ( globalStateResourceTreeItem ) ;
1036
1054
}
1037
1055
1038
- const extensionsResourceTreeItem = this . instantiationService . createInstance ( ExtensionsResourceExportTreeItem , exportPreviewProfle , this . disableExtensions ) ;
1056
+ const extensionsResourceTreeItem = this . instantiationService . createInstance ( ExtensionsResourceExportTreeItem , exportPreviewProfle ) ;
1039
1057
if ( await extensionsResourceTreeItem . hasContent ( ) ) {
1040
1058
roots . push ( extensionsResourceTreeItem ) ;
1041
1059
}
0 commit comments