MCPcopy
hub / github.com/marimo-team/marimo / useAddCodeToNewCell

Function useAddCodeToNewCell

frontend/src/components/editor/cell/useAddCell.ts:9–29  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

7import { autoInstantiateAtom } from "@/core/config/config";
8
9export function useAddCodeToNewCell(): (code: string) => void {
10 const autoInstantiate = useAtomValue(autoInstantiateAtom);
11 const lastFocusedCellId = useLastFocusedCellId();
12 const { createNewCell } = useCellActions();
13
14 return (code: string) => {
15 if (code.includes("alt")) {
16 maybeAddAltairImport({
17 autoInstantiate,
18 createNewCell,
19 fromCellId: lastFocusedCellId,
20 });
21 }
22
23 createNewCell({
24 code: code,
25 before: false,
26 cellId: lastFocusedCellId ?? "__end__",
27 });
28 };
29}

Callers 5

StorageEntryRowFunction · 0.90
StorageFileViewerFunction · 0.90
DatasetTableItemFunction · 0.90
DatasetColumnItemFunction · 0.90
InsertNewCellFunction · 0.90

Calls 3

useLastFocusedCellIdFunction · 0.90
useCellActionsFunction · 0.90
maybeAddAltairImportFunction · 0.90

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…