Skip to content

Commit 07f0bad

Browse files
committed
remove duplicated context key expressions, fixes #97381
1 parent 5290baa commit 07f0bad

File tree

2 files changed

+4
-5
lines changed

2 files changed

+4
-5
lines changed

src/vs/editor/contrib/format/formatActions.ts

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -215,13 +215,12 @@ class FormatDocumentAction extends EditorAction {
215215
alias: 'Format Document',
216216
precondition: ContextKeyExpr.and(EditorContextKeys.notInCompositeEditor, EditorContextKeys.writable, EditorContextKeys.hasDocumentFormattingProvider),
217217
kbOpts: {
218-
kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.hasDocumentFormattingProvider),
218+
kbExpr: EditorContextKeys.editorTextFocus,
219219
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_F,
220220
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I },
221221
weight: KeybindingWeight.EditorContrib
222222
},
223223
contextMenuOpts: {
224-
when: EditorContextKeys.hasDocumentFormattingProvider,
225224
group: '1_modification',
226225
order: 1.3
227226
}
@@ -249,12 +248,12 @@ class FormatSelectionAction extends EditorAction {
249248
alias: 'Format Selection',
250249
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasDocumentSelectionFormattingProvider),
251250
kbOpts: {
252-
kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.hasDocumentSelectionFormattingProvider),
251+
kbExpr: EditorContextKeys.editorTextFocus,
253252
primary: KeyChord(KeyMod.CtrlCmd | KeyCode.KEY_K, KeyMod.CtrlCmd | KeyCode.KEY_F),
254253
weight: KeybindingWeight.EditorContrib
255254
},
256255
contextMenuOpts: {
257-
when: ContextKeyExpr.and(EditorContextKeys.hasDocumentSelectionFormattingProvider, EditorContextKeys.hasNonEmptySelection),
256+
when: EditorContextKeys.hasNonEmptySelection,
258257
group: '1_modification',
259258
order: 1.31
260259
}

src/vs/workbench/contrib/format/browser/formatActionsNone.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ registerEditorAction(class FormatDocumentMultipleAction extends EditorAction {
3232
alias: 'Format Document',
3333
precondition: ContextKeyExpr.and(EditorContextKeys.writable, EditorContextKeys.hasDocumentFormattingProvider.toNegated()),
3434
kbOpts: {
35-
kbExpr: ContextKeyExpr.and(EditorContextKeys.editorTextFocus, EditorContextKeys.hasDocumentFormattingProvider.toNegated()),
35+
kbExpr: EditorContextKeys.editorTextFocus,
3636
primary: KeyMod.Shift | KeyMod.Alt | KeyCode.KEY_F,
3737
linux: { primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.KEY_I },
3838
weight: KeybindingWeight.EditorContrib,

0 commit comments

Comments
 (0)