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) (go-gitea#30558)

Backport go-gitea#30548 by @silverwind

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

Co-authored-by: silverwind <me@silverwind.io>
  • Loading branch information
GiteaBot and silverwind authored Apr 18, 2024
1 parent a82bf02 commit 332ee35
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 332ee35

Please sign in to comment.