Skip to content

Commit 05e1159

Browse files
silverwindGiteaBot
authored andcommitted
Disable enter key for accepting code completion in Monaco (#30548)
Fixes #28114 and behaviour matches vscode on desktop as well. Co-authored-by: Giteabot <teabot@gitea.io>
1 parent a3eb339 commit 05e1159

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

web_src/js/features/codeeditor.js

+4
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,10 @@ export async function createMonaco(textarea, filename, editorOpts) {
112112
...other,
113113
});
114114

115+
monaco.editor.addKeybindingRules([
116+
{keybinding: monaco.KeyCode.Enter, command: null}, // disable enter from accepting code completion
117+
]);
118+
115119
const model = editor.getModel();
116120
model.onDidChangeContent(() => {
117121
textarea.value = editor.getValue({preserveBOM: true});

0 commit comments

Comments
 (0)