Skip to content

feat(chat): enable jump-to-file in regular chat diff accordions (#997)#1011

Open
TrawenCZ wants to merge 1 commit into
Zoo-Code-Org:mainfrom
TrawenCZ:feat/jump-to-file-in-regular-chat-diff
Open

feat(chat): enable jump-to-file in regular chat diff accordions (#997)#1011
TrawenCZ wants to merge 1 commit into
Zoo-Code-Org:mainfrom
TrawenCZ:feat/jump-to-file-in-regular-chat-diff

Conversation

@TrawenCZ

@TrawenCZ TrawenCZ commented Jul 24, 2026

Copy link
Copy Markdown

Related GitHub Issue

Description

Previously the jump-to-file icon in regular chat diff accordions only appeared for newFileCreated tools. Edited files (appliedDiff, editedExistingFile, searchAndReplace, etc.) and insertContent shared the same CodeAccordion but had no jump-to-file option.

This PR generalizes the existing onJumpToCreatedFile handler in ChatRow.tsx to onJumpToFile, and wires it up for every file-edit and insert-content tool that renders a CodeAccordion.

Test Procedure

  • Added a regression test in webview-ui/src/components/chat/__tests__/ChatRow.diff-actions.spec.tsx asserting that appliedDiff now renders the external-link icon and posts openFile with the correct ./ prefixed path.

Pre-Submission Checklist

  • Issue Linked: This PR is linked to an approved GitHub Issue (see "Related GitHub Issue" above).
  • Scope: My changes are focused on the linked issue (one major feature/fix per PR).
  • Self-Review: I have performed a thorough self-review of my code.
  • Testing: New and/or updated tests have been added to cover my changes (if applicable).
  • Documentation Impact: I have considered if my changes require documentation updates (see "Documentation Updates" section below).
  • Contribution Guidelines: I have read and agree to the Contributor Guidelines.

Screenshots / Videos

Previous state

2026-07-24.21-51-33.mp4

New state

2026-07-24.21-52-48.mp4

Documentation Updates

  • No documentation updates are required.

Additional Notes

None.

Get in Touch

@trawen at Discord

Summary by CodeRabbit

  • Bug Fixes
    • Improved the jump-to-file action for file-operation results so it is available for all file paths, including applied changes and inserted content.
    • Ensured selecting the action opens the correct file.

@coderabbitai

coderabbitai Bot commented Jul 24, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Chat diff previews now provide a jump-to-file action for any tool response with a path. The applied-diff case is covered by a test verifying the external-link action and its openFile message.

Changes

Jump-to-file action

Layer / File(s) Summary
Path-based jump action
webview-ui/src/components/chat/ChatRow.tsx, webview-ui/src/components/chat/__tests__/ChatRow.diff-actions.spec.tsx
The callback opens any available tool path, both diff accordion paths use it, and the applied-diff interaction is tested.

Estimated code review effort: 2 (Simple) | ~10 minutes

Suggested reviewers: taltas

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Linked Issues check ✅ Passed The changes satisfy #997 by adding jump-to-file support to edit/diff previews and covering it with a regression test.
Out of Scope Changes check ✅ Passed The patch stays focused on the diff-accordion jump-to-file feature and its test coverage.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Title check ✅ Passed The title is concise and accurately summarizes the main change: enabling jump-to-file in regular chat diff accordions.
Description check ✅ Passed The description matches the template with issue link, change summary, test procedure, checklist, screenshots, docs, notes, and contact.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
webview-ui/src/components/chat/ChatRow.tsx (1)

423-429: 🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Preserve an existing ./ path prefix.

This currently produces ././src/file.ts when tool.path is already workspace-relative with a ./ prefix. Match FileChangesPanel.tsx and normalize conditionally so the openFile payload remains canonical.

Proposed fix
 	return () => vscode.postMessage({ type: "openFile", text: "./" + tool.path })
+	return () =>
+		vscode.postMessage({
+			type: "openFile",
+			text: tool.path.startsWith("./") ? tool.path : "./" + tool.path,
+		})
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@webview-ui/src/components/chat/ChatRow.tsx` around lines 423 - 429, Update
onJumpToFile in ChatRow.tsx to preserve an existing "./" prefix instead of
always prepending another one. Normalize tool.path conditionally, matching
FileChangesPanel.tsx, so the openFile message receives a canonical
workspace-relative path.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In `@webview-ui/src/components/chat/ChatRow.tsx`:
- Around line 423-429: Update onJumpToFile in ChatRow.tsx to preserve an
existing "./" prefix instead of always prepending another one. Normalize
tool.path conditionally, matching FileChangesPanel.tsx, so the openFile message
receives a canonical workspace-relative path.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 96ba4f81-6396-46e1-89e1-2788d1f7977e

📥 Commits

Reviewing files that changed from the base of the PR and between 2634d5c and 4e3270a.

📒 Files selected for processing (2)
  • webview-ui/src/components/chat/ChatRow.tsx
  • webview-ui/src/components/chat/__tests__/ChatRow.diff-actions.spec.tsx

@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@github-actions github-actions Bot added the awaiting-review PR changes are ready and waiting for maintainer re-review label Jul 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting-review PR changes are ready and waiting for maintainer re-review

Projects

None yet

Development

Successfully merging this pull request may close these issues.

"Jump to file" indicator at diff preview

1 participant