@@ -12,10 +12,12 @@ import { useCopyToClipboard } from "@src/utils/clipboard"
1212import { useExtensionState } from "@src/context/ExtensionStateContext"
1313import { findMatchingResourceOrTemplate } from "@src/utils/mcp"
1414import { vscode } from "@src/utils/vscode"
15+ import { removeLeadingNonAlphanumeric } from "@src/utils/removeLeadingNonAlphanumeric"
1516import { Button } from "@src/components/ui"
1617
17- import CodeAccordian , { removeLeadingNonAlphanumeric } from "../common/CodeAccordian"
18- import CodeBlock , { CODE_BLOCK_BG_COLOR } from "../common/CodeBlock"
18+ import { ToolUseBlock , ToolUseBlockHeader } from "../common/ToolUseBlock"
19+ import CodeAccordian from "../common/CodeAccordian"
20+ import CodeBlock from "../common/CodeBlock"
1921import MarkdownBlock from "../common/MarkdownBlock"
2022import { ReasoningBlock } from "./ReasoningBlock"
2123import Thumbnails from "../common/Thumbnails"
@@ -287,10 +289,11 @@ export const ChatRowContent = ({
287289 </ span >
288290 </ div >
289291 < CodeAccordian
292+ path = { tool . path }
293+ code = { tool . content ?? tool . diff }
294+ language = { tool . tool === "appliedDiff" ? "diff" : undefined }
290295 progressStatus = { message . progressStatus }
291296 isLoading = { message . partial }
292- diff = { tool . diff ! }
293- path = { tool . path ! }
294297 isExpanded = { isExpanded }
295298 onToggleExpand = { onToggleExpand }
296299 />
@@ -312,10 +315,11 @@ export const ChatRowContent = ({
312315 </ span >
313316 </ div >
314317 < CodeAccordian
318+ path = { tool . path }
319+ code = { tool . diff }
320+ language = "diff"
315321 progressStatus = { message . progressStatus }
316322 isLoading = { message . partial }
317- diff = { tool . diff ! }
318- path = { tool . path ! }
319323 isExpanded = { isExpanded }
320324 onToggleExpand = { onToggleExpand }
321325 />
@@ -333,10 +337,10 @@ export const ChatRowContent = ({
333337 </ span >
334338 </ div >
335339 < CodeAccordian
340+ path = { tool . path }
341+ code = { tool . diff }
336342 progressStatus = { message . progressStatus }
337343 isLoading = { message . partial }
338- diff = { tool . diff ! }
339- path = { tool . path ! }
340344 isExpanded = { isExpanded }
341345 onToggleExpand = { onToggleExpand }
342346 />
@@ -350,9 +354,9 @@ export const ChatRowContent = ({
350354 < span style = { { fontWeight : "bold" } } > { t ( "chat:fileOperations.wantsToCreate" ) } </ span >
351355 </ div >
352356 < CodeAccordian
357+ path = { tool . path }
358+ code = { tool . content }
353359 isLoading = { message . partial }
354- code = { tool . content ! }
355- path = { tool . path ! }
356360 isExpanded = { isExpanded }
357361 onToggleExpand = { onToggleExpand }
358362 />
@@ -371,47 +375,21 @@ export const ChatRowContent = ({
371375 : t ( "chat:fileOperations.didRead" ) }
372376 </ span >
373377 </ div >
374- < div
375- style = { {
376- borderRadius : 3 ,
377- backgroundColor : CODE_BLOCK_BG_COLOR ,
378- overflow : "hidden" ,
379- border : "1px solid var(--vscode-editorGroup-border)" ,
380- } } >
381- < div
382- style = { {
383- color : "var(--vscode-descriptionForeground)" ,
384- display : "flex" ,
385- alignItems : "center" ,
386- padding : "9px 10px" ,
387- cursor : "pointer" ,
388- userSelect : "none" ,
389- WebkitUserSelect : "none" ,
390- MozUserSelect : "none" ,
391- msUserSelect : "none" ,
392- } }
393- onClick = { ( ) => {
394- vscode . postMessage ( { type : "openFile" , text : tool . content } )
395- } } >
378+ < ToolUseBlock >
379+ < ToolUseBlockHeader
380+ onClick = { ( ) => vscode . postMessage ( { type : "openFile" , text : tool . content } ) } >
396381 { tool . path ?. startsWith ( "." ) && < span > .</ span > }
397- < span
398- style = { {
399- whiteSpace : "nowrap" ,
400- overflow : "hidden" ,
401- textOverflow : "ellipsis" ,
402- marginRight : "8px" ,
403- direction : "rtl" ,
404- textAlign : "left" ,
405- } } >
382+ < span className = "whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl" >
406383 { removeLeadingNonAlphanumeric ( tool . path ?? "" ) + "\u200E" }
407384 { tool . reason }
408385 </ span >
409386 < div style = { { flexGrow : 1 } } > </ div >
410387 < span
411388 className = { `codicon codicon-link-external` }
412- style = { { fontSize : 13.5 , margin : "1px 0" } } > </ span >
413- </ div >
414- </ div >
389+ style = { { fontSize : 13.5 , margin : "1px 0" } }
390+ />
391+ </ ToolUseBlockHeader >
392+ </ ToolUseBlock >
415393 </ >
416394 )
417395 case "fetchInstructions" :
@@ -422,8 +400,8 @@ export const ChatRowContent = ({
422400 < span style = { { fontWeight : "bold" } } > { t ( "chat:instructions.wantsToFetch" ) } </ span >
423401 </ div >
424402 < CodeAccordian
403+ code = { tool . content }
425404 isLoading = { message . partial }
426- code = { tool . content ! }
427405 isExpanded = { isExpanded }
428406 onToggleExpand = { onToggleExpand }
429407 />
@@ -441,8 +419,8 @@ export const ChatRowContent = ({
441419 </ span >
442420 </ div >
443421 < CodeAccordian
444- code = { tool . content ! }
445- path = { tool . path ! }
422+ path = { tool . path }
423+ code = { tool . content }
446424 language = "shell-session"
447425 isExpanded = { isExpanded }
448426 onToggleExpand = { onToggleExpand }
@@ -461,8 +439,8 @@ export const ChatRowContent = ({
461439 </ span >
462440 </ div >
463441 < CodeAccordian
464- code = { tool . content ! }
465- path = { tool . path ! }
442+ path = { tool . path }
443+ code = { tool . content }
466444 language = "shell-session"
467445 isExpanded = { isExpanded }
468446 onToggleExpand = { onToggleExpand }
@@ -481,8 +459,8 @@ export const ChatRowContent = ({
481459 </ span >
482460 </ div >
483461 < CodeAccordian
484- code = { tool . content ! }
485- path = { tool . path ! }
462+ path = { tool . path }
463+ code = { tool . content }
486464 isExpanded = { isExpanded }
487465 onToggleExpand = { onToggleExpand }
488466 />
@@ -510,8 +488,8 @@ export const ChatRowContent = ({
510488 </ span >
511489 </ div >
512490 < CodeAccordian
513- code = { tool . content ! }
514491 path = { tool . path ! + ( tool . filePattern ? `/(${ tool . filePattern } )` : "" ) }
492+ code = { tool . content }
515493 language = "log"
516494 isExpanded = { isExpanded }
517495 onToggleExpand = { onToggleExpand }
@@ -881,13 +859,10 @@ export const ChatRowContent = ({
881859 case "user_feedback_diff" :
882860 const tool = safeJsonParse < ClineSayTool > ( message . text )
883861 return (
884- < div
885- style = { {
886- marginTop : - 10 ,
887- width : "100%" ,
888- } } >
862+ < div style = { { marginTop : - 10 , width : "100%" } } >
889863 < CodeAccordian
890- diff = { tool ?. diff ! }
864+ code = { tool ?. diff }
865+ language = "diff"
891866 isFeedback = { true }
892867 isExpanded = { isExpanded }
893868 onToggleExpand = { onToggleExpand }
0 commit comments