From 27fed29890bfb59932b538540e16e651d4ef1d00 Mon Sep 17 00:00:00 2001 From: silverwind Date: Wed, 17 Apr 2024 23:20:02 +0200 Subject: [PATCH] Disable enter key for accepting code completion in Monaco --- web_src/js/features/codeeditor.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/web_src/js/features/codeeditor.js b/web_src/js/features/codeeditor.js index 4fb8bb9e632bf..f5e4e74dc6150 100644 --- a/web_src/js/features/codeeditor.js +++ b/web_src/js/features/codeeditor.js @@ -112,6 +112,10 @@ export async function createMonaco(textarea, filename, editorOpts) { ...other, }); + monaco.editor.addKeybindingRules([ + {keybinding: monaco.KeyCode.Enter, command: null}, // disable enter from accepting code completion + ]); + const model = editor.getModel(); model.onDidChangeContent(() => { textarea.value = editor.getValue({preserveBOM: true});