Skip to content

DAP: two source references with the same name share a document, which keeps the text of the first #2196

Done

Description

@lagergren

What happens

Two sources that a debug adapter gives by source reference (sourceReference > 0, with text from the source request) share one document in the IDE when they have the same name. The document keeps the text of the first one. A stack frame, or a jump to a location, in the second source then shows the first source's text, at the second source's line.

For example, generated or eval'd scripts often share a name such as <anonymous>, or one name per kind of generated file.

Cause

Expected

Each source reference shows its own text. For example:

  • key the files by name and source reference, as VS Code does with its debug: URIs, which carry the session and the reference; or
  • when a load answers another text for a read-only document, replace the text (make it writable for the write, then read-only again).

The first changes which editor tab a source opens in; the second keeps one tab per name but refreshes its text.

Notes

#2182 makes Jump to Value Source and Jump to Source refuse a position whose document doesn't hold the answered text, so they no longer open the wrong text. Stack frames and the disassembly still show it.

Test

A session test with a fake debug adapter: two stack frames in different source references with the same name and different texts. Each frame's editor shows its own text.

Activity

  1. added this to the 0.30.2 milestone on Nov 24, 2026
  2. added
    bug
    dap
    on Nov 24, 2026
  3. added a commit that references this issue on Nov 25, 2026
    57bae55
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

    bugdap

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions