Add default keybindings for notebook cell chat when it is enabled. (#208454)

This commit is contained in:
Peng Lyu 2024-03-22 12:50:29 -07:00 committed by GitHub
parent a832f9955c
commit 6030fca4db
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import { Codicon } from 'vs/base/common/codicons';
import { KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { KeyChord, KeyCode, KeyMod } from 'vs/base/common/keyCodes';
import { EditorContextKeys } from 'vs/editor/common/editorContextKeys';
import { localize, localize2 } from 'vs/nls';
import { CONTEXT_ACCESSIBILITY_MODE_ENABLED } from 'vs/platform/accessibility/common/accessibility';
@ -386,6 +386,18 @@ registerAction2(class extends NotebookAction {
]
},
f1: false,
keybinding: {
when: ContextKeyExpr.and(
NOTEBOOK_EDITOR_FOCUSED,
NOTEBOOK_EDITOR_EDITABLE.isEqualTo(true),
ContextKeyExpr.not(InputFocusedContextKey),
CTX_INLINE_CHAT_HAS_PROVIDER,
ContextKeyExpr.equals(`config.${NotebookSetting.cellChat}`, true)
),
weight: KeybindingWeight.WorkbenchContrib,
primary: KeyMod.CtrlCmd | KeyCode.KeyI,
secondary: [KeyChord(KeyMod.CtrlCmd | KeyCode.KeyK, KeyCode.KeyI)],
},
menu: [
{
id: MenuId.NotebookCellBetween,