@@ -187,37 +187,46 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
187187 }
188188
189189 private registerSettingsActions ( ) {
190- this . _register ( registerAction2 ( class extends Action2 {
191- constructor ( ) {
192- super ( {
193- id : SETTINGS_COMMAND_OPEN_SETTINGS ,
194- title : {
195- value : nls . localize ( 'settings' , "Settings" ) ,
196- mnemonicTitle : nls . localize ( { key : 'miOpenSettings' , comment : [ '&& denotes a mnemonic' ] } , "&&Settings" ) ,
197- original : 'Settings'
198- } ,
199- keybinding : {
200- weight : KeybindingWeight . WorkbenchContrib ,
201- when : null ,
202- primary : KeyMod . CtrlCmd | KeyCode . Comma ,
203- } ,
204- menu : [ {
205- id : MenuId . GlobalActivity ,
206- group : '2_configuration' ,
207- order : 1
208- } , {
209- id : MenuId . MenubarPreferencesMenu ,
210- group : '2_configuration' ,
211- order : 1
212- } ] ,
213- } ) ;
214- }
215- run ( accessor : ServicesAccessor , args : string | IOpenSettingsActionOptions ) {
216- // args takes a string for backcompat
217- const opts = typeof args === 'string' ? { query : args } : sanitizeOpenSettingsArgs ( args ) ;
218- return accessor . get ( IPreferencesService ) . openSettings ( opts ) ;
219- }
220- } ) ) ;
190+ const registerOpenSettingsActionDisposables = this . _register ( new DisposableStore ( ) ) ;
191+ const registerOpenSettingsAction = ( ) => {
192+ registerOpenSettingsActionDisposables . clear ( ) ;
193+ const getTitle = ( title : string ) => ! this . userDataProfileService . currentProfile . isDefault && this . userDataProfileService . currentProfile . useDefaultFlags ?. settings
194+ ? `${ title } (${ nls . localize ( 'default profile' , "Default Profile" ) } )`
195+ : title ;
196+ registerOpenSettingsActionDisposables . add ( registerAction2 ( class extends Action2 {
197+ constructor ( ) {
198+ super ( {
199+ id : SETTINGS_COMMAND_OPEN_SETTINGS ,
200+ title : {
201+ value : getTitle ( nls . localize ( 'settings' , "Settings" ) ) ,
202+ mnemonicTitle : getTitle ( nls . localize ( { key : 'miOpenSettings' , comment : [ '&& denotes a mnemonic' ] } , "&&Settings" ) ) ,
203+ original : 'Settings'
204+ } ,
205+ keybinding : {
206+ weight : KeybindingWeight . WorkbenchContrib ,
207+ when : null ,
208+ primary : KeyMod . CtrlCmd | KeyCode . Comma ,
209+ } ,
210+ menu : [ {
211+ id : MenuId . GlobalActivity ,
212+ group : '2_configuration' ,
213+ order : 1
214+ } , {
215+ id : MenuId . MenubarPreferencesMenu ,
216+ group : '2_configuration' ,
217+ order : 1
218+ } ] ,
219+ } ) ;
220+ }
221+ run ( accessor : ServicesAccessor , args : string | IOpenSettingsActionOptions ) {
222+ // args takes a string for backcompat
223+ const opts = typeof args === 'string' ? { query : args } : sanitizeOpenSettingsArgs ( args ) ;
224+ return accessor . get ( IPreferencesService ) . openSettings ( opts ) ;
225+ }
226+ } ) ) ;
227+ } ;
228+ registerOpenSettingsAction ( ) ;
229+ this . _register ( this . userDataProfileService . onDidChangeCurrentProfile ( ( ) => registerOpenSettingsAction ( ) ) ) ;
221230 registerAction2 ( class extends Action2 {
222231 constructor ( ) {
223232 super ( {
@@ -296,13 +305,13 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
296305 }
297306 } ) ;
298307
299- const registerOpenUserSettingsEditorFromJsonActionDisposables = this . _register ( new MutableDisposable ( ) ) ;
308+ const registerOpenUserSettingsEditorFromJsonActionDisposable = this . _register ( new MutableDisposable ( ) ) ;
300309 const openUserSettingsEditorWhen = ContextKeyExpr . and (
301310 ContextKeyExpr . or ( ResourceContextKey . Resource . isEqualTo ( this . userDataProfileService . currentProfile . settingsResource . toString ( ) ) ,
302311 ResourceContextKey . Resource . isEqualTo ( this . userDataProfilesService . defaultProfile . settingsResource . toString ( ) ) ) ,
303312 ContextKeyExpr . not ( 'isInDiffEditor' ) ) ;
304313 const registerOpenUserSettingsEditorFromJsonAction = ( ) => {
305- registerOpenUserSettingsEditorFromJsonActionDisposables . value = registerAction2 ( class extends Action2 {
314+ registerOpenUserSettingsEditorFromJsonActionDisposable . value = registerAction2 ( class extends Action2 {
306315 constructor ( ) {
307316 super ( {
308317 id : '_workbench.openUserSettingsEditor' ,
@@ -806,49 +815,58 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
806815 private registerKeybindingsActions ( ) {
807816 const that = this ;
808817 const category = { value : nls . localize ( 'preferences' , "Preferences" ) , original : 'Preferences' } ;
809- const id = 'workbench.action.openGlobalKeybindings' ;
810- this . _register ( registerAction2 ( class extends Action2 {
811- constructor ( ) {
812- super ( {
813- id,
814- title : { value : nls . localize ( 'openGlobalKeybindings' , "Open Keyboard Shortcuts" ) , original : 'Open Keyboard Shortcuts' } ,
815- shortTitle : nls . localize ( 'keyboardShortcuts' , "Keyboard Shortcuts" ) ,
816- category,
817- icon : preferencesOpenSettingsIcon ,
818- keybinding : {
819- when : null ,
820- weight : KeybindingWeight . WorkbenchContrib ,
821- primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyCode . KeyS )
822- } ,
823- menu : [
824- { id : MenuId . CommandPalette } ,
825- {
826- id : MenuId . EditorTitle ,
827- when : ResourceContextKey . Resource . isEqualTo ( that . userDataProfileService . currentProfile . keybindingsResource . toString ( ) ) ,
828- group : 'navigation' ,
829- order : 1 ,
818+ const registerOpenGlobalKeybindingsActionDisposables = this . _register ( new DisposableStore ( ) ) ;
819+ const registerOpenGlobalKeybindingsAction = ( ) => {
820+ registerOpenGlobalKeybindingsActionDisposables . clear ( ) ;
821+ const id = 'workbench.action.openGlobalKeybindings' ;
822+ const shortTitle = ! that . userDataProfileService . currentProfile . isDefault && that . userDataProfileService . currentProfile . useDefaultFlags ?. keybindings
823+ ? nls . localize ( 'keyboardShortcutsFromDefault' , "Keyboard Shortcuts ({0})" , nls . localize ( 'default profile' , "Default Profile" ) )
824+ : nls . localize ( 'keyboardShortcuts' , "Keyboard Shortcuts" ) ;
825+ registerOpenGlobalKeybindingsActionDisposables . add ( registerAction2 ( class extends Action2 {
826+ constructor ( ) {
827+ super ( {
828+ id,
829+ title : { value : nls . localize ( 'openGlobalKeybindings' , "Open Keyboard Shortcuts" ) , original : 'Open Keyboard Shortcuts' } ,
830+ shortTitle,
831+ category,
832+ icon : preferencesOpenSettingsIcon ,
833+ keybinding : {
834+ when : null ,
835+ weight : KeybindingWeight . WorkbenchContrib ,
836+ primary : KeyChord ( KeyMod . CtrlCmd | KeyCode . KeyK , KeyMod . CtrlCmd | KeyCode . KeyS )
830837 } ,
831- {
832- id : MenuId . GlobalActivity ,
833- group : '2_configuration' ,
834- order : 3
835- }
836- ]
837- } ) ;
838- }
839- run ( accessor : ServicesAccessor , args : string | undefined ) {
840- const query = typeof args === 'string' ? args : undefined ;
841- return accessor . get ( IPreferencesService ) . openGlobalKeybindingSettings ( false , { query } ) ;
842- }
843- } ) ) ;
844- this . _register ( MenuRegistry . appendMenuItem ( MenuId . MenubarPreferencesMenu , {
845- command : {
846- id,
847- title : nls . localize ( 'keyboardShortcuts' , "Keyboard Shortcuts" ) ,
848- } ,
849- group : '2_configuration' ,
850- order : 3
851- } ) ) ;
838+ menu : [
839+ { id : MenuId . CommandPalette } ,
840+ {
841+ id : MenuId . EditorTitle ,
842+ when : ResourceContextKey . Resource . isEqualTo ( that . userDataProfileService . currentProfile . keybindingsResource . toString ( ) ) ,
843+ group : 'navigation' ,
844+ order : 1 ,
845+ } ,
846+ {
847+ id : MenuId . GlobalActivity ,
848+ group : '2_configuration' ,
849+ order : 3
850+ }
851+ ]
852+ } ) ;
853+ }
854+ run ( accessor : ServicesAccessor , args : string | undefined ) {
855+ const query = typeof args === 'string' ? args : undefined ;
856+ return accessor . get ( IPreferencesService ) . openGlobalKeybindingSettings ( false , { query } ) ;
857+ }
858+ } ) ) ;
859+ registerOpenGlobalKeybindingsActionDisposables . add ( MenuRegistry . appendMenuItem ( MenuId . MenubarPreferencesMenu , {
860+ command : {
861+ id,
862+ title : shortTitle ,
863+ } ,
864+ group : '2_configuration' ,
865+ order : 3
866+ } ) ) ;
867+ } ;
868+ registerOpenGlobalKeybindingsAction ( ) ;
869+ this . _register ( this . userDataProfileService . onDidChangeCurrentProfile ( ( ) => registerOpenGlobalKeybindingsAction ( ) ) ) ;
852870 registerAction2 ( class extends Action2 {
853871 constructor ( ) {
854872 super ( {
0 commit comments