Skip to content

Commit

Permalink
Disable enter key for accepting code completion in Monaco (#30548)
Browse files Browse the repository at this point in the history
Fixes #28114 and behaviour
matches vscode on desktop as well.

Co-authored-by: Giteabot <teabot@gitea.io>
  • Loading branch information
2 people authored and pull[bot] committed Apr 27, 2024
1 parent a3eb339 commit 05e1159
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions web_src/js/features/codeeditor.js
Original file line number Diff line number Diff line change
Expand Up @@ -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});
Expand Down

0 comments on commit 05e1159

Please sign in to comment.