From 404eb11bde49955819079ecc76b7cfd329654b02 Mon Sep 17 00:00:00 2001 From: rebornix Date: Mon, 6 Jul 2020 16:25:18 -0700 Subject: [PATCH] re #101436. update builtin notebook actions keybindings --- .../notebook/browser/contrib/coreActions.ts | 20 +++++++++++++++++++ .../notebook/browser/contrib/fold/folding.ts | 14 ++++++++++--- 2 files changed, 31 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts index b91bd74b65a..4761aa89a5e 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/coreActions.ts @@ -1110,6 +1110,11 @@ registerAction2(class extends NotebookAction { order: CellToolbarOrder.ClearCellOutput, group: CELL_TITLE_GROUP_ID }, + keybinding: { + when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey), NOTEBOOK_CELL_HAS_OUTPUTS), + primary: KeyMod.Alt | KeyCode.Delete, + weight: KeybindingWeight.WorkbenchContrib + }, icon: { id: 'codicon/clear-all' }, }); } @@ -1271,6 +1276,11 @@ registerAction2(class extends NotebookAction { group: CELL_TITLE_GROUP_ID }, icon: { id: 'codicon/split-vertical' }, + keybinding: { + when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, NOTEBOOK_CELL_TYPE.isEqualTo('code'), NOTEBOOK_EDITOR_EDITABLE, NOTEBOOK_CELL_EDITABLE, InputFocusedContext), + primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_BACKSLASH, + weight: KeybindingWeight.WorkbenchContrib + }, }); } @@ -1293,6 +1303,11 @@ registerAction2(class extends NotebookAction { { id: JOIN_CELL_ABOVE_COMMAND_ID, title: localize('notebookActions.joinCellAbove', "Join with Previous Cell"), + keybinding: { + when: NOTEBOOK_EDITOR_FOCUSED, + primary: KeyMod.WinCtrl | KeyMod.Alt | KeyMod.Shift | KeyCode.KEY_J, + weight: KeybindingWeight.WorkbenchContrib + } }); } @@ -1307,6 +1322,11 @@ registerAction2(class extends NotebookAction { { id: JOIN_CELL_BELOW_COMMAND_ID, title: localize('notebookActions.joinCellBelow', "Join with Next Cell"), + keybinding: { + when: NOTEBOOK_EDITOR_FOCUSED, + primary: KeyMod.WinCtrl | KeyMod.Alt | KeyCode.KEY_J, + weight: KeybindingWeight.WorkbenchContrib + } }); } diff --git a/src/vs/workbench/contrib/notebook/browser/contrib/fold/folding.ts b/src/vs/workbench/contrib/notebook/browser/contrib/fold/folding.ts index 9fcbcf7e1ae..962051d482a 100644 --- a/src/vs/workbench/contrib/notebook/browser/contrib/fold/folding.ts +++ b/src/vs/workbench/contrib/notebook/browser/contrib/fold/folding.ts @@ -12,7 +12,7 @@ import { registerNotebookContribution } from 'vs/workbench/contrib/notebook/brow import { registerAction2, Action2 } from 'vs/platform/actions/common/actions'; import { ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey'; import { InputFocusedContextKey } from 'vs/platform/contextkey/common/contextkeys'; -import { KeyCode } from 'vs/base/common/keyCodes'; +import { KeyCode, KeyMod } from 'vs/base/common/keyCodes'; import { KeybindingWeight } from 'vs/platform/keybinding/common/keybindingsRegistry'; import { ServicesAccessor } from 'vs/platform/instantiation/common/instantiation'; import { IEditorService } from 'vs/workbench/services/editor/common/editorService'; @@ -138,7 +138,11 @@ registerAction2(class extends Action2 { category: NOTEBOOK_ACTIONS_CATEGORY, keybinding: { when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), - primary: KeyCode.LeftArrow, + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_OPEN_SQUARE_BRACKET, + mac: { + primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_OPEN_SQUARE_BRACKET + }, + secondary: [KeyCode.LeftArrow], weight: KeybindingWeight.WorkbenchContrib }, precondition: NOTEBOOK_IS_ACTIVE_EDITOR, @@ -177,7 +181,11 @@ registerAction2(class extends Action2 { category: NOTEBOOK_ACTIONS_CATEGORY, keybinding: { when: ContextKeyExpr.and(NOTEBOOK_EDITOR_FOCUSED, ContextKeyExpr.not(InputFocusedContextKey)), - primary: KeyCode.RightArrow, + primary: KeyMod.CtrlCmd | KeyMod.Shift | KeyCode.US_CLOSE_SQUARE_BRACKET, + mac: { + primary: KeyMod.CtrlCmd | KeyMod.Alt | KeyCode.US_CLOSE_SQUARE_BRACKET + }, + secondary: [KeyCode.RightArrow], weight: KeybindingWeight.WorkbenchContrib }, precondition: NOTEBOOK_IS_ACTIVE_EDITOR, -- GitLab