Allow hinting DebugProtocol.Source
to prefer path
over sourceReference
#224
Labels
DebugProtocol.Source
to prefer path
over sourceReference
#224
It'd be nice if a new field (e.g.
preference
) gets added toDebugProtocol.Source
to tell clients (IDEs) that if the Source can be mapped to a file, it should open that file instead of usingsourceReference
. Perhaps it's even worth making this the default, especially when combined with my item ofchecknotes
below.Details
sourceReference
bigger than 0 means that should be used, regardless ofpath
.path
ifchecksums
is present to validate whether it results in the correct file (contents).Source
can be mapped to the actual source file, instead of a snapshot in the debugger.checksums
to validate whether it is (the correct version of) the correct file. If not, revert tosourceReference
.sources
field but this isn't (meant as) a 1-on-1 mapping of the source itself.path
is not enough:checksums
isn't present), the IDE might display an outdated (or completely wrong) file.checksums
is present, the IDE can validate whether the file (content) is correct, but not fallback to anything if it isn't.This is mostly a big quality-of-life improvement towards IDE users, as these would now prefer the actual source files over cached versions provided by the debug adapter, assuming they're the same (using
checksums
). While the file content will be the exact same, mapping to an editable source file or mapping to a read-only "debug content file" is quite a large difference.Hotreload example
Since this would still allow different
Source
s with the samepath
but a differentsourceReference
/checksums
(and the IDE automatically picking between showing thepath
file or the read-onlysourceReference
viewer), we can also easily allow debug adapters to differentiate different versions of the same (path-specified) file, e.g. because of hotreloading:a.js
withAAA
as checksum.{ path: 'a.js', sourceReference: 1, checksum: ['AAA'] }
.a.js
, validates the checksum and opens it.BBB
as checksum.{ path: 'a.js', sourceReference: 2, checksum: ['BBB'] }
.AAA
).sourceReference
with value1
.BBB
) after it was saved, but before the hotreload.sourceReference
with value2
.Of course, this hotreload example is an advanced use case this change would allow. Just the QoL improvement to open the true (editable) source file instead of a snapshot if possible is already a very nice use case this allows.
The text was updated successfully, but these errors were encountered: