You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
DAP: two source references with the same name share a document, which keeps the text of the first #2196
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.
DAPSourceReferencePosition.loadAndResolveLineAsync writes the answered text only if (doc != null && doc.isWritable()). After the first load, it makes the document read-only, so every later load of a file of the same name skips the write.
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
fix: each DAP source given by reference opens in its own editor tab, …