Open golergka opened 1 year ago
For a workaround you could probably use context keys 🤔 Augment the when
condition of the keybinding you want to disable in select editors by a custom context key and then set that only in the editors you want the keybinding to be disabled in.
// remove standard keybinding
monaco.editor.addKeybindingRule({keybinding: 0, command: "-editor.action.quickFix"});
// add keybinding again but augment the when condition with a custom context key that would disable the keybinding
monaco.editor.addKeybindingRule({
keybinding: monaco.KeyMod.CtrlCmd | monaco.KeyCode.Period,
command: "editor.action.quickFix",
when: "!disabledKeybinding && editorHasCodeActionsProvider && editorTextFocus && !editorReadonly"
});
...
// set custom context key to disable keybinding in second editor only
editor2.createContextKey("disabledKeybinding", true);
Context
Description
In my project I use several editor instances, and I want to disable certain keybindings only on some of them. Thankfully, 0.34.1 added
addKeybindingRules(s)
, but this function is defined as a global and affects all editors. I'd like to be able to remove keybindings only for selected editors.Monaco Editor Playground Link
No response
Monaco Editor Playground Code
No response