Skip to content

Commit bafb1ef

Browse files
committed
fix: remove duplicate file path display in newFileCreated case
- Removed redundant ToolUseBlock that was showing file path twice - Added onJumpToFile prop to CodeAccordian component to support jump icon - Jump icon now appears in CodeAccordian header for newFileCreated files - Maintains consistent UX with existing file operations while avoiding duplication Fixes feedback from @daniel-lxs about duplicate elements being shown
1 parent 644db56 commit bafb1ef

File tree

2 files changed

+13
-14
lines changed

2 files changed

+13
-14
lines changed

webview-ui/src/components/chat/ChatRow.tsx

Lines changed: 1 addition & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -496,27 +496,14 @@ export const ChatRowContent = ({
496496
: t("chat:fileOperations.wantsToCreate")}
497497
</span>
498498
</div>
499-
<ToolUseBlock>
500-
<ToolUseBlockHeader
501-
onClick={() => vscode.postMessage({ type: "openFile", text: tool.path })}>
502-
{tool.path?.startsWith(".") && <span>.</span>}
503-
<span className="whitespace-nowrap overflow-hidden text-ellipsis text-left mr-2 rtl">
504-
{removeLeadingNonAlphanumeric(tool.path ?? "") + "\u200E"}
505-
</span>
506-
<div style={{ flexGrow: 1 }}></div>
507-
<span
508-
className={`codicon codicon-link-external`}
509-
style={{ fontSize: 13.5, margin: "1px 0" }}
510-
/>
511-
</ToolUseBlockHeader>
512-
</ToolUseBlock>
513499
<CodeAccordian
514500
path={tool.path}
515501
code={tool.content}
516502
language={getLanguageFromPath(tool.path || "") || "log"}
517503
isLoading={message.partial}
518504
isExpanded={isExpanded}
519505
onToggleExpand={handleToggleExpand}
506+
onJumpToFile={() => vscode.postMessage({ type: "openFile", text: tool.path })}
520507
/>
521508
</>
522509
)

webview-ui/src/components/common/CodeAccordian.tsx

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ interface CodeAccordianProps {
1717
isFeedback?: boolean
1818
onToggleExpand: () => void
1919
header?: string
20+
onJumpToFile?: () => void
2021
}
2122

2223
const CodeAccordian = ({
@@ -29,6 +30,7 @@ const CodeAccordian = ({
2930
isFeedback,
3031
onToggleExpand,
3132
header,
33+
onJumpToFile,
3234
}: CodeAccordianProps) => {
3335
const inferredLanguage = useMemo(() => language ?? (path ? getLanguageFromPath(path) : "txt"), [path, language])
3436
const source = useMemo(() => code.trim(), [code])
@@ -68,6 +70,16 @@ const CodeAccordian = ({
6870
</span>
6971
</>
7072
)}
73+
{onJumpToFile && path && (
74+
<span
75+
className="codicon codicon-link-external mr-2 cursor-pointer"
76+
style={{ fontSize: 13.5, margin: "1px 0" }}
77+
onClick={(e) => {
78+
e.stopPropagation()
79+
onJumpToFile()
80+
}}
81+
/>
82+
)}
7183
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
7284
</ToolUseBlockHeader>
7385
)}

0 commit comments

Comments
 (0)