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 a82bf02 commit d2015fc
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 d2015fc

Please sign in to comment.