From 08dd47528ad39d80ba0f3bb744120ff49f21b624 Mon Sep 17 00:00:00 2001 From: Shahmir Varqha Date: Tue, 30 Sep 2025 00:25:28 +0800 Subject: [PATCH 1/4] add simple auto fix button for sql cell --- .../src/components/editor/errors/auto-fix.tsx | 8 +++++++- .../editor/output/MarimoErrorOutput.tsx | 8 +++++++- .../src/core/errors/__tests__/errors.test.ts | 12 ++++++++++++ frontend/src/core/errors/errors.ts | 19 +++++++++++++++++++ 4 files changed, 45 insertions(+), 2 deletions(-) diff --git a/frontend/src/components/editor/errors/auto-fix.tsx b/frontend/src/components/editor/errors/auto-fix.tsx index 1ffc01359b2..e8e69e82455 100644 --- a/frontend/src/components/editor/errors/auto-fix.tsx +++ b/frontend/src/components/editor/errors/auto-fix.tsx @@ -1,17 +1,21 @@ /* Copyright 2024 Marimo. All rights reserved. */ +import { useSetAtom } from "jotai"; import { WrenchIcon } from "lucide-react"; import { Button } from "@/components/ui/button"; import { Tooltip } from "@/components/ui/tooltip"; +import { aiCompletionCellAtom } from "@/core/ai/state"; import { notebookAtom, useCellActions } from "@/core/cells/cells"; import type { CellId } from "@/core/cells/ids"; import { getAutoFixes } from "@/core/errors/errors"; import type { MarimoError } from "@/core/kernel/messages"; import { store } from "@/core/state/jotai"; +import { cn } from "@/utils/cn"; export const AutoFixButton = ({ errors, cellId, + className, }: { errors: MarimoError[]; cellId: CellId; @@ -19,6 +23,7 @@ export const AutoFixButton = ({ }) => { const { createNewCell } = useCellActions(); const autoFixes = errors.flatMap((error) => getAutoFixes(error)); + const setAiCompletionCell = useSetAtom(aiCompletionCellAtom); if (autoFixes.length === 0) { return null; @@ -33,7 +38,7 @@ export const AutoFixButton = ({