@marimo-team/islands 0.23.14-dev1 → 0.23.14-dev11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{ConnectedDataExplorerComponent-Du3_nUzI.js → ConnectedDataExplorerComponent-DXBx_nQg.js} +4 -4
  2. package/dist/{chat-ui-CsPewo4h.js → chat-ui-DYBcNEdd.js} +81 -81
  3. package/dist/{code-visibility-aprTe3au.js → code-visibility-D9_pdpn0.js} +1030 -837
  4. package/dist/{formats-d6MhLuQ9.js → formats-WsOgyW_K.js} +1 -1
  5. package/dist/{glide-data-editor-DkzAInWG.js → glide-data-editor-qpmKyAPn.js} +2 -2
  6. package/dist/{html-to-image-DXwLcQ6l.js → html-to-image-MqcD07Bw.js} +2218 -2186
  7. package/dist/{input-CbEz_aj_.js → input-BSdZp5Ng.js} +1 -1
  8. package/dist/main.js +254 -254
  9. package/dist/{mermaid-CJW9vIyO.js → mermaid-D-HYBMEV.js} +2 -2
  10. package/dist/{process-output-C6_e1pT_.js → process-output-Dt3icftd.js} +1 -1
  11. package/dist/{reveal-component-j-ug9bTS.js → reveal-component-BbZ44Wvb.js} +5 -5
  12. package/dist/{spec-Bv-XlYiv.js → spec-CnTgI25l.js} +1 -1
  13. package/dist/{toDate-D-l5s8nn.js → toDate-D1Z7ZXWh.js} +1 -1
  14. package/dist/{useAsyncData-1Dhzjfwf.js → useAsyncData-BMc8itk2.js} +1 -1
  15. package/dist/{useDeepCompareMemoize-CDWT3BDz.js → useDeepCompareMemoize-ZwmDBRDY.js} +1 -1
  16. package/dist/{useLifecycle-AHlswLw-.js → useLifecycle-CxffarYV.js} +1 -1
  17. package/dist/{useTheme-BrYvK-_A.js → useTheme-yGsGEk82.js} +26 -24
  18. package/dist/{vega-component-Pk6lyc_a.js → vega-component-BFJTyykA.js} +5 -5
  19. package/package.json +1 -1
  20. package/src/components/chat/acp/agent-panel.tsx +35 -1
  21. package/src/components/chat/chat-panel.tsx +68 -29
  22. package/src/components/editor/actions/useNotebookActions.tsx +2 -2
  23. package/src/components/editor/chrome/panels/__tests__/snippet-display.test.ts +22 -0
  24. package/src/components/editor/chrome/panels/snippet-display.ts +27 -0
  25. package/src/components/editor/chrome/panels/snippets-panel.tsx +5 -2
  26. package/src/components/editor/chrome/wrapper/__tests__/useOpenAiAssistant.test.ts +36 -0
  27. package/src/components/editor/chrome/wrapper/footer-items/pyodide-status.tsx +6 -36
  28. package/src/components/editor/chrome/wrapper/useAiPanel.ts +3 -1
  29. package/src/components/editor/chrome/wrapper/useOpenAiAssistant.ts +88 -0
  30. package/src/components/editor/errors/__tests__/auto-fix.test.ts +119 -0
  31. package/src/components/editor/errors/auto-fix.tsx +108 -34
  32. package/src/components/editor/errors/fix-mode.ts +1 -1
  33. package/src/components/editor/output/MarimoTracebackOutput.tsx +10 -1
  34. package/src/components/editor/output/__tests__/traceback.test.tsx +14 -6
  35. package/src/components/lifecycle/ProgressiveBoundary.tsx +42 -0
  36. package/src/components/lifecycle/RuntimeStatusBadge.tsx +59 -0
  37. package/src/components/lifecycle/__tests__/ProgressiveBoundary.test.tsx +147 -0
  38. package/src/components/lifecycle/__tests__/RuntimeStatusBadge.test.tsx +72 -0
  39. package/src/core/ai/config.ts +2 -2
  40. package/src/core/ai/state.ts +11 -0
  41. package/src/core/codemirror/completion/__tests__/signature-hint.test.ts +94 -0
  42. package/src/core/codemirror/completion/completer.ts +12 -1
  43. package/src/core/codemirror/completion/signature-hint.ts +68 -0
  44. package/src/core/codemirror/language/languages/python.ts +10 -4
  45. package/src/core/codemirror/utils.ts +15 -0
  46. package/src/core/edit-app.tsx +8 -5
  47. package/src/core/lifecycle/__tests__/render-policy.test.ts +247 -0
  48. package/src/core/lifecycle/render-policy.ts +125 -0
  49. package/src/core/run-app.tsx +27 -23
  50. package/src/core/runtime/__tests__/adapter.test.ts +160 -0
  51. package/src/core/runtime/adapter.ts +182 -0
  52. package/src/core/wasm/PyodideLoader.tsx +20 -62
  53. package/src/core/wasm/bridge.ts +9 -4
  54. package/src/core/wasm/state.ts +8 -19
  55. package/src/core/wasm/store.ts +1 -1
  56. package/src/hooks/__tests__/useDelayElapsed.test.tsx +55 -0
  57. package/src/hooks/useDelayElapsed.ts +27 -0
  58. package/src/core/wasm/__tests__/PyodideLoader.test.ts +0 -72
  59. package/src/core/wasm/__tests__/state.test.ts +0 -124
  60. /package/dist/{files → export_demos}/wasm-intro.py +0 -0
@@ -0,0 +1,147 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { act, render, screen } from "@testing-library/react";
4
+ import { atom, createStore, Provider } from "jotai";
5
+ import type { ReactNode } from "react";
6
+ import { afterEach, beforeEach, describe, expect, it, vi } from "vitest";
7
+ import { ProgressiveBoundary } from "../ProgressiveBoundary";
8
+
9
+ describe("ProgressiveBoundary", () => {
10
+ let store: ReturnType<typeof createStore>;
11
+
12
+ const wrapper = ({ children }: { children: ReactNode }) => (
13
+ <Provider store={store}>{children}</Provider>
14
+ );
15
+
16
+ beforeEach(() => {
17
+ vi.useFakeTimers();
18
+ store = createStore();
19
+ });
20
+
21
+ afterEach(() => {
22
+ vi.useRealTimers();
23
+ });
24
+
25
+ it("renders children once the capability resolves true", () => {
26
+ const capability = atom(true);
27
+ render(
28
+ <ProgressiveBoundary requires={capability}>
29
+ <span>content</span>
30
+ </ProgressiveBoundary>,
31
+ { wrapper },
32
+ );
33
+ expect(screen.getByText("content")).toBeInTheDocument();
34
+ });
35
+
36
+ it("blocks children with no fallback when capability is false", () => {
37
+ const capability = atom(false);
38
+ const { container } = render(
39
+ <ProgressiveBoundary requires={capability}>
40
+ <span>content</span>
41
+ </ProgressiveBoundary>,
42
+ { wrapper },
43
+ );
44
+ expect(container).toBeEmptyDOMElement();
45
+ });
46
+
47
+ it("renders the fallback when capability is false", () => {
48
+ const capability = atom(false);
49
+ render(
50
+ <ProgressiveBoundary requires={capability} fallback={<span>wait</span>}>
51
+ <span>content</span>
52
+ </ProgressiveBoundary>,
53
+ { wrapper },
54
+ );
55
+ expect(screen.getByText("wait")).toBeInTheDocument();
56
+ expect(screen.queryByText("content")).not.toBeInTheDocument();
57
+ });
58
+
59
+ it("renders children once a previously-false capability flips true", () => {
60
+ const capability = atom(false);
61
+ render(
62
+ <ProgressiveBoundary requires={capability} fallback={<span>wait</span>}>
63
+ <span>content</span>
64
+ </ProgressiveBoundary>,
65
+ { wrapper },
66
+ );
67
+ expect(screen.getByText("wait")).toBeInTheDocument();
68
+
69
+ act(() => store.set(capability, true));
70
+ expect(screen.getByText("content")).toBeInTheDocument();
71
+ });
72
+
73
+ it("reopens the gate when a capability flips back to false", () => {
74
+ const capability = atom(true);
75
+ render(
76
+ <ProgressiveBoundary requires={capability} fallback={<span>wait</span>}>
77
+ <span>content</span>
78
+ </ProgressiveBoundary>,
79
+ { wrapper },
80
+ );
81
+ expect(screen.getByText("content")).toBeInTheDocument();
82
+
83
+ act(() => store.set(capability, false));
84
+ expect(screen.queryByText("content")).not.toBeInTheDocument();
85
+ expect(screen.getByText("wait")).toBeInTheDocument();
86
+ });
87
+
88
+ it("delays the fallback by `delay` ms", () => {
89
+ const capability = atom(false);
90
+ render(
91
+ <ProgressiveBoundary
92
+ requires={capability}
93
+ delay={2000}
94
+ fallback={<span>wait</span>}
95
+ >
96
+ <span>content</span>
97
+ </ProgressiveBoundary>,
98
+ { wrapper },
99
+ );
100
+ // Before the delay elapses, no fallback.
101
+ expect(screen.queryByText("wait")).not.toBeInTheDocument();
102
+
103
+ act(() => vi.advanceTimersByTime(2000));
104
+ expect(screen.getByText("wait")).toBeInTheDocument();
105
+ });
106
+
107
+ it("re-arms the delay when the gate closes again", () => {
108
+ const capability = atom(true);
109
+ render(
110
+ <ProgressiveBoundary
111
+ requires={capability}
112
+ delay={2000}
113
+ fallback={<span>wait</span>}
114
+ >
115
+ <span>content</span>
116
+ </ProgressiveBoundary>,
117
+ { wrapper },
118
+ );
119
+ expect(screen.getByText("content")).toBeInTheDocument();
120
+
121
+ // Gate closes: fallback should stay suppressed until the delay re-elapses.
122
+ act(() => store.set(capability, false));
123
+ expect(screen.queryByText("wait")).not.toBeInTheDocument();
124
+ expect(screen.queryByText("content")).not.toBeInTheDocument();
125
+
126
+ act(() => vi.advanceTimersByTime(2000));
127
+ expect(screen.getByText("wait")).toBeInTheDocument();
128
+ });
129
+
130
+ it("skips the fallback entirely if the gate opens before the delay", () => {
131
+ const capability = atom(false);
132
+ render(
133
+ <ProgressiveBoundary
134
+ requires={capability}
135
+ delay={5000}
136
+ fallback={<span>wait</span>}
137
+ >
138
+ <span>content</span>
139
+ </ProgressiveBoundary>,
140
+ { wrapper },
141
+ );
142
+ expect(screen.queryByText("wait")).not.toBeInTheDocument();
143
+
144
+ act(() => store.set(capability, true));
145
+ expect(screen.getByText("content")).toBeInTheDocument();
146
+ });
147
+ });
@@ -0,0 +1,72 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { render, screen } from "@testing-library/react";
4
+ import { atom, createStore, Provider } from "jotai";
5
+ import type { ReactNode } from "react";
6
+ import { beforeEach, describe, expect, it } from "vitest";
7
+ import { TooltipProvider } from "@/components/ui/tooltip";
8
+ import {
9
+ type AdapterState,
10
+ type RuntimeAdapter,
11
+ runtimeAdapterAtom,
12
+ } from "@/core/runtime/adapter";
13
+ import { RuntimeStatusBadge } from "../RuntimeStatusBadge";
14
+
15
+ function makeAdapter(initial: AdapterState): RuntimeAdapter {
16
+ return {
17
+ kind: "remote",
18
+ label: "Kernel",
19
+ capabilities: {
20
+ canHealthCheck: true,
21
+ canShutdown: true,
22
+ canRestart: true,
23
+ supportsLsp: true,
24
+ },
25
+ state: atom<AdapterState>(initial),
26
+ };
27
+ }
28
+
29
+ let store: ReturnType<typeof createStore>;
30
+
31
+ const wrapper = ({ children }: { children: ReactNode }) => (
32
+ <Provider store={store}>
33
+ <TooltipProvider>{children}</TooltipProvider>
34
+ </Provider>
35
+ );
36
+
37
+ beforeEach(() => {
38
+ store = createStore();
39
+ });
40
+
41
+ describe("RuntimeStatusBadge", () => {
42
+ it("hides itself when the runtime is ready", () => {
43
+ store.set(runtimeAdapterAtom, makeAdapter({ kind: "ready" }));
44
+ const { container } = render(<RuntimeStatusBadge />, { wrapper });
45
+ expect(container).toBeEmptyDOMElement();
46
+ });
47
+
48
+ it("shows a labeled spinner pill while connecting", () => {
49
+ store.set(
50
+ runtimeAdapterAtom,
51
+ makeAdapter({
52
+ kind: "connecting",
53
+ progress: { label: "Loading Pyodide…" },
54
+ }),
55
+ );
56
+ render(<RuntimeStatusBadge />, { wrapper });
57
+ expect(screen.getByTestId("runtime-status-footer")).toBeInTheDocument();
58
+ expect(screen.getByText("Kernel")).toBeInTheDocument();
59
+ });
60
+
61
+ it("shows the failure icon when the runtime fails", () => {
62
+ store.set(
63
+ runtimeAdapterAtom,
64
+ makeAdapter({
65
+ kind: "failed",
66
+ error: { message: "Boom", errorKind: "init" },
67
+ }),
68
+ );
69
+ render(<RuntimeStatusBadge />, { wrapper });
70
+ expect(screen.getByTestId("runtime-status-footer")).toBeInTheDocument();
71
+ });
72
+ });
@@ -60,7 +60,7 @@ export const useModelChange = () => {
60
60
  },
61
61
  };
62
62
 
63
- saveConfig(newConfig);
63
+ await saveConfig(newConfig);
64
64
  };
65
65
 
66
66
  const saveModeChange = async (newMode: CopilotMode) => {
@@ -71,7 +71,7 @@ export const useModelChange = () => {
71
71
  },
72
72
  };
73
73
 
74
- saveConfig(newConfig);
74
+ await saveConfig(newConfig);
75
75
  };
76
76
 
77
77
  return { saveModelChange, saveModeChange };
@@ -21,6 +21,17 @@ export interface AiCompletionCell {
21
21
 
22
22
  export const aiCompletionCellAtom = atom<AiCompletionCell | null>(null);
23
23
 
24
+ /**
25
+ * A prompt queued to be delivered to the AI assistant panel.
26
+ * The active panel consumes this on mount/when ready, then clears it.
27
+ */
28
+ export interface PendingAiPrompt {
29
+ prompt: string;
30
+ submit: boolean;
31
+ }
32
+
33
+ export const pendingAiPromptAtom = atom<PendingAiPrompt | null>(null);
34
+
24
35
  const INCLUDE_OTHER_CELLS_KEY = "marimo:ai:includeOtherCells";
25
36
  export const includeOtherCellsAtom = atomWithStorage<boolean>(
26
37
  INCLUDE_OTHER_CELLS_KEY,
@@ -0,0 +1,94 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+
3
+ import { EditorState } from "@codemirror/state";
4
+ import { EditorView, type Tooltip } from "@codemirror/view";
5
+ import { describe, expect, it } from "vitest";
6
+ import {
7
+ asSignatureHint,
8
+ setSignatureHintEffect,
9
+ signatureHintField,
10
+ } from "../signature-hint";
11
+
12
+ function fakeTooltip(pos: number): Tooltip {
13
+ return {
14
+ pos,
15
+ above: true,
16
+ create: () => ({ dom: document.createElement("div") }),
17
+ };
18
+ }
19
+
20
+ function stateWithHint(doc: string, pos: number): EditorState {
21
+ const state = EditorState.create({
22
+ doc,
23
+ extensions: [signatureHintField],
24
+ });
25
+ return state.update({ effects: setSignatureHintEffect.of(fakeTooltip(pos)) })
26
+ .state;
27
+ }
28
+
29
+ describe("signatureHintField", () => {
30
+ it("starts empty", () => {
31
+ const state = EditorState.create({ extensions: [signatureHintField] });
32
+ expect(state.field(signatureHintField)).toBeNull();
33
+ });
34
+
35
+ it("shows a tooltip when the effect is dispatched", () => {
36
+ const state = stateWithHint("plt.plot(", 9);
37
+ expect(state.field(signatureHintField)?.pos).toBe(9);
38
+ });
39
+
40
+ it("clears the tooltip when the effect dispatches null", () => {
41
+ let state = stateWithHint("plt.plot(", 9);
42
+ state = state.update({
43
+ effects: setSignatureHintEffect.of(null),
44
+ }).state;
45
+ expect(state.field(signatureHintField)).toBeNull();
46
+ });
47
+
48
+ it("dismisses the tooltip on a selection-only change", () => {
49
+ let state = stateWithHint("plt.plot(x)", 9);
50
+ state = state.update({ selection: { anchor: 0 } }).state;
51
+ expect(state.field(signatureHintField)).toBeNull();
52
+ });
53
+
54
+ it("keeps and re-anchors the tooltip across edits", () => {
55
+ let state = stateWithHint("plt.plot(", 9);
56
+ // Insert before the tooltip position; it should shift to stay anchored.
57
+ state = state.update({ changes: { from: 0, insert: "xy" } }).state;
58
+ expect(state.field(signatureHintField)?.pos).toBe(11);
59
+ });
60
+ });
61
+
62
+ describe("asSignatureHint", () => {
63
+ it("nests the content so descendant styling applies", () => {
64
+ const content = document.createElement("span");
65
+ content.classList.add("mo-cm-tooltip", "docs-documentation");
66
+ const base: Tooltip = {
67
+ pos: 0,
68
+ create: () => ({ dom: content, resize: false }),
69
+ };
70
+
71
+ const view = new EditorView({ state: EditorState.create({}) });
72
+ const { dom } = asSignatureHint(base).create(view);
73
+
74
+ // Outer wrapper carries the tooltip sizing class...
75
+ expect(dom.classList.contains("mo-cm-tooltip")).toBe(true);
76
+ // ...and the documentation content is a descendant (not the same node),
77
+ // so `.cm-tooltip .docs-documentation` padding/font rules match.
78
+ expect(dom).not.toBe(content);
79
+ expect(dom.querySelector(".docs-documentation")).toBe(content);
80
+
81
+ view.destroy();
82
+ });
83
+
84
+ it("preserves other tooltip fields", () => {
85
+ const base: Tooltip = {
86
+ pos: 5,
87
+ above: true,
88
+ create: () => ({ dom: document.createElement("span"), resize: false }),
89
+ };
90
+ const wrapped = asSignatureHint(base);
91
+ expect(wrapped.pos).toBe(5);
92
+ expect(wrapped.above).toBe(true);
93
+ });
94
+ });
@@ -9,6 +9,7 @@ import { documentationAtom } from "@/core/documentation/state";
9
9
  import { store } from "@/core/state/jotai";
10
10
  import { Logger } from "../../../utils/Logger";
11
11
  import { AUTOCOMPLETER, Autocompleter } from "./Autocompleter";
12
+ import { asSignatureHint, setSignatureHintEffect } from "./signature-hint";
12
13
 
13
14
  /**
14
15
  * Completion source for Python, using Jedi.
@@ -36,10 +37,12 @@ export const pythonCompletionSource: CompletionSource = async (
36
37
  cellId: cellId,
37
38
  });
38
39
  if (!result) {
40
+ context.view?.dispatch({ effects: setSignatureHintEffect.of(null) });
39
41
  return null;
40
42
  }
41
43
 
42
- // If it is a tooltip, show it as a Tooltip instead of a completion
44
+ // If it is a tooltip (e.g. a signature after `(` or `,`), show it as a
45
+ // Tooltip instead of a completion.
43
46
  const tooltip = Autocompleter.asHoverTooltip({
44
47
  position: context.pos,
45
48
  message: result,
@@ -50,6 +53,14 @@ export const pythonCompletionSource: CompletionSource = async (
50
53
  documentation: tooltip.html ?? null,
51
54
  });
52
55
  }
56
+ // Surface the signature as a floating hint near the cursor (the LSP path has
57
+ // its own signature help), and clear any stale hint when we instead have a
58
+ // real completion list.
59
+ context.view?.dispatch({
60
+ effects: setSignatureHintEffect.of(
61
+ tooltip ? asSignatureHint(tooltip) : null,
62
+ ),
63
+ });
53
64
  if (tooltip) {
54
65
  return null;
55
66
  }
@@ -0,0 +1,68 @@
1
+ /* Copyright 2026 Marimo. All rights reserved. */
2
+ import { StateEffect, StateField } from "@codemirror/state";
3
+ import { showTooltip, type Tooltip } from "@codemirror/view";
4
+
5
+ /**
6
+ * Effect to set (or clear, with `null`) the floating signature hint.
7
+ */
8
+ export const setSignatureHintEffect = StateEffect.define<Tooltip | null>();
9
+
10
+ /**
11
+ * Wrap a tooltip so it renders like the completion popup's info box.
12
+ *
13
+ * CodeMirror adds `cm-tooltip` directly to the DOM node returned by `create`,
14
+ * so the documentation content ends up on the same element as `cm-tooltip`.
15
+ * Our styling for padding/font (`.cm-tooltip .docs-documentation`) is a
16
+ * descendant selector, so we nest the content one level deeper to make it
17
+ * apply — mirroring how CodeMirror nests completion info inside its own
18
+ * wrapper. The outer `mo-cm-tooltip` class picks up the shared tooltip sizing.
19
+ */
20
+ export function asSignatureHint(tooltip: Tooltip): Tooltip {
21
+ return {
22
+ ...tooltip,
23
+ create: (view) => {
24
+ const { dom: content, ...rest } = tooltip.create(view);
25
+ const dom = document.createElement("div");
26
+ dom.classList.add("mo-cm-tooltip");
27
+ dom.append(content);
28
+ return { ...rest, dom };
29
+ },
30
+ };
31
+ }
32
+
33
+ /**
34
+ * Holds the floating "signature hint" shown after typing `(` or `,` inside a
35
+ * call on the non-LSP (Jedi) completion path.
36
+ *
37
+ * The LSP path has its own signature help; this fills the gap for users
38
+ * without a language server. The completion source (`pythonCompletionSource`)
39
+ * drives it: it dispatches `setSignatureHintEffect` with the tooltip when the
40
+ * backend returns a signature and with `null` otherwise. The hint is also
41
+ * cleared when the cursor moves via a selection-only change (e.g. clicking
42
+ * away or arrowing out of the call), and kept anchored across edits so it
43
+ * doesn't flicker while a fresh result is in flight.
44
+ */
45
+ export const signatureHintField = StateField.define<Tooltip | null>({
46
+ create: () => null,
47
+ update(tooltip, tr) {
48
+ for (const effect of tr.effects) {
49
+ if (effect.is(setSignatureHintEffect)) {
50
+ return effect.value;
51
+ }
52
+ }
53
+ if (!tooltip) {
54
+ return null;
55
+ }
56
+ // Cursor moved without editing (click / arrow key): dismiss the hint.
57
+ if (tr.selection && !tr.docChanged) {
58
+ return null;
59
+ }
60
+ // Keep the hint anchored across edits; the completion source refreshes or
61
+ // clears it as new results arrive.
62
+ if (tr.docChanged) {
63
+ return { ...tooltip, pos: tr.changes.mapPos(tooltip.pos) };
64
+ }
65
+ return tooltip;
66
+ },
67
+ provide: (field) => showTooltip.from(field),
68
+ });
@@ -31,6 +31,7 @@ import { Logger } from "@/utils/Logger";
31
31
  import { once } from "@/utils/once";
32
32
  import { cellActionsState } from "../../cells/state";
33
33
  import { pythonCompletionSource } from "../../completion/completer";
34
+ import { signatureHintField } from "../../completion/signature-hint";
34
35
  import type { PlaceholderType } from "../../config/types";
35
36
  import { FederatedLanguageServerClient } from "../../lsp/federated-lsp";
36
37
  import { createLspMarkdownRenderer } from "../../lsp/markdown-renderer";
@@ -376,10 +377,15 @@ export class PythonLanguageAdapter implements LanguageAdapter<{}> {
376
377
  ];
377
378
  }
378
379
 
379
- return autocompletion({
380
- ...autocompleteOptions,
381
- override: [pythonCompletionSource],
382
- });
380
+ return [
381
+ autocompletion({
382
+ ...autocompleteOptions,
383
+ override: [pythonCompletionSource],
384
+ }),
385
+ // The Jedi path has no built-in signature help; show a floating hint
386
+ // fed by `pythonCompletionSource` (the LSP path handles this itself).
387
+ signatureHintField,
388
+ ];
383
389
  };
384
390
 
385
391
  return [
@@ -2,6 +2,7 @@
2
2
  import type { EditorState, Transaction } from "@codemirror/state";
3
3
  import type { EditorView, ViewUpdate } from "@codemirror/view";
4
4
  import { getCM } from "@replit/codemirror-vim";
5
+ import type { ReactCodeMirrorRef } from "@uiw/react-codemirror";
5
6
 
6
7
  export function isAtStartOfEditor(ev: { state: EditorState }) {
7
8
  const main = ev.state.selection.main;
@@ -37,6 +38,20 @@ export function moveToEndOfEditor(ev: EditorView | undefined) {
37
38
  });
38
39
  }
39
40
 
41
+ /** We delay the focus and move to end of the editor until React has rendered the prefilled value. */
42
+ export function focusInputAndMoveToEnd(
43
+ ref: React.RefObject<ReactCodeMirrorRef | null>,
44
+ ) {
45
+ requestAnimationFrame(() => {
46
+ const view = ref.current?.view;
47
+ if (!view) {
48
+ return;
49
+ }
50
+ view.focus();
51
+ moveToEndOfEditor(view);
52
+ });
53
+ }
54
+
40
55
  export function isInVimMode(ev: EditorView): boolean {
41
56
  return getCM(ev)?.state.vim != null;
42
57
  }
@@ -13,6 +13,7 @@ import { AppHeader } from "@/components/editor/header/app-header";
13
13
  import { FilenameForm } from "@/components/editor/header/filename-form";
14
14
  import { MultiCellActionToolbar } from "@/components/editor/navigation/multi-cell-action-toolbar";
15
15
  import { ViewerBanner } from "@/components/editor/viewer-banner";
16
+ import { ProgressiveBoundary } from "@/components/lifecycle/ProgressiveBoundary";
16
17
  import { cn } from "@/utils/cn";
17
18
  import { Paths } from "@/utils/paths";
18
19
  import { AppContainer } from "../components/editor/app-container";
@@ -64,7 +65,6 @@ export const EditApp: React.FC<AppProps> = ({
64
65
  useCellActions();
65
66
  const viewState = useAtomValue(viewStateAtom);
66
67
  const numColumns = useAtomValue(numColumnsAtom);
67
- const hasCells = useAtomValue(hasCellsAtom);
68
68
  const filename = useFilename();
69
69
  const setLastSavedNotebook = useSetAtom(lastSavedNotebookAtom);
70
70
  const { sendComponentValues, sendInterrupt } = useRequestClient();
@@ -181,13 +181,16 @@ export const EditApp: React.FC<AppProps> = ({
181
181
 
182
182
  <ViewerBanner />
183
183
 
184
- {/* Don't render until we have a single cell */}
185
- {hasCells && (
184
+ {/* Don't render until we have a single cell. NotStartedConnectionAlert
185
+ still covers the "no remote runtime started" prompt. */}
186
+ <ProgressiveBoundary
187
+ requires={hasCellsAtom}
188
+ fallback={<NotStartedConnectionAlert />}
189
+ >
186
190
  <CellsRenderer appConfig={appConfig} mode={viewState.mode}>
187
191
  {editableCellsArray}
188
192
  </CellsRenderer>
189
- )}
190
- {!hasCells && <NotStartedConnectionAlert />}
193
+ </ProgressiveBoundary>
191
194
  </AppContainer>
192
195
  <MultiCellActionToolbar />
193
196
  {!hideControls && (