Skip to content
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

Variables with names that are not unique get dropped when displayed on VARIABLES pane #119136

Closed
polinasok opened this issue Mar 16, 2021 · 2 comments

Comments

@polinasok
Copy link

polinasok commented Mar 16, 2021

  • VS Code Version: 1.54.1
  • OS Version: MacOS Big Sur

Variable responses contain name and value for each child variable. With array elements, we can stick the unique index in the name and use the value for the value. With map elements, a common approach (e.g. used by Python and Go) is to use name for key's value and value for value's value. This breaks if the display version of the key is not unique because vscode appears to be dropping variables with duplicate names.

We keep running into this issue with vscode-go. Historically, vscode-go used only the variable type as the value of the variable for structured variables plus a variable reference to load more info. But with structured map keys as names that doesn't work. Every key value ends up with the exact same name string - its type, so a map ends up with only one entry. See golang/vscode-go#1042.

I fixed this issue in the new adapter by adding a unique suffix. But now I am seeing the same issue with long strings truncated by the debugger to a non-unique prefix. Here is an example:
image
This is the response that is associated with the above image:

{
   "seq":0,
   "type":"response",
   "request_seq":14,
   "success":true,
   "command":"variables",
   "body":{
      "variables":[
         {
            "name":"\"veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery loooooooo strin...+1 more\"",
            "value":"true",
            "presentationHint":{
               
            },
            "evaluateName":"m[(*(*\"string\")(0xc0000c4008))]",
            "variablesReference":0
         },
         {
            "name":"\"veeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeery loooooooo strin...+1 more\"",
            "value":"true",
            "presentationHint":{
               
            },
            "evaluateName":"m[(*(*\"string\")(0xc0000c4018))]",
            "variablesReference":0
         },
         {
            "name":"\"short string\"",
            "value":"true",
            "presentationHint":{
               
            },
            "evaluateName":"m[\"short string\"]",
            "variablesReference":0
         }
      ]
   }
}

This doesn't seem right. Sure the users are missing out on the full info if the name is truncated or simplified, but it is still a good placeholder that gives access to the value, to evaluateName for watches and to a variableReference to expand for more info. But if the entry is missing altogether, all those benefits disappear. I think vscode should display all variables form the response as-is.

Does this issue occur when all extensions are disabled?: No

@vscodebot
Copy link

vscodebot bot commented Mar 16, 2021

(Experimental duplicate detection)
Thanks for submitting this issue. Please also check if it is already covered by an existing one, like:

@polinasok
Copy link
Author

polinasok commented Mar 16, 2021

Moving the discussion and closing in favor of the original report at #107506 although I am disappointed to see it closed without being addressed.

@github-actions github-actions bot locked and limited conversation to collaborators Apr 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant