]> source.dussan.org Git - gitea.git/commitdiff
Disable enter key for accepting code completion in Monaco (#30548)
authorsilverwind <me@silverwind.io>
Thu, 18 Apr 2024 08:06:56 +0000 (10:06 +0200)
committerGitHub <noreply@github.com>
Thu, 18 Apr 2024 08:06:56 +0000 (10:06 +0200)
Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour
matches vscode on desktop as well.

Co-authored-by: Giteabot <teabot@gitea.io>
web_src/js/features/codeeditor.js

index 4fb8bb9e632bfa5b08ad82fca106efafe31ce43c..f5e4e74dc61503e39def9b3d2bd219826c297370 100644 (file)
@@ -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});