summaryrefslogtreecommitdiffstats
path: root/web_src/js/features
diff options
context:
space:
mode:
authorsilverwind <me@silverwind.io>2024-04-18 10:06:56 +0200
committerGitHub <noreply@github.com>2024-04-18 10:06:56 +0200
commit49b80f8ac1cf9f0b56da0c73d0f34ef030f4c447 (patch)
treef16c2b022ce80afce5e1d314835916607861f052 /web_src/js/features
parent2da1dcfc21afe6f5373e4271e9ddcc7f31d6695b (diff)
downloadgitea-49b80f8ac1cf9f0b56da0c73d0f34ef030f4c447.tar.gz
gitea-49b80f8ac1cf9f0b56da0c73d0f34ef030f4c447.zip
Disable enter key for accepting code completion in Monaco (#30548)
Fixes https://github.com/go-gitea/gitea/issues/28114 and behaviour matches vscode on desktop as well. Co-authored-by: Giteabot <teabot@gitea.io>
Diffstat (limited to 'web_src/js/features')
-rw-r--r--web_src/js/features/codeeditor.js4
1 files changed, 4 insertions, 0 deletions
diff --git a/web_src/js/features/codeeditor.js b/web_src/js/features/codeeditor.js
index 4fb8bb9e63..f5e4e74dc6 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});