Skip to content

A reactive notebook for Python — run reproducible experiments, query with SQL, execute as a script, deploy as an app, and version with git. Stored as pure Python. All in a modern, AI-native editor.

feat(editor): Add keyboard shortcuts for completion navigation (#3382)

eugenebf49994d100a
diff --git a/frontend/src/core/codemirror/cm.ts b/frontend/src/core/codemirror/cm.ts
index e121df6663..43a3358fb9 100644
--- a/frontend/src/core/codemirror/cm.ts
+++ b/frontend/src/core/codemirror/cm.ts
@@ -4,6 +4,8 @@ import {
closeBrackets,
closeBracketsKeymap,
startCompletion,
+ moveCompletionSelection,
+ completionStatus,
} from "@codemirror/autocomplete";
import {
history,
@@ -170,6 +172,30 @@ export const basicBundle = (opts: CodeMirrorSetupOpts): Extension[] => {
},
preventDefault: true,
},
+ {
+ key: "Alt-j",
+ mac: "Ctrl-j",
+ run: (cm) => {
+ if (completionStatus(cm.state) !== null) {
+ moveCompletionSelection(true)(cm);
+ return true;
+ }
+ return false;
+ },
+ preventDefault: true,
+ },
+ {
+ key: "Alt-k",
+ mac: "Ctrl-k",
+ run: (cm) => {
+ if (completionStatus(cm.state) !== null) {
+ moveCompletionSelection(false)(cm);
+ return true;
+ }
+ return false;
+ },
+ preventDefault: true,
+ },
]),
keymap.of([...historyKeymap, indentWithTab]),
];