fix(chat): scroll to target lines in file references - #1349
Merged
Merged
Conversation
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.
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.
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.
Summary
This is a current-main successor to #1149. It completes the contributor's
path:lineflow 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
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— currentorigin/mainis an ancestor of this head.git diff --check— passed.