Skip to content

feat(agent-manager): jump to changed line when clicking line number in diff#8866

Merged
marius-kilocode merged 2 commits intoKilo-Org:mainfrom
Githubguy132010:fix/jump-to-diff-line
Apr 14, 2026
Merged

feat(agent-manager): jump to changed line when clicking line number in diff#8866
marius-kilocode merged 2 commits intoKilo-Org:mainfrom
Githubguy132010:fix/jump-to-diff-line

Conversation

@Githubguy132010
Copy link
Copy Markdown
Contributor

Context

Fixes #6076 — when clicking on a diff in the agent chat/review panel, the file should open with focus at the start of the changed lines instead of always at line 1.

Implementation

The @pierre/diffs library already exposes an onLineNumberClick callback on FileDiff that fires when a user clicks a line number, providing lineNumber and annotationSide. The extension backend (openWorktreeFile) and message protocol (OpenFileIn, GenericOpenFileIn) already supported an optional line parameter — the wire was all there, just never connected.

Changes:

  • DiffPanel.tsx / FullScreenDiffView.tsx: Extended the onOpenFile prop to accept an optional line parameter. Added onLineNumberClick to each <Diff> component — when a line number on the additions (or context) side is clicked, it calls onOpenFile(file, lineNumber). Deletion-side line numbers are skipped since they reference the old file version.
  • AgentManagerApp.tsx: Updated both onOpenFile callbacks to forward the line argument in the postMessage payload.
  • packages/ui/src/pierre/index.ts: Changed the cursor on interactive line number columns from default to pointer, giving users a visual affordance that line numbers are clickable.

Screenshots

before after
File opens at line 1 File opens at the clicked diff line

How to Test

  1. Start a Kilo session and let it make edits to a file
  2. Open the diff review panel (side panel or full-screen)
  3. Click a line number (the numbered column on the left) in any diff hunk
  4. The file should open in the editor with the cursor positioned at that exact line

Get in Touch

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: d0705297ea

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +599 to +601
onLineNumberClick={(event) => {
if (event.annotationSide === "deletions") return
props.onOpenFile?.(diff.file, event.lineNumber)
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve clicked line when forwarding diff line-number opens

This callback now emits event.lineNumber, but one of its consumers (webview-ui/diff-viewer/DiffViewerApp.tsx, onOpenFile at lines 67-68) still posts only filePath, so line-number clicks in the standalone Changes viewer continue opening at line 1 instead of the clicked line. Because FullScreenDiffView is shared, this change introduces inconsistent behavior between Agent Manager and Diff Viewer for the same interaction.

Useful? React with 👍 / 👎.

@kilo-code-bot
Copy link
Copy Markdown
Contributor

kilo-code-bot bot commented Apr 13, 2026

Code Review Summary

Status: 2 Issues Found | Recommendation: Address before merge

Overview

Severity Count
CRITICAL 0
WARNING 2
SUGGESTION 0

Fix these issues in Kilo Cloud

Issue Details (click to expand)

WARNING

File Line Issue
packages/kilo-vscode/webview-ui/agent-manager/FullScreenDiffView.tsx 601 FullScreenDiffView is shared by the standalone Changes viewer, but DiffViewerApp still drops the forwarded line, so line-number clicks there continue opening at line 1.
Other Observations (not in diff)

Issues found in unchanged code that cannot receive inline comments:

File Line Issue
packages/kilo-vscode/webview-ui/diff-viewer/DiffViewerApp.tsx 68 Underlying cause of the FullScreenDiffView warning above: the openFile message still omits line, so the standalone Changes viewer loses the clicked line number.
script/version.ts 26 If bunx changeset version fails, the workflow only logs a warning and then falls back to the committed top section of packages/kilo-vscode/CHANGELOG.md (currently 7.2.1), which would publish stale release notes for the new tag.
Files Reviewed (35 files)
  • .changeset/README.md - 0 issues
  • .changeset/config.json - 0 issues
  • .changeset/opencode-1310.md - 0 issues
  • .changeset/opencode-136.md - 0 issues
  • .changeset/opencode-137.md - 0 issues
  • .changeset/subsession-costs.md - 0 issues
  • .github/workflows/publish.yml - 0 issues
  • nix/hashes.json - 0 issues
  • package.json - 0 issues
  • packages/app/package.json - 0 issues
  • packages/desktop/package.json - 0 issues
  • packages/desktop-electron/package.json - 0 issues
  • packages/extensions/zed/extension.toml - 0 issues
  • packages/kilo-docs/package.json - 0 issues
  • packages/kilo-docs/pages/contributing/architecture/index.md - 0 issues
  • packages/kilo-gateway/package.json - 0 issues
  • packages/kilo-i18n/package.json - 0 issues
  • packages/kilo-telemetry/package.json - 0 issues
  • packages/kilo-ui/package.json - 0 issues
  • packages/kilo-vscode/package.json - 0 issues
  • packages/opencode/CHANGELOG.md - 0 issues
  • packages/opencode/package.json - 0 issues
  • packages/plugin/package.json - 0 issues
  • packages/script/package.json - 0 issues
  • packages/sdk/js/package.json - 0 issues
  • packages/sdk/js/src/v2/gen/types.gen.ts - 0 issues
  • packages/storybook/package.json - 0 issues
  • packages/ui/package.json - 0 issues
  • packages/util/package.json - 0 issues
  • script/changelog-github.cjs - 0 issues
  • script/upstream/package.json - 0 issues
  • script/upstream/transforms/transform-package-json.ts - 0 issues
  • script/version.ts - 1 issue
  • sdks/vscode/package.json - 0 issues
  • packages/kilo-vscode/webview-ui/agent-manager/FullScreenDiffView.tsx - 1 carried issue

Reviewed by gpt-5.4-20260305 · 1,636,352 tokens

@marius-kilocode
Copy link
Copy Markdown
Collaborator

Looks like changes got mixed into the PR @Githubguy132010

Githubguy132010 and others added 2 commits April 14, 2026 05:24
…n diff

When clicking a line number in the diff review panel (DiffPanel or
FullScreenDiffView), open the file in the editor at that exact line
instead of always landing on line 1.

Closes Kilo-Org#6076

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@Githubguy132010
Copy link
Copy Markdown
Contributor Author

Looks like changes got mixed into the PR @Githubguy132010

Fixed it

@marius-kilocode marius-kilocode merged commit 6290c11 into Kilo-Org:main Apr 14, 2026
14 checks passed
@marius-kilocode
Copy link
Copy Markdown
Collaborator

@Githubguy132010 nice work. At some point we can maybe follow up with a tooltip. Maybe even 2 one for the plus icon hovering and one for the line number hovering.

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[FEATURE]: Jump to changed lines from diff

2 participants