Skip to content

Plugin file openers drop line ranges, so Monaco opens links at the file top #2770

Closed

Description

@kongenpei

Summary

Clicking a local file link with a line or line range opens the matching file-opener plugin, but the plugin receives no location. With the built-in Monaco File Editor selected, the file therefore opens at the top instead of revealing the linked line.

The host parses and retains the line range. It drops the range only when it crosses the PluginFileOpenerProps boundary.

Versions and environment

  • bb 0.40.0, source checkout at f4bbc2fe81a9b7639ff9a7396e172bddd89109e4
  • macOS 26.3
  • Node.js 24.6.0
  • Local workspace, built-in Monaco File Editor enabled for the file extension

Steps to reproduce

  1. Enable the built-in Monaco File Editor for TypeScript files.
  2. Open a thread whose workspace contains a TypeScript file with at least 20 lines.
  3. Add or receive a Markdown link targeting line 12, for example [app.ts](/workspace/src/app.ts:12) or [app.ts](/workspace/src/app.ts#L12) with the path adjusted to the workspace.
  4. Click the link.
  5. Click a second link to another line in the same file.

Minimal automated probe at the plugin mount boundary:

pnpm exec turbo run test --filter=@bb/app --force -- --testNamePattern="renders a registered opener with parsed path and source" src/components/plugin/plugin-slot-mounts.test.tsx

Temporarily asserting that the opener receives the owner's { startLineNumber: 7, endLineNumber: 9 } makes this focused test fail deterministically in about two seconds. The temporary assertion was removed after the probe.

Expected vs actual

Expected:
{
  "lineRange": {
    "startLineNumber": 7,
    "endLineNumber": 9
  }
}

Received:
{
  "path": "notes/todo.md",
  "source": {
    "kind": "workspace",
    "environmentId": "env_1",
    "projectId": null,
    "threadId": null
  },
  "Original": [Function],
  "experimental_Original": [Function]
}

Expected: the selected file opener receives the requested location, and Monaco selects or reveals it after creating the model. A later click to another line in the same file updates the existing tab and editor position.

Actual: the plugin receives file identity only. Monaco creates the editor without a position or selection, so it opens at the file head. Reopening the same file at another line also cannot update Monaco's position.

Evidence

Observed data flow on f4bbc2fe81a9b7639ff9a7396e172bddd89109e4:

The complete investigation is included here because the originating bb thread is local-only and has no shareable URL.

What you ruled out

  • Not a Markdown parsing bug: both :12 and #L12 produce a line range.
  • Not a tab-state bug: the owner retains the initial range and updates it when the same tab is reused.
  • Not a Monaco reveal bug: the location never reaches the plugin, so Monaco has nothing to reveal.
  • No matching open or closed issue was found for Monaco line number, file opener line range, Monaco jump line, or file opener location.
  • Still reproduces at the plugin boundary on current main commit f4bbc2fe81a9b7639ff9a7396e172bddd89109e4.

Suggested priority and effort

Medium priority. It affects every line-linked file opened through any file-opener plugin. The workaround is to select BB's built-in preview or an external editor. No data is lost. Likely medium effort because the fix needs an experimental SDK field, app forwarding, Monaco initial and same-file navigation, API-map/audit documentation, and regression coverage.

Checks

  • Reproduced on current main.
  • Searched open and closed issues for the same problem.
  • Included a complete investigation and code permalinks without machine-local or personal information.

AGENT GENERATED

Activity

  1. added theissue type on Aug 31, 2026
  2. added
    plugins
    ui
    confirmed-repro
    on Aug 31, 2026
  3. bb-slop-cop commented on Aug 31, 2026

    @bb-slop-cop
    Contributor

    🚨 SLOP COP 🚨 · new-issue-autopilot

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    confirmed-repropluginsui

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions