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: autocomplete regressions (#240)

Akshay Agrawald33c4239aa87
diff --git a/frontend/src/core/codemirror/completion/hints.ts b/frontend/src/core/codemirror/completion/hints.ts
index 22c1ec35eb..4d5be9f575 100644
--- a/frontend/src/core/codemirror/completion/hints.ts
+++ b/frontend/src/core/codemirror/completion/hints.ts
@@ -9,7 +9,6 @@ import {
} from "@codemirror/view";
import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
import { Logger } from "@/utils/Logger";
-import { closeCompletion } from "@codemirror/autocomplete";
import { StateField, StateEffect } from "@codemirror/state";
export function hintTooltip() {
@@ -61,10 +60,6 @@ export function hintTooltip() {
message: result,
exactName: fullWord,
});
- // Close the completion tooltips
- if (tooltip) {
- closeCompletion(view);
- }
return tooltip ?? null;
},
{
@@ -75,7 +70,8 @@ export function hintTooltip() {
// Clear tooltips on blur
EditorView.domEventObservers({
blur: (event, view) => {
- closeCompletion(view);
+ // Only close tooltip, not view; blur for completion handled by
+ // cell editor, so that completion text is selectable
clearTooltips(view);
},
}),
diff --git a/frontend/src/css/codemirror.css b/frontend/src/css/codemirror.css
index ab094cfdff..38807c89c4 100644
--- a/frontend/src/css/codemirror.css
+++ b/frontend/src/css/codemirror.css
@@ -55,6 +55,11 @@
padding: 0.625rem 0.875rem;
}
+/* Hover tooltips get highest priority in display. */
+.cm .cm-tooltip.cm-tooltip-hover {
+ z-index: 1000;
+}
+
.mo-cm-tooltip ul {
white-space: normal;
display: block;
diff --git a/marimo/_runtime/complete.py b/marimo/_runtime/complete.py
index 4b91e98807..f8e4f3b154 100644
--- a/marimo/_runtime/complete.py
+++ b/marimo/_runtime/complete.py
@@ -233,7 +233,7 @@ def complete(
)
],
)
- continue
+ continue
if not completions:
# If there are still no completions, then bail.