-
Notifications
You must be signed in to change notification settings - Fork 752
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
Get rid of ":" (pointers related) in debugger variables window #567
Comments
@emil14 The data behind the "VARIABLES" section is a collection of Much of VS Code's debug UI design was influenced by the javascript/typescript debugging and that may not perfectly fit to Go's data model. I agree that it would be nice if VS Code handles unnamed variables more naturally or we can work around better. But this is not the top priority yet. (It doesn't break any functionality, right?) For evaluating |
@emil14 I see where you are going with the analogy that Go conveniently not forces you to use (*ptr).SomeMethod() or ptr->SomeMethod() like other languages. But in spite of this syntactic sugar, the data is still laid out in memory in a certain way, so that is what the current variable hierarchy reveals. A struct and a pointer to a struct will present differently and with a different number of layers. This is because the dereferenced struct value is a nameless child of the pointer variable. It is its own variable, which is why to get to it you end up going one level deeper. And then you have to get one more level deeper to get to the children, i.e. the fields of the struct variable. Each level issues a new variables request to load more data. I am currently working on native support for DAP requests in the delve debugger, which we are exposing through a new experimental debug adapter (see #23). As part of this work, I have been investigating how dlv prints variables vs how the vscode UI does it. I identified several cases that could be improved (some already addressed in go-delve/delve#2111, the rest in the works). So while it might not make sense to improve the way pointers are displayed in the current adapter, I can look into improving this in the new version. Let's talk through the details of what this could look like and if that even makes sense. It looks like dlv itself streamlines this case better. Given the following code:
"locals" command (which is similar to the top-level view in the Variables pane) prints the following:
while "expanding" each individual variable gives you this:
So in vscode-go this could look like
Is that the behavior you are looking for? In that case, any ideas on how we would we make the scalar case consistent while preserving the type and address info? Or would they look differently (which might be unexpected/misleading)? Currently this presents like so:
|
@polinasok thank you for detailed explanation :)
Yes, this is exactly what I want
Personally I see nothing bad about making them look differently - all I want is productivity and I'm not confused by this difference, the |
Change https://golang.org/cl/252979 mentions this issue: |
The way we represent variables in the new dlv-dap adapter has evolved since this topic was last discussed. Here is a screenshot. We still have ":", but the value is also inlined. So you will no longer need to always double expand the pointer variable to eyeball its dereferenced contents. I believe that solves the original issue. @emil14 Please confirm if that is the case. If you do expand the variable, you will still see |
@polinasok Yes, that solves the issue! Thank you for noticing me and have a nice day :) |
Hi! Thank you for the great extension :)
I have a question/request about debugger (variables) visualization. Is it necessary to have a
:
intermediate level when I explore pointers? Here's the screenshot to make things clear:Here I have to click on
data
, then click on:
and only then I can see the actual value.Go let's use write
x.someMethod()
even ifx
is ponting to something that hassomeMethod
implemented. It would be great to VSCode behave like Go in that sense. Thank you!The text was updated successfully, but these errors were encountered: