-
Notifications
You must be signed in to change notification settings - Fork 29.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Debug Variables View does not show multiple variables from Debug Adapter when names are not unique #107506
Comments
As a workaround for now, I've started renaming the "shadowed" versions of these variables to alternate names (illegal identifiers to avoid creating more collisions) to differentiate them in the listing. |
Correct. This is currently not supported. A name must be unique inside it's container - we dedupe the names. Leaving this open as a fair feature reuqest. |
I had reported this at: #114757 (it seems I hadn't searched with the proper terms previously). If this won't be fixed, it'd be nice to document the limitation in the |
fyi @weinand for potentaily updating the doc. We might also accept PRs to update the docs |
+1 I too did not find this issue (probably only searched the open ones) and filed a dup #119136. |
Let's see what @weinand thinks |
@polinasok Yes, I will consider to document this issue in the DAP spec. In general I think that variables with identical names in the same scope (container) are problematic and users will try to avoid them because they destroy the readability of their code. So what we are discussing here is probably a rare corner case. Ideally VS Code could show them all (no deduping) in the same order they are received in the VS Code's current deduplication behavior is unfortunate because it seems that the value of the deduped variable shows the value of the first variable instead of the value of the last received value. I think this should be fixed. |
@weinand yes we could append a serial number to the variable. However the serial number would not make the id of the variable stable across steps. Thus resulting in unstable expand / collapse behavior. I would not change this. |
@isidorn with "serial number" I mean a number starting with 1 that gets appended only to the duplicated variable names. So in the example from above the four "a"s would have the unique names "a", "a:1", "a:2", "a:3". And if there is another duplicated set of "b"s they would get their own serial number starting again with 1. IDs based on these names would be as stable as all other IDs. Basically VS Code would do the "name mangling" is a similar way a compiler/transpiler would do it... |
Yes, that would improve the experience because when stepping through the example from above the value of "a" would change on each step and it would correctly reflect the value of closest "a". |
@weinand that approach for serial numbers I think makes sense. |
Actualy I went with the serial number approach. |
I already did dedupe this on the debugger, so, don't really have a repro anymore... |
@polinasok thanks for trying this out, we also tried this out with mock-debug and it seems to work just fine. What I suggest you can do as next steps:
|
@polinasok yes, the fix works for me in mock-debug and I just verified that it works for structured variables too: |
Issue Type: Bug
When I provide a DAP Variables response from my debug adapter extension with the following content, reflecting multiple local vars named
a
, only one of them is shown in the Variables view.VS Code version: Code - Insiders 1.50.0-insider (ddc98c3, 2020-09-25T05:35:02.163Z)
OS version: Windows_NT x64 10.0.18363
System Info
flash_3d: enabled
flash_stage3d: enabled
flash_stage3d_baseline: enabled
gpu_compositing: enabled
multiple_raster_threads: enabled_on
oop_rasterization: disabled_off
opengl: enabled_on
protected_video_decode: unavailable_off
rasterization: enabled
skia_renderer: disabled_off_ok
video_decode: enabled
vulkan: disabled_off
webgl: enabled
webgl2: enabled
Extensions (10)
The text was updated successfully, but these errors were encountered: