Allow hinting `DebugProtocol.Source` to prefer `path` over `sourceReference`
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 5/5
- Tiempo estimado
- Más de una semana
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Nueva funcionalidad
- Claridad
- Bastante claro
- Estado de actividad
- Estancado
- Stack tecnológico
- javascript, nodejs, typescript
- Área
- api
Línea de trabajo
Comience con la definición de DebugProtocol.Source y la regla actual de que un sourceReference positivo tiene precedencia sobre path. Resuelva la preferencia, la validación de la suma de comprobación y la semántica de fallback; después, actualice la definición del protocolo y los ejemplos para que los clientes puedan elegir de forma coherente entre una ruta editable y un snapshot de sourceReference.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
It'd be nice if a new field (e.g. preference) gets added to DebugProtocol.Source to tell clients (IDEs) that if the Source can be mapped to a file, it should open that file instead of using sourceReference. Perhaps it's even worth making this the default, especially when combined with my item of checknotes below.
Details
- It's not uncommon to end up debugging a program for which the input source has changed.
- As in, the debugger still knows the original input source that the program is currently running.
- A good example is NodeJS with JavaScript, and even TypeScript if the (loaded) source maps also contain the source.
- Currently the protocol states that a
sourceReferencebigger than 0 means that should be used, regardless ofpath.- This would either be a "breaking" change (although it won't break anything, IDEs just wouldn't show "modern" behavior).
- We can specify to only prefer
pathifchecksumsis present to validate whether it results in the correct file (contents).
- It is more user friendly in IDEs if a
Sourcecan be mapped to the actual source file, instead of a snapshot in the debugger.- The user might already have the file open, and focusing it instead of opening a cached file is preferred.
- The user can now also directly edit the file, without having to first look for the correct file based on the read-only snapshot.
- The IDE might find the right file, but maybe its contents have changed:
- We can use
checksumsto validate whether it is (the correct version of) the correct file. If not, revert tosourceReference.
- We can use
- We have the
sourcesfield but this isn't (meant as) a 1-on-1 mapping of the source itself. - Having the debug adapter only provide
pathis not enough:- If the file isn't found, the IDE has nothing to show.
- If the file changed (and
checksumsisn't present), the IDE might display an outdated (or completely wrong) file. - If
checksumsis 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 Sources with the same path but a different sourceReference/checksums (and the IDE automatically picking between showing the path file or the read-only sourceReference viewer), we can also easily allow debug adapters to differentiate different versions of the same (path-specified) file, e.g. because of hotreloading:
- Program loads
a.jswithAAAas checksum. - Debugger attaches, adapter tells the IDE about
{ path: 'a.js', sourceReference: 1, checksum: ['AAA'] }.- IDE finds the properly mapped
a.js, validates the checksum and opens it.
- IDE finds the properly mapped
- User edits file and saves it, causing the program/debugger to hotreload it one way or another.
- Let's say the new content results in
BBBas checksum.
- Let's say the new content results in
- Debug adapter tells the IDE about
{ path: 'a.js', sourceReference: 2, checksum: ['BBB'] }.- IDE finds the file again (which might still be open), sees the checksum matches the (new) content, so opens it.
- Debug adapter might tell IDE again about the previous file (ref 1, checksum
AAA).- IDE finds the file but notices the different checksum. Falls back to using the
sourceReferencewith value1.
- IDE finds the file but notices the different checksum. Falls back to using the
- Debug adapter might tell IDE again about the current file (ref 2, checksum
BBB) after it was saved, but before the hotreload.- IDE finds the file but notices the different checksum. Falls back to using the
sourceReferencewith value2.
- IDE finds the file but notices the different checksum. Falls back to using the
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.
- Lenguaje dominante
- HTML
- Estrellas
- 1.8k
- Forks
- 173
- Merge medio
- 7 d 7 h
- PR fusionados (30 d)
- 2
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de microsoft/debug-adapter-protocol
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
microsoft/debug-adapter-protocol#633 · 1 comentario ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
microsoft/debug-adapter-protocol#599 · 8 reacciones ·
-
under-discussion
Dificultad 2/5 1-3 horas Aptitud para principiantes 48/100
microsoft/debug-adapter-protocol#596 · 9 comentarios ·
Todos los issues de microsoft/debug-adapter-protocol
Issues similares
-
Bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
TulipaEnergy/TulipaEnergyModel.jl#1713 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 85/100
lbjlaq/Antigravity-Manager#3525 · 2 comentarios · 1 reacción ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
libretro/libretro-common#233 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
nasa/earthdata-varinfo#113 ·