Skip to content

Commit

Permalink
Disable enter key for accepting code completion in Monaco (go-gitea#3…
Browse files Browse the repository at this point in the history
…0548)

Fixes go-gitea#28114 and behaviour
matches vscode on desktop as well.

Co-authored-by: Giteabot <teabot@gitea.io>
  • Loading branch information
silverwind and GiteaBot committed Apr 18, 2024
1 parent d88958b commit a7043d9
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 a7043d9

Please sign in to comment.