@@ -428,11 +428,11 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
428428 const disposables = new DisposableStore ( ) ;
429429 const title = profile ? localize ( 'save profile' , "Edit Profile..." ) : localize ( 'create new profle' , "Create New Profile..." ) ;
430430
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 } ;
436436 const resources = [ settings , keybindings , snippets , tasks , extensions ] ;
437437
438438 const quickPick = this . quickInputService . createQuickPick ( ) ;
@@ -450,22 +450,23 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
450450 quickPick . hideCheckAll = true ;
451451 quickPick . ignoreFocusOut = true ;
452452 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 :" ) ;
454454 quickPick . items = [ ...resources ] ;
455455
456- const updateSelection = ( ) => {
456+ const update = ( ) => {
457+ quickPick . items = resources ;
457458 quickPick . selectedItems = resources . filter ( item => item . picked ) ;
458459 } ;
459- updateSelection ( ) ;
460+ update ( ) ;
460461
461462 const validate = ( ) => {
462463 if ( ! profile && this . userDataProfilesService . profiles . some ( p => p . name === quickPick . value ) ) {
463464 quickPick . validationMessage = localize ( 'profileExists' , "Profile with name {0} already exists." , quickPick . value ) ;
464465 quickPick . severity = Severity . Error ;
465466 return ;
466467 }
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 ." ) ;
469470 quickPick . severity = Severity . Error ;
470471 return ;
471472 }
@@ -474,8 +475,17 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
474475 } ;
475476
476477 disposables . add ( quickPick . onDidChangeSelection ( items => {
478+ let needUpdate = false ;
477479 for ( const resource of resources ) {
478480 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 ( ) ;
479489 }
480490 validate ( ) ;
481491 } ) ) ;
@@ -541,7 +551,7 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
541551 for ( const resource of resources ) {
542552 resource . picked = option . source ?. useDefaultFlags ?. [ resource . id ] ;
543553 }
544- updateSelection ( ) ;
554+ update ( ) ;
545555 }
546556 } ;
547557
@@ -569,13 +579,15 @@ export class UserDataProfilesWorkbenchContribution extends Disposable implements
569579 this . telemetryService . publicLog2 < { } , CreateProfileInfoClassification > ( 'userDataProfile.successCreate' ) ;
570580
571581 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+ } ;
579591 if ( profile ) {
580592 await this . userDataProfileManagementService . updateProfile ( profile , { name : result . name , useDefaultFlags : profile . useDefaultFlags && ! useDefaultFlags ? { } : useDefaultFlags } ) ;
581593 } else {
0 commit comments