@@ -428,11 +428,11 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
428
428
const disposables = new DisposableStore ( ) ;
429
429
const title = profile ? localize ( 'save profile' , "Edit Profile..." ) : localize ( 'create new profle' , "Create New Profile..." ) ;
430
430
431
- const settings : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Settings , label : localize ( 'settings' , "Settings" ) , picked : profile ?. useDefaultFlags ?. settings } ;
432
- const keybindings : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Keybindings , label : localize ( 'keybindings' , "Keyboard Shortcuts" ) , picked : profile ?. useDefaultFlags ?. keybindings } ;
433
- const snippets : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Snippets , label : localize ( 'snippets' , "User Snippets" ) , picked : profile ?. useDefaultFlags ?. snippets } ;
434
- const tasks : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Tasks , label : localize ( 'tasks' , "User Tasks" ) , picked : profile ?. useDefaultFlags ?. tasks } ;
435
- const extensions : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Extensions , label : localize ( 'extensions' , "Extensions" ) , picked : profile ?. useDefaultFlags ?. extensions } ;
431
+ const settings : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Settings , label : localize ( 'settings' , "Settings" ) , picked : ! profile ?. useDefaultFlags ?. settings } ;
432
+ const keybindings : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Keybindings , label : localize ( 'keybindings' , "Keyboard Shortcuts" ) , picked : ! profile ?. useDefaultFlags ?. keybindings } ;
433
+ const snippets : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Snippets , label : localize ( 'snippets' , "User Snippets" ) , picked : ! profile ?. useDefaultFlags ?. snippets } ;
434
+ const tasks : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Tasks , label : localize ( 'tasks' , "User Tasks" ) , picked : ! profile ?. useDefaultFlags ?. tasks } ;
435
+ const extensions : IQuickPickItem & { id : ProfileResourceType } = { id : ProfileResourceType . Extensions , label : localize ( 'extensions' , "Extensions" ) , picked : ! profile ?. useDefaultFlags ?. extensions } ;
436
436
const resources = [ settings , keybindings , snippets , tasks , extensions ] ;
437
437
438
438
const quickPick = this . quickInputService . createQuickPick ( ) ;
@@ -450,22 +450,23 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
450
450
quickPick . hideCheckAll = true ;
451
451
quickPick . ignoreFocusOut = true ;
452
452
quickPick . customLabel = profile ? localize ( 'save' , "Save" ) : localize ( 'create' , "Create" ) ;
453
- quickPick . description = localize ( 'customise the profile' , "Select configurations to share from the Default profile :" ) ;
453
+ quickPick . description = localize ( 'customise the profile' , "Choose what to configure in your Profile :" ) ;
454
454
quickPick . items = [ ...resources ] ;
455
455
456
- const updateSelection = ( ) => {
456
+ const update = ( ) => {
457
+ quickPick . items = resources ;
457
458
quickPick . selectedItems = resources . filter ( item => item . picked ) ;
458
459
} ;
459
- updateSelection ( ) ;
460
+ update ( ) ;
460
461
461
462
const validate = ( ) => {
462
463
if ( ! profile && this . userDataProfilesService . profiles . some ( p => p . name === quickPick . value ) ) {
463
464
quickPick . validationMessage = localize ( 'profileExists' , "Profile with name {0} already exists." , quickPick . value ) ;
464
465
quickPick . severity = Severity . Error ;
465
466
return ;
466
467
}
467
- if ( resources . every ( resource => resource . picked ) ) {
468
- quickPick . validationMessage = localize ( 'cannot share all ' , "Cannot share all configurations from the Default Profile ." ) ;
468
+ if ( resources . every ( resource => ! resource . picked ) ) {
469
+ quickPick . validationMessage = localize ( 'invalid configurations ' , "The profile should contain at least one configuration ." ) ;
469
470
quickPick . severity = Severity . Error ;
470
471
return ;
471
472
}
@@ -474,8 +475,17 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
474
475
} ;
475
476
476
477
disposables . add ( quickPick . onDidChangeSelection ( items => {
478
+ let needUpdate = false ;
477
479
for ( const resource of resources ) {
478
480
resource . picked = items . includes ( resource ) ;
481
+ const description = resource . picked ? undefined : localize ( 'use default profile' , "Use Default Profile" ) ;
482
+ if ( resource . description !== description ) {
483
+ resource . description = description ;
484
+ needUpdate = true ;
485
+ }
486
+ }
487
+ if ( needUpdate ) {
488
+ update ( ) ;
479
489
}
480
490
validate ( ) ;
481
491
} ) ) ;
@@ -541,7 +551,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
541
551
for ( const resource of resources ) {
542
552
resource . picked = option . source ?. useDefaultFlags ?. [ resource . id ] ;
543
553
}
544
- updateSelection ( ) ;
554
+ update ( ) ;
545
555
}
546
556
} ;
547
557
@@ -569,13 +579,15 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
569
579
this . telemetryService . publicLog2 < { } , CreateProfileInfoClassification > ( 'userDataProfile.successCreate' ) ;
570
580
571
581
try {
572
- const useDefaultFlags : UseDefaultProfileFlags | undefined = result . items . length ? {
573
- settings : result . items . includes ( settings ) ,
574
- keybindings : result . items . includes ( keybindings ) ,
575
- snippets : result . items . includes ( snippets ) ,
576
- tasks : result . items . includes ( tasks ) ,
577
- extensions : result . items . includes ( extensions )
578
- } : undefined ;
582
+ const useDefaultFlags : UseDefaultProfileFlags | undefined = result . items . length === resources . length
583
+ ? undefined
584
+ : {
585
+ settings : ! result . items . includes ( settings ) ,
586
+ keybindings : ! result . items . includes ( keybindings ) ,
587
+ snippets : ! result . items . includes ( snippets ) ,
588
+ tasks : ! result . items . includes ( tasks ) ,
589
+ extensions : ! result . items . includes ( extensions )
590
+ } ;
579
591
if ( profile ) {
580
592
await this . userDataProfileManagementService . updateProfile ( profile , { name : result . name , useDefaultFlags : profile . useDefaultFlags && ! useDefaultFlags ? { } : useDefaultFlags } ) ;
581
593
} else {
0 commit comments