Repository navigation
fix(desktop): improve file navigation, go to line and word wrap - #62543
colthreepv wants to merge 2 commits into
Conversation
|
Verification update for commits Automated checks
Live desktop checksExercised the development desktop app through Windows desktop automation (
Live positioning checks above were visual observations; precise geometry assertions are covered by the browser regression. No app/server restart or code changes were needed during the live checks. Before/after screenshots or a recording are still pending; this PR remains a draft. |
There was a problem hiding this comment.
This works as described for wrapped files. On the base, a link to long.txt#L100 lands about 6,850px from its line. With this change the line is centred and the range is highlighted. I checked this with the new e2e case on both checkouts and with screenshots, ran bun test src/file in gui-plugins (195 pass) and type-checked gui-plugins and session-ui with no errors. I did not test the path for virtualized files (over 500 KB).
Public API: none of the server, SDK, config or CLI changes. The new word-wrap value in the GUI plugin IconName and the optional FileSearchHandle.reveal are both additions, so existing callers keep working.
Concerns:
- The third argument of the
viewerstore is afrommigration source, not a name (see the inline comment). - A link target is never released after it lands, so later layout changes keep snapping the view back to it (inline).
- Toggling wrap reapplies a scroll offset measured under the other mode, so the view lands on a different line (inline).
- #58037 (open) also replaces the
(line - 4) * 24estimate inrenderer.tsxand adds areview.spec.tscase for wrapped files. The two overlap and will conflict; this one also handles virtualized files and adds the toggle. It would help to coordinate with that PR, or note that this one supersedes it.
The before/after screenshots below come from the e2e run. Design review of the new toolbar row is still up to the team.
Related: #58037
|
|
||
| export default Plugin.define({ | ||
| stores: { | ||
| viewer: Store.global(Schema.Struct({ wrap: Schema.Boolean }), { wrap: true }, "viewer"), |
There was a problem hiding this comment.
The third argument of Store.global is from, the older storage keys to import a value from once. It is not the store's name; the key in stores already names it (plugin.<id>.viewer). Passing "viewer" makes the host try to import from a bare app key viewer, which never shipped. packages/gui-plugins/AGENTS.md asks not to add a migration for a key that never shipped. Can the argument be dropped?
| setHasScroller(true) | ||
|
|
||
| // Wrapped virtual rows reconcile their heights after drawing. Re-measure an active link target after that layout. | ||
| const observer = new ResizeObserver(() => { |
There was a problem hiding this comment.
Once a link target has been centred, it stays active until the user presses a pointer or key, or the view hides. Until then, every resize of the content (this observer) and every scroll event (line 219) re-centres on it. The view keeps snapping back to the link long after it landed, for example when an agent edit rereads the file, a comment annotation opens, or the panel is resized by dragging its handle (that pointerdown is outside the scroller). Could the target be released once a measurement lands on the same position again, or after the first rendered pass of a virtualized file, rather than staying active indefinitely?
| aria-pressed={ctx.stores.viewer.value.wrap} | ||
| icon={<Icon name="word-wrap" size="normal" />} | ||
| onClick={() => { | ||
| scrollSync.interacted() |
There was a problem hiding this comment.
interacted() clears the target, and the keyed Show then recreates the viewer. Its onRendered restores the saved y, which is a pixel offset measured with the other wrap mode. Wrapped and unwrapped rows differ a lot in height, so toggling wrap moves you to a different part of the file. Could you record the top visible line before the toggle and reveal it after the remount, instead of restoring the old pixel offset?


Issue for this PR
Closes #13430
Closes #16781
Both were auto-closed for inactivity. File links now open successfully, but their line destinations still need accurate scrolling; the file-viewer wrap toggle requested in #16781 is also missing.
Type of change
What does this PR do?
The toggle uses the real viewer's wrap/scroll options. Recreating the code component on a wrap change avoids stale virtual-row measurements. The Codicons artwork includes CC BY 4.0 attribution.
No feature flag: this is a navigation correction and an explicit opt-in control for an existing rendering option; default wrapping stays unchanged. The new toolbar affordance is included here for design review while this PR is a draft.
How did you verify your code works?
bun run checkpassed (existing repository warnings remain).bun run lint:changedpassed.Visual
Screenshots / recordings
Before/after captures are still to be attached before marking this draft ready for review.
Checklist
Added by the opencode bot (AI-generated).
Related: #58037