-
Notifications
You must be signed in to change notification settings - Fork 646
Wrong variable scope displayed when debugging #1974
Comments
We get the variable information from delve. Can you try running |
This is the output I get when running
|
I have a fix for this, one thing that comes to mind is if we should also display the shadowed value(s) like delve does in the variables pane. |
I would stick to just showing the non-shadowed value. |
I tend to agree however there are cases where having both values would be useful. IMO what would be ideal is if we could display the shadowed value when hovering over the shadowed variable. Can we subscribe to some event when hovering over a variable? |
Extensions dont get to subscribe to such events. When not in debugging mode, the hoverprovider implemented by the extension is called by VS Code to get the data for display. In debugging mode, whatever text is being hovered on is then looked up in the variables that the debug adapter has returned in the variablesRequest. So, as far as I know we cannot do much here. But showing the shadowed variable with () in the variable pane is something we can definitely do |
This starts to get a little unwieldy if a variable is shadowed more than once. Perhaps it would be better if we displayed the shadowed variables as children of one another, what do you think (assuming vscode don't have problems with child vars with the same name)? |
Shadowed variables are now showing inside parentheses in the latest update (0.9.0) to the Go extension. |
The debugger shows variable content from the wrong scope:
Program output:
Inner animal: cat
Outer animal: dog
Using:$Id: 1990ba12450cab9425a2ae62e6ab988725023d5c $
Delve Debugger
Version: 1.1.0
Build:
And Go Extension v 0.6.90
The text was updated successfully, but these errors were encountered: