-
Notifications
You must be signed in to change notification settings - Fork 646
Fix display of shadowed variables while debugging #2254
Conversation
Ensure that shadowed variables have a unique name so they are properly displayed in the variables pane. Each nested scope will enclose the variable name in a pair of parentheses.
Fixes #1974 |
src/debugAdapter/goDebug.ts
Outdated
VariableArgument = 8, | ||
VariableReturnArgument = 16 | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The comment below about https://github.com/derekparker/delve/blob/master/service/api/types.go applies to the above as well. Also, since this is related to variables, can we move the above enum to appear either just before or right after the interface DebugVariable
?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also, am just curious... from where are we getting these values of 1,2,4,8? I understand these refer to the the bits at different positions being 1. But where or how does delve define these?
But I dont see how each of them got the value of 1,2,4 etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've relocated GoVariableFlags
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So the operation iota = 1 << iota
gets repeated for each line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Correct, for the entirety of the const
block. In a new const
block iota
is reset to zero.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thats so cool
@@ -149,6 +157,8 @@ interface DebugVariable { | |||
type: string; | |||
realType: string; | |||
kind: GoReflectKind; | |||
flags: GoVariableFlags; | |||
DeclLine: number; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Its weird that this doesnt have struct tag at https://github.com/go-delve/delve/blame/4c9a72e486f1f0d0c90ecede8415a871dced8117/service/api/types.go#L264 to change it to camelcasing.
Should we log a bug for delve?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I thought it odd as well. We could open an issue however given that JSON is case-sensitive it would be a breaking change for consumers.
Do you know if something changed with |
If I run
The warning messages as expected by the test are included in the output however it appears that there's a bunch of extra preceding output which I suspect is the root problem. Have you seen this before? |
The error is coming from a dependent tool |
I think we should switch to using the latest stable version of |
Ensure that shadowed variables have a unique name so they are properly
displayed in the variables pane. Each nested scope will enclose the
variable name in a pair of parentheses.