@@ -187,46 +187,37 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
187
187
}
188
188
189
189
private registerSettingsActions ( ) {
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 ( ) ) ) ;
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
+ } ) ) ;
230
221
registerAction2 ( class extends Action2 {
231
222
constructor ( ) {
232
223
super ( {
@@ -305,13 +296,13 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
305
296
}
306
297
} ) ;
307
298
308
- const registerOpenUserSettingsEditorFromJsonActionDisposable = this . _register ( new MutableDisposable ( ) ) ;
299
+ const registerOpenUserSettingsEditorFromJsonActionDisposables = this . _register ( new MutableDisposable ( ) ) ;
309
300
const openUserSettingsEditorWhen = ContextKeyExpr . and (
310
301
ContextKeyExpr . or ( ResourceContextKey . Resource . isEqualTo ( this . userDataProfileService . currentProfile . settingsResource . toString ( ) ) ,
311
302
ResourceContextKey . Resource . isEqualTo ( this . userDataProfilesService . defaultProfile . settingsResource . toString ( ) ) ) ,
312
303
ContextKeyExpr . not ( 'isInDiffEditor' ) ) ;
313
304
const registerOpenUserSettingsEditorFromJsonAction = ( ) => {
314
- registerOpenUserSettingsEditorFromJsonActionDisposable . value = registerAction2 ( class extends Action2 {
305
+ registerOpenUserSettingsEditorFromJsonActionDisposables . value = registerAction2 ( class extends Action2 {
315
306
constructor ( ) {
316
307
super ( {
317
308
id : '_workbench.openUserSettingsEditor' ,
@@ -815,58 +806,49 @@ class PreferencesActionsContribution extends Disposable implements IWorkbenchCon
815
806
private registerKeybindingsActions ( ) {
816
807
const that = this ;
817
808
const category = { value : nls . localize ( 'preferences' , "Preferences" ) , original : 'Preferences' } ;
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 )
837
- } ,
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 : {
809
+ const id = 'workbench.action.openGlobalKeybindings' ;
810
+ this . _register ( registerAction2 ( class extends Action2 {
811
+ constructor ( ) {
812
+ super ( {
861
813
id,
862
- title : shortTitle ,
863
- } ,
864
- group : '2_configuration' ,
865
- order : 3
866
- } ) ) ;
867
- } ;
868
- registerOpenGlobalKeybindingsAction ( ) ;
869
- this . _register ( this . userDataProfileService . onDidChangeCurrentProfile ( ( ) => registerOpenGlobalKeybindingsAction ( ) ) ) ;
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 ,
830
+ } ,
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
+ } ) ) ;
870
852
registerAction2 ( class extends Action2 {
871
853
constructor ( ) {
872
854
super ( {
0 commit comments