Skip to content

Commit 5629199

Browse files
roomote[bot]Roo Coderoomotedaniel-lxs
authored
Add jump icon for newly created files (#5738)
* feat: add jump icon for newly created files - Add jump icon to newFileCreated tool case in ChatRow.tsx - Matches existing pattern from readFile case for consistent UX - Allows users to quickly open newly created files - Fixes issue #5736 * 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 * fix: address PR feedback for jump icon on new files - Fix openFile message to use correct path format with './' prefix - Remove duplicate chevron icon when jump icon is present - Add aria-label for accessibility - Fix styling: use mr-1 to match progressStatus icon - Remove redundant margin style from jump icon --------- Co-authored-by: Roo Code <[email protected]> Co-authored-by: Roo Code <[email protected]> Co-authored-by: Daniel Riccio <[email protected]>
1 parent 984d368 commit 5629199

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -533,6 +533,7 @@ export const ChatRowContent = ({
533533
isLoading={message.partial}
534534
isExpanded={isExpanded}
535535
onToggleExpand={handleToggleExpand}
536+
onJumpToFile={() => vscode.postMessage({ type: "openFile", text: "./" + tool.path })}
536537
/>
537538
</>
538539
)

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

Lines changed: 14 additions & 1 deletion
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,7 +70,18 @@ const CodeAccordian = ({
6870
</span>
6971
</>
7072
)}
71-
<span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>
73+
{onJumpToFile && path && (
74+
<span
75+
className="codicon codicon-link-external mr-1"
76+
style={{ fontSize: 13.5 }}
77+
onClick={(e) => {
78+
e.stopPropagation()
79+
onJumpToFile()
80+
}}
81+
aria-label={`Open file: ${path}`}
82+
/>
83+
)}
84+
{!onJumpToFile && <span className={`codicon codicon-chevron-${isExpanded ? "up" : "down"}`}></span>}
7285
</ToolUseBlockHeader>
7386
)}
7487
{(!hasHeader || isExpanded) && (

0 commit comments

Comments
 (0)