Skip to content

fix(chat): scroll to target lines in file references - #1349

Merged
vastsa merged 9 commits into
mainfrom
codex/fix-pr1149-file-line
Oct 3, 2026
Merged

vastsa merged 9 commits into
mainfrom
codex/fix-pr1149-file-line

Conversation

@vastsa

@vastsa vastsa commented Oct 3, 2026 •

Copy link
Copy Markdown
Owner

Summary

This is a current-main successor to #1149. It completes the contributor's path:line flow by preserving line and column through every work-panel file request transition. Positioned references open in the host's existing read-only file viewer because the bundled file-manager view accepts opaque paths and has no line-navigation contract; ordinary file references continue to use the bundled view. This makes the compatibility scope explicit and keeps the referenced path unchanged.

The original contributor commits remain in history. The follow-up adds the request-state fix, sentence-punctuation parsing coverage, and an isolated Electron regression scenario. Candidate review also exposed a race where scrolling ran before React committed the fetched file; the scroll now runs after the rendered file and requested line state are available.

Validation

  • Targeted renderer tests — 90/90 passed (work-panel-tabs, work-panel, chat-links, and transcript file chips).
  • node scripts/e2e-file-ref-line-scroll.mjs — passed 3 consecutive runs on the candidate containing current main; the bundled file-manager was available and the host viewer scrolled line 65 into view while retaining column 4.
  • node docs/scripts/check-locales.mjs — 84 specification pairs verified.
  • node docs/scripts/check-docs.mjs — 553 documentation pages verified.
  • node scripts/check-pr-base-main.mjs — current origin/main is an ancestor of this head.
  • git diff --check — passed.

ZxlDragonDoctor and others added 4 commits October 3, 2026 22:10
parseFileRef still strips :line[:col] for labels, but resolvePreviewTarget keeps the position on the target. FileRefChip and useOpenChatFileRef pass it to the host file request so FilesTab can scroll to the line. Plugin-view locations stay plain paths.
Review follow-up on #1149:
- fileManagerPluginTab accepts optional { line, column } and stores them on
  WorkPanelTab (same fields the host file tab already uses).
- useOpenChatFileRef passes the chat position into that plugin tab instead of
  dropping line/column whenever the bundled file view is available.
- Stale assertions updated to the new onOpen(..., { line, column }) contract and
  to resolvePreviewTarget carrying line on path:line tokens.
Route positioned references through the file view that supports line navigation, and scroll to a scoped line marker instead of a missing global selector.
File tabs retained the parsed line and column, but the main-process requests emitted when opening, replacing, activating, or closing tabs dropped those positions. Centralize request construction so every transition carries the selected location through to the host viewer.

Positioned references use the host's existing read-only viewer because the bundled file-manager view has no line-navigation contract. Add regression coverage for request transitions, punctuation parsing, and the real isolated Electron scroll path.
Copilot AI balanced review requested due to automatic review settings October 3, 2026 14:15

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

vastsa added 5 commits October 3, 2026 22:19
Refresh the published successor branch after the GUI npm discovery fix landed so its PR candidate is based on the latest main without rewriting shared history.
The file read promise could resolve before React committed the new viewer lines. Scheduling the scroll from openFile immediately after setFile therefore missed the target intermittently. Wait for the rendered file and requested line state before scheduling the scroll, and cancel the frame on replacement or unmount.

Keep the source contract test aligned with the post-render scroll path; the isolated Electron scenario now passes repeatedly on the merged-main candidate.
The transcript file opener now carries optional line and column
positions, so the old source assertion rejects the valid route. Match
the file opener arguments while keeping the URL destination check.
@vastsa
vastsa merged commit 305b3dc into main Oct 3, 2026
4 checks passed
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.

3 participants