Skip to content

@jsvision/code-editor / registerCodeEditorKeyBindings

Function: registerCodeEditorKeyBindings() ​

registerCodeEditorKeyBindings(defaults, custom, overrides): Readonly<Record<string, CodeEditorCommand>>

Defined in: code-editor/src/ui/keybindings.ts:79

Builds one immutable canonical binding map with expected-command override protection.

An override names the command the host expects to replace. This prevents a stale customization from silently displacing a different default after an application or package upgrade.

Parameters ​

defaults ​

Readonly<Record<string, CodeEditorCommand>>

Package-provided bindings registered first.

custom ​

Readonly<Record<string, CodeEditorCommand>> | undefined

Optional host bindings to add or replace explicitly.

overrides ​

Readonly<Record<string, CodeEditorCommand>> | undefined

Expected default command for every intentional replacement.

Returns ​

Readonly<Record<string, CodeEditorCommand>>

A frozen record keyed by canonical binding names.

Throws ​

When canonical bindings conflict or an override is stale.

Throws ​

When any record, binding, or command is unsafe.

Example ​

ts
registerCodeEditorKeyBindings(defaults, { 'Ctrl+F': 'assist' }, { 'Ctrl+F': 'search.open' });