@@ -30,6 +30,7 @@ import type { CellId } from "@/core/cells/ids";
3030import { insertDebuggerAtLine } from "@/core/codemirror/editing/debugging" ;
3131import { aiEnabledAtom } from "@/core/config/config" ;
3232import { getRequestClient } from "@/core/network/requests" ;
33+ import { isStaticNotebook } from "@/core/static/static-state" ;
3334import { isWasm } from "@/core/wasm/utils" ;
3435import { renderHTML } from "@/plugins/core/RenderHTML" ;
3536import { copyToClipboard } from "@/utils/copy" ;
@@ -70,6 +71,17 @@ export const MarimoTracebackOutput = ({
7071 // Get last traceback info
7172 const tracebackInfo = extractAllTracebackInfo ( traceback ) ?. at ( 0 ) ;
7273
74+ // Don't show in wasm or static notebooks
75+ const showDebugger =
76+ tracebackInfo &&
77+ tracebackInfo . kind === "cell" &&
78+ ! isWasm ( ) &&
79+ ! isStaticNotebook ( ) ;
80+
81+ const showAIFix = onRefactorWithAI && aiEnabled && ! isStaticNotebook ( ) ;
82+
83+ const showSearch = ! isStaticNotebook ( ) ;
84+
7385 const handleRefactorWithAI = ( triggerImmediately : boolean ) => {
7486 onRefactorWithAI ?.( {
7587 prompt : `My code gives the following error:\n\n${ lastTracebackLine } ` ,
@@ -104,14 +116,14 @@ export const MarimoTracebackOutput = ({
104116 </ AccordionItem >
105117 </ Accordion >
106118 < div className = "flex gap-2" >
107- { onRefactorWithAI && aiEnabled && (
119+ { showAIFix && (
108120 < AIFixButton
109121 tooltip = "Fix with AI"
110122 openPrompt = { ( ) => handleRefactorWithAI ( false ) }
111123 applyAutofix = { ( ) => handleRefactorWithAI ( true ) }
112124 />
113125 ) }
114- { tracebackInfo && tracebackInfo . kind === "cell" && ! isWasm ( ) && (
126+ { showDebugger && (
115127 < Tooltip content = { "Attach pdb to the exception point." } >
116128 < Button
117129 size = "xs"
@@ -125,50 +137,52 @@ export const MarimoTracebackOutput = ({
125137 </ Button >
126138 </ Tooltip >
127139 ) }
128- < DropdownMenu >
129- < DropdownMenuTrigger asChild = { true } >
130- < Button size = "xs" variant = "text" >
131- Get help
132- < ChevronDown className = "h-3 w-3 ml-1" />
133- </ Button >
134- </ DropdownMenuTrigger >
135- < DropdownMenuContent align = "end" className = "w-56" >
136- < DropdownMenuItem asChild = { true } >
137- < a
138- target = "_blank"
139- href = { `https://www.google.com/search?q=${ encodeURIComponent ( lastTracebackLine ) } ` }
140- rel = "noreferrer"
141- >
142- < SearchIcon className = "h-4 w-4 mr-2" />
143- Search on Google
144- < ExternalLinkIcon className = "h-3 w-3 ml-auto" />
145- </ a >
146- </ DropdownMenuItem >
147- < DropdownMenuItem asChild = { true } >
148- < a
149- target = "_blank"
150- href = "https://marimo.io/discord?ref=notebook"
151- rel = "noopener"
140+ { showSearch && (
141+ < DropdownMenu >
142+ < DropdownMenuTrigger asChild = { true } >
143+ < Button size = "xs" variant = "text" >
144+ Get help
145+ < ChevronDown className = "h-3 w-3 ml-1" />
146+ </ Button >
147+ </ DropdownMenuTrigger >
148+ < DropdownMenuContent align = "end" className = "w-56" >
149+ < DropdownMenuItem asChild = { true } >
150+ < a
151+ target = "_blank"
152+ href = { `https://www.google.com/search?q=${ encodeURIComponent ( lastTracebackLine ) } ` }
153+ rel = "noreferrer"
154+ >
155+ < SearchIcon className = "h-4 w-4 mr-2" />
156+ Search on Google
157+ < ExternalLinkIcon className = "h-3 w-3 ml-auto" />
158+ </ a >
159+ </ DropdownMenuItem >
160+ < DropdownMenuItem asChild = { true } >
161+ < a
162+ target = "_blank"
163+ href = "https://marimo.io/discord?ref=notebook"
164+ rel = "noopener"
165+ >
166+ < MessageCircleIcon className = "h-4 w-4 mr-2" />
167+ Ask in Discord
168+ < ExternalLinkIcon className = "h-3 w-3 ml-auto" />
169+ </ a >
170+ </ DropdownMenuItem >
171+ < DropdownMenuItem
172+ onClick = { ( ) => {
173+ // Strip HTML from the traceback
174+ const div = document . createElement ( "div" ) ;
175+ div . innerHTML = traceback ;
176+ const textContent = div . textContent || "" ;
177+ copyToClipboard ( textContent ) ;
178+ } }
152179 >
153- < MessageCircleIcon className = "h-4 w-4 mr-2" />
154- Ask in Discord
155- < ExternalLinkIcon className = "h-3 w-3 ml-auto" />
156- </ a >
157- </ DropdownMenuItem >
158- < DropdownMenuItem
159- onClick = { ( ) => {
160- // Strip HTML from the traceback
161- const div = document . createElement ( "div" ) ;
162- div . innerHTML = traceback ;
163- const textContent = div . textContent || "" ;
164- copyToClipboard ( textContent ) ;
165- } }
166- >
167- < CopyIcon className = "h-4 w-4 mr-2" />
168- Copy to clipboard
169- </ DropdownMenuItem >
170- </ DropdownMenuContent >
171- </ DropdownMenu >
180+ < CopyIcon className = "h-4 w-4 mr-2" />
181+ Copy to clipboard
182+ </ DropdownMenuItem >
183+ </ DropdownMenuContent >
184+ </ DropdownMenu >
185+ ) }
172186 </ div >
173187 </ div >
174188 ) ;
0 commit comments