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.
Python artificial-intelligencedagdata-sciencedata-visualizationdataflowdeveloper-toolsmachine-learningnotebookspipelinepythonreactivesqlweb-app
fix: completions no appearing b/c of live docs. don't request live-docs unless open (#4254)
Myles Scolnickd26c8ef2ae01
diff --git a/frontend/src/components/editor/Cell.tsx b/frontend/src/components/editor/Cell.tsxindex d778baf17f..0f4e98f5ce 100644--- a/frontend/src/components/editor/Cell.tsx+++ b/frontend/src/components/editor/Cell.tsx@@ -1,5 +1,5 @@/* Copyright 2024 Marimo. All rights reserved. */-import { completionStatus } from "@codemirror/autocomplete";+import { closeCompletion, completionStatus } from "@codemirror/autocomplete";import type { EditorView } from "@codemirror/view";import {memo,@@ -79,7 +79,7 @@ function useCellCompletion(!cellRef.current.contains(e.relatedTarget) &&editorView.current !== null) {- // closeCompletion(editorView.current);+ closeCompletion(editorView.current);}});diff --git a/frontend/src/components/editor/documentation.css b/frontend/src/components/editor/documentation.cssindex 04d807fbf6..1c550d3162 100644--- a/frontend/src/components/editor/documentation.css+++ b/frontend/src/components/editor/documentation.css@@ -54,7 +54,7 @@}code {- @apply border px-1 rounded font-mono bg-[var(--slate-1)] text-sm mb-4 mt-2;+ @apply border px-1 rounded font-mono bg-[var(--slate-2)] text-sm mb-4 mt-2;}h1,@@ -81,6 +81,7 @@@apply bg-[var(--slate-2)] px-1 border rounded-md text-sm font-mono;}+ pre > code,.codehilite code {width: 100%;display: inline-block;diff --git a/frontend/src/core/codemirror/completion/Autocompleter.ts b/frontend/src/core/codemirror/completion/Autocompleter.tsindex 7591f6f49b..6817af3311 100644--- a/frontend/src/core/codemirror/completion/Autocompleter.ts+++ b/frontend/src/core/codemirror/completion/Autocompleter.ts@@ -38,9 +38,8 @@ export const AUTOCOMPLETER = new DeferredRequestRegistry<...req,});},- // We don't care about previous requests- // so we just resolve them with an empty response.- { resolveExistingRequests: () => null },+ // We don't resolve previous requests+ // because they may be used for tooltips or live documentation.);export const Autocompleter = {diff --git a/frontend/src/core/codemirror/completion/hints.ts b/frontend/src/core/codemirror/completion/hints.tsindex 3d5d47c87a..6803e9a7bd 100644--- a/frontend/src/core/codemirror/completion/hints.ts+++ b/frontend/src/core/codemirror/completion/hints.ts@@ -8,6 +8,7 @@ import { debounce } from "lodash-es";import { documentationAtom } from "@/core/documentation/state";import { store } from "@/core/state/jotai";import { getFeatureFlag } from "@/core/config/feature-flag";+import { chromeAtom } from "@/components/editor/chrome/state";export function hintTooltip() {return [@@ -98,6 +99,11 @@ function isCursorInText(state: EditorState) {// Debounce the request to avoid spamming the serverconst debouncedAutocomplete = debounce(async (view: EditorView, position: number) => {+ // Only run if the documentation panel is open+ if (store.get(chromeAtom).selectedPanel !== "documentation") {+ return;+ }+const tooltip = await requestDocumentation(view, position);// If cancelled, don't update the documentationif (tooltip === "cancelled") {diff --git a/frontend/src/css/app/codemirror-completions.css b/frontend/src/css/app/codemirror-completions.cssindex 0e3b20bbbc..ca542cc24a 100644--- a/frontend/src/css/app/codemirror-completions.css+++ b/frontend/src/css/app/codemirror-completions.css@@ -215,6 +215,10 @@.cm-signature-help {max-width: 700px !important;margin-right: 16px !important;+ padding: 10px !important;+ overflow-y: auto;+ max-height: 400px;+ scrollbar-width: thin;@apply bg-popover shadow-md border border-border rounded-md text-sm;.cm-signature {@@ -225,6 +229,10 @@@apply text-xs;}+ .cm-signature {+ @apply font-mono;+ }+.cm-signature-docs {@apply text-xs;}@@ -244,9 +252,21 @@}code:not(:empty) {- @apply bg-[var(--gray-3)] rounded-sm px-1;+ width: 100%;+ white-space: pre-wrap;+ @apply bg-[var(--slate-2)] border rounded-sm px-1 font-mono;+ }++ pre > code {+ width: 100%;+ display: inline-block;+ white-space: pre-wrap;+ @apply bg-[var(--slate-2)] border p-2 rounded-md font-mono text-sm my-2;}+ h1,+ h2,+ h3,h4 {@apply text-sm font-semibold mt-2 mb-1;}