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.

fix: dont move between cells if auto-complete is open (#669)

Myles Scolnickb1b6063f39e2
diff --git a/frontend/src/core/codemirror/cells/extensions.ts b/frontend/src/core/codemirror/cells/extensions.ts
index d5c56fbc1d..40991f6639 100644
--- a/frontend/src/core/codemirror/cells/extensions.ts
+++ b/frontend/src/core/codemirror/cells/extensions.ts
@@ -7,7 +7,7 @@ import { formatKeymapExtension } from "../extensions";
import { CellActions } from "@/core/cells/cells";
import { getEditorCodeAsPython } from "../language/utils";
import { formattingChangeEffect } from "../format";
-import { closeCompletion } from "@codemirror/autocomplete";
+import { closeCompletion, completionStatus } from "@codemirror/autocomplete";
import { isAtEndOfEditor, isAtStartOfEditor } from "../utils";
export interface MovementCallbacks
@@ -117,6 +117,12 @@ export function cellMovementBundle(
preventDefault: true,
stopPropagation: true,
run: (ev) => {
+ // Skip if we are in the middle of an autocompletion
+ const hasAutocomplete = completionStatus(ev.state);
+ if (hasAutocomplete) {
+ return false;
+ }
+
if (isAtStartOfEditor(ev)) {
focusUp();
return true;
@@ -129,6 +135,12 @@ export function cellMovementBundle(
preventDefault: true,
stopPropagation: true,
run: (ev) => {
+ // Skip if we are in the middle of an autocompletion
+ const hasAutocomplete = completionStatus(ev.state);
+ if (hasAutocomplete) {
+ return false;
+ }
+
if (isAtEndOfEditor(ev)) {
focusDown();
return true;