@@ -256,11 +256,16 @@ export class UserDataProfileImportExportService extends Disposable implements IU
256
256
}
257
257
}
258
258
259
- async createTemporaryProfile ( profile : IUserDataProfile , name : string , extensionsDisabled : boolean ) : Promise < void > {
260
- const userDataProfilesExportState = this . instantiationService . createInstance ( UserDataProfileExportState , profile , extensionsDisabled ) ;
259
+ async createTroubleshootProfile ( ) : Promise < void > {
260
+ const userDataProfilesExportState = this . instantiationService . createInstance ( UserDataProfileExportState , this . userDataProfileService . currentProfile , true ) ;
261
261
try {
262
- const profileTemplate = await userDataProfilesExportState . getProfileTemplate ( name , undefined ) ;
263
- await this . importAndSwitch ( profileTemplate , true , true , extensionsDisabled , localize ( 'import' , "Create Profile" ) ) ;
262
+ const profileTemplate = await userDataProfilesExportState . getProfileTemplate ( localize ( 'troubleshoot issue' , "Troubleshoot Issue" ) , undefined ) ;
263
+ await this . progressService . withProgress ( {
264
+ location : ProgressLocation . Notification ,
265
+ delay : 1000 ,
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 ) } ) ) ) ;
264
269
} finally {
265
270
userDataProfilesExportState . dispose ( ) ;
266
271
}
@@ -464,40 +469,44 @@ export class UserDataProfileImportExportService extends Disposable implements IU
464
469
command : showWindowLogActionId ,
465
470
} , async ( progress ) => {
466
471
progress . report ( { message : localize ( 'Importing profile' , "{0} ({1})..." , title , profileTemplate . name ) } ) ;
467
- const profile = await this . getProfileToImport ( profileTemplate , temporaryProfile ) ;
468
- if ( ! profile ) {
469
- return undefined ;
470
- }
472
+ return this . importAndSwitchWithProgress ( profileTemplate , temporaryProfile , extensions , extensionsDisabled , message => progress . report ( { message : `${ title } (${ profileTemplate . name } ): ${ message } ` } ) ) ;
473
+ } ) ;
474
+ }
471
475
472
- if ( profileTemplate . settings ) {
473
- progress . report ( { message : localize ( 'progress settings' , "{0} ({1}): Applying Settings..." , title , profileTemplate . name ) } ) ;
474
- await this . instantiationService . createInstance ( SettingsResource ) . apply ( profileTemplate . settings , profile ) ;
475
- }
476
- if ( profileTemplate . keybindings ) {
477
- progress . report ( { message : localize ( 'progress keybindings' , "{0} ({1}): Applying Keyboard Shortcuts..." , title , profileTemplate . name ) } ) ;
478
- await this . instantiationService . createInstance ( KeybindingsResource ) . apply ( profileTemplate . keybindings , profile ) ;
479
- }
480
- if ( profileTemplate . tasks ) {
481
- progress . report ( { message : localize ( 'progress tasks' , "{0} ({1}): Applying Tasks..." , title , profileTemplate . name ) } ) ;
482
- await this . instantiationService . createInstance ( TasksResource ) . apply ( profileTemplate . tasks , profile ) ;
483
- }
484
- if ( profileTemplate . snippets ) {
485
- progress . report ( { message : localize ( 'progress snippets' , "{0} ({1}): Applying Snippets..." , title , profileTemplate . name ) } ) ;
486
- await this . instantiationService . createInstance ( SnippetsResource ) . apply ( profileTemplate . snippets , profile ) ;
487
- }
488
- if ( profileTemplate . globalState ) {
489
- progress . report ( { message : localize ( 'progress global state' , "{0} ({1}): Applying State..." , title , profileTemplate . name ) } ) ;
490
- await this . instantiationService . createInstance ( GlobalStateResource ) . apply ( profileTemplate . globalState , profile ) ;
491
- }
492
- if ( profileTemplate . extensions && extensions ) {
493
- progress . report ( { message : localize ( 'progress extensions' , "{0} ({1}): Applying Extensions..." , title , profileTemplate . name ) } ) ;
494
- await this . instantiationService . createInstance ( ExtensionsResource , extensionsDisabled ) . apply ( profileTemplate . extensions , profile ) ;
495
- }
476
+ private async importAndSwitchWithProgress ( profileTemplate : IUserDataProfileTemplate , temporaryProfile : boolean , extensions : boolean , extensionsDisabled : boolean , progress : ( message : string ) => void ) : Promise < IUserDataProfile | undefined > {
477
+ const profile = await this . getProfileToImport ( profileTemplate , temporaryProfile ) ;
478
+ if ( ! profile ) {
479
+ return undefined ;
480
+ }
496
481
497
- progress . report ( { message : localize ( 'switching profile' , "{0} ({1}): Applying..." , title , profileTemplate . name ) } ) ;
498
- await this . userDataProfileManagementService . switchProfile ( profile ) ;
499
- return profile ;
500
- } ) ;
482
+ if ( profileTemplate . settings ) {
483
+ progress ( localize ( 'progress settings' , "Applying Settings..." ) ) ;
484
+ await this . instantiationService . createInstance ( SettingsResource ) . apply ( profileTemplate . settings , profile ) ;
485
+ }
486
+ if ( profileTemplate . keybindings ) {
487
+ progress ( localize ( 'progress keybindings' , "{0}ying Keyboard Shortcuts..." ) ) ;
488
+ await this . instantiationService . createInstance ( KeybindingsResource ) . apply ( profileTemplate . keybindings , profile ) ;
489
+ }
490
+ if ( profileTemplate . tasks ) {
491
+ progress ( localize ( 'progress tasks' , "Applying Tasks..." ) ) ;
492
+ await this . instantiationService . createInstance ( TasksResource ) . apply ( profileTemplate . tasks , profile ) ;
493
+ }
494
+ if ( profileTemplate . snippets ) {
495
+ progress ( localize ( 'progress snippets' , "Applying Snippets..." ) ) ;
496
+ await this . instantiationService . createInstance ( SnippetsResource ) . apply ( profileTemplate . snippets , profile ) ;
497
+ }
498
+ if ( profileTemplate . globalState ) {
499
+ progress ( localize ( 'progress global state' , "Applying State..." ) ) ;
500
+ await this . instantiationService . createInstance ( GlobalStateResource ) . apply ( profileTemplate . globalState , profile ) ;
501
+ }
502
+ if ( profileTemplate . extensions && extensions ) {
503
+ progress ( localize ( 'progress extensions' , "Applying Extensions..." ) ) ;
504
+ await this . instantiationService . createInstance ( ExtensionsResource , extensionsDisabled ) . apply ( profileTemplate . extensions , profile ) ;
505
+ }
506
+
507
+ progress ( localize ( 'switching profile' , " Applying..." ) ) ;
508
+ await this . userDataProfileManagementService . switchProfile ( profile ) ;
509
+ return profile ;
501
510
}
502
511
503
512
private async resolveProfileContent ( resource : URI ) : Promise < string | null > {
0 commit comments