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
…30559)

Backport #30548 by @silverwind

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

Co-authored-by: silverwind <me@silverwind.io>
(cherry picked from commit c9633f2d74490211ffd9fd6b3a17180e86fa1fb9)
  • Loading branch information
GiteaBot authored and earl-warren committed Apr 21, 2024
1 parent f436cb8 commit cb4246e
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 cb4246e

Please sign in to comment.