Repository navigation
fix(app): scroll file links to their line in wrapped files - #58037
Open
opencode-agent[bot] wants to merge 1 commit into
Open
opencode-agent[bot] wants to merge 1 commit into
opencode-agent[bot] wants to merge 1 commit into
Conversation
The stored scroll for a file link was an estimate from a fixed 24px line height, so wrapped lines left the target far below the view. Once the file renders, measure the selected row and scroll to it. Clicking a link into an already open file also remounted the code view at the top: the reread replaced the loaded value the view was built from. Read the text through contents() so the view updates in place.
opencode-agent
Bot
requested review from
Brendonovich and
Hona
as code owners
October 22, 2026 05:29
Contributor
Author
There was a problem hiding this comment.
The change looks sound to me. I ran the new review.spec.ts case on the base, where it fails at its first step: the src/long.ts:658-659 link opens the file but the view sits around lines 262–275. With this change it passes, along with the rest of review.spec.ts (24 tests). Lines 658–659 come into view, including for the link into the already open tab. The gui-extensions typecheck, its src/file unit tests and oxlint on the changed files all pass.
The public API is unchanged. FileShared.reveal.take is internal to the file extension.
I have no blocking concerns.
4 of 6 tasks
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


Clicking a file link with a line number (e.g.
rate-limit.ts:658-659) opened the file but left the line out of view.Two causes:
(line - 4) * 24px. In a file with wrapped lines the real row sits much further down, so the view landed hundreds of lines early. The view now measures the selected row once the file renders and scrolls to it, leaving the same four lines of context. The estimate still covers the first paint. A link can mount the view, so the reveal it requests stays pending inshared.revealuntil the view takes it.Showfallback rebuilt theScrollViewand it remounted at the top. The view now reads the text throughcontents(), which updates the open view in place.Added a
review.spec.tscase covering a link into a new tab and a link into an open tab, using a file with wrapped lines. It fails ondevat the first step and passes with the fix.Not covered: files over 500 KB render virtualized, and links into those still land in the wrong place, both before and after this change. Pierre has no API that maps a line to a scroll offset for virtualized files.
Requested by: @Brendonovich (Brendan via Slack)