Skip to content

File links with line ranges in agent replies don't jump to correct lines when opened #215

@bobleer

Description

@bobleer

Description:
When clicking on file links with line number ranges (format like filename.ts:42-50 or filename.ts#L42-L50) in agent chat replies, the file opens in the viewer but doesn't automatically scroll to or highlight the specified lines.

Steps to Reproduce:

  1. Have an agent generate a reply that includes file links with line numbers
  2. Click on such a link (e.g., [CodeEditor.tsx:924-1028](src/web-ui/src/tools/editor/components/CodeEditor.tsx#L924-L1028))
  3. Observe the file opens but stays at the top without scrolling/jumping

Expected Behavior:
The file viewer should automatically scroll to and highlight the specified line range when the file is opened via a link.

Technical Details:

  • File links are parsed in Markdown.tsx (lines 434-457) using parseLineRange()
  • The line range is passed to handleFileViewRequest() (line 474)
  • FileTabManager.ts receives jumpToRange parameter when opening files
  • CodeEditor.tsx has the jump logic in lines 924-1028, using jumpToRange prop
  • The jump effect may be firing before the file content is fully loaded or the editor is ready

Files Involved:

  • src/web-ui/src/component-library/components/Markdown/Markdown.tsx - link parsing and handling
  • src/web-ui/src/flow_chat/components/modern/useFlowChatFileActions.ts - file view request handler
  • src/web-ui/src/shared/services/FileTabManager.ts - tab management with jumpToRange
  • src/web-ui/src/tools/editor/components/CodeEditor.tsx - jump implementation (lines 924-1028)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions