Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions webview-ui/src/components/chat/ChatRow.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -420,8 +420,8 @@ export const ChatRowContent = ({
return (tool.content ?? tool.diff) as string | undefined
}, [tool])

const onJumpToCreatedFile = useMemo(() => {
if (!tool || tool.tool !== "newFileCreated" || !tool.path) {
const onJumpToFile = useMemo(() => {
if (!tool || !tool.path) {
return undefined
}

Expand Down Expand Up @@ -497,7 +497,7 @@ export const ChatRowContent = ({
isLoading={message.partial}
isExpanded={isExpanded}
onToggleExpand={handleToggleExpand}
onJumpToFile={onJumpToCreatedFile}
onJumpToFile={onJumpToFile}
diffStats={tool.diffStats}
/>
</div>
Expand Down Expand Up @@ -536,6 +536,7 @@ export const ChatRowContent = ({
isLoading={message.partial}
isExpanded={isExpanded}
onToggleExpand={handleToggleExpand}
onJumpToFile={onJumpToFile}
diffStats={tool.diffStats}
/>
</div>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,6 +165,30 @@ describe("ChatRow - inline diff stats and actions", () => {
})
})

it("shows jump-to-file affordance for appliedDiff", () => {
const message = createToolAskMessage({
tool: "appliedDiff",
path: "src/file.ts",
diff: "@@ -1,1 +1,1 @@\n-old\n+new\n",
diffStats: { added: 1, removed: 1 },
})

const { container } = renderChatRow(message)
const openFileIcon = container.querySelector(".codicon-link-external") as HTMLElement | null

expect(openFileIcon).toBeInTheDocument()
if (!openFileIcon) {
throw new Error("Expected external link icon for appliedDiff")
}

fireEvent.click(openFileIcon)

expect(mockPostMessage).toHaveBeenCalledWith({
type: "openFile",
text: "./src/file.ts",
})
})

it("preserves protected and outside-workspace messaging in unified branch", () => {
const outsideWorkspaceMessage = createToolAskMessage({
tool: "searchAndReplace",
Expand Down
Loading