-
Notifications
You must be signed in to change notification settings - Fork 645
Fix for #1990 #2020
Fix for #1990 #2020
Changes from 5 commits
df46bfd
804e9f2
c150757
c4748d3
ada1a11
44734f9
f347024
9b7b1ad
c2dd843
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -157,6 +157,7 @@ interface DebugVariable { | |
cap: number; | ||
children: DebugVariable[]; | ||
unreadable: string; | ||
fqn: string; | ||
} | ||
|
||
interface ListGoroutinesOut { | ||
|
@@ -808,6 +809,14 @@ class GoDebugSession extends DebugSession { | |
} | ||
const locals = this.delve.isApiV1 ? <DebugVariable[]>out : (<ListVarsOut>out).Variables; | ||
verbose('locals', locals); | ||
locals.every(local => { | ||
local.fqn = local.name; | ||
local.children.every(child => { | ||
child.fqn = local.name; | ||
return true; | ||
}); | ||
return true; | ||
}) | ||
let listLocalFunctionArgsIn = { goroutineID: this.debugState.currentGoroutine.id, frame: args.frameId }; | ||
this.delve.call<DebugVariable[] | ListFunctionArgsOut>('ListFunctionArgs', this.delve.isApiV1 ? [listLocalFunctionArgsIn] : [{ scope: listLocalFunctionArgsIn, cfg: this.delve.loadConfig }], (err, outArgs) => { | ||
if (err) { | ||
|
@@ -816,8 +825,17 @@ class GoDebugSession extends DebugSession { | |
} | ||
const args = this.delve.isApiV1 ? <DebugVariable[]>outArgs : (<ListFunctionArgsOut>outArgs).Args; | ||
verbose('functionArgs', args); | ||
args.every(local => { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I repeated this instead of creating a function because of the const and my understanding is that const variables can't be reassigned right? js noob here. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because of which |
||
local.fqn = local.name; | ||
local.children.every(child => { | ||
child.fqn = local.name; | ||
return true; | ||
}); | ||
return true; | ||
}) | ||
let vars = args.concat(locals); | ||
|
||
|
||
let scopes = new Array<Scope>(); | ||
let localVariables = { | ||
name: 'Local', | ||
|
@@ -829,8 +847,10 @@ class GoDebugSession extends DebugSession { | |
len: 0, | ||
cap: 0, | ||
children: vars, | ||
unreadable: '' | ||
unreadable: '', | ||
fqn: '', | ||
}; | ||
|
||
scopes.push(new Scope('Local', this._variableHandles.create(localVariables), false)); | ||
response.body = { scopes }; | ||
|
||
|
@@ -850,7 +870,7 @@ class GoDebugSession extends DebugSession { | |
let initdoneIndex = -1; | ||
for (let i = 0; i < globals.length; i++) { | ||
globals[i].name = globals[i].name.substr(packageName.length + 1); | ||
if (initdoneIndex === -1 && globals[i].name === this.initdone) { | ||
if (initdoneIndex === -1 && globals[i].name === this.initdone) { | ||
initdoneIndex = i; | ||
} | ||
} | ||
|
@@ -869,7 +889,8 @@ class GoDebugSession extends DebugSession { | |
len: 0, | ||
cap: 0, | ||
children: globals, | ||
unreadable: '' | ||
unreadable: '', | ||
fqn: '', | ||
}; | ||
scopes.push(new Scope('Global', this._variableHandles.create(globalVariables), false)); | ||
this.sendResponse(response); | ||
|
@@ -922,6 +943,13 @@ class GoDebugSession extends DebugSession { | |
variablesReference: 0 | ||
}; | ||
} else { | ||
if (v.children[0].children.length > 0) { | ||
v.children[0].fqn = v.fqn; | ||
v.children[0].children.every(child => { | ||
child.fqn = v.fqn + '.' + child.name; | ||
return true; | ||
}); | ||
} | ||
return { | ||
result: '<' + v.type + '>', | ||
variablesReference: v.children[0].children.length > 0 ? this._variableHandles.create(v.children[0]) : 0 | ||
|
@@ -965,6 +993,7 @@ class GoDebugSession extends DebugSession { | |
return { | ||
name: '[' + i + ']', | ||
value: result, | ||
evaluateName: vari.fqn + '[' + i + ']', | ||
variablesReference | ||
}; | ||
}); | ||
|
@@ -979,15 +1008,18 @@ class GoDebugSession extends DebugSession { | |
variables.push({ | ||
name: mapKey.result, | ||
value: mapValue.result, | ||
evaluateName: vari.fqn + '[' + mapKey.result + ']', | ||
variablesReference: mapValue.variablesReference | ||
}); | ||
} | ||
} else { | ||
variables = vari.children.map((v, i) => { | ||
let { result, variablesReference } = this.convertDebugVariableToProtocolVariable(v, i); | ||
v.fqn = v.fqn == undefined ? vari.fqn + '.' + v.name : v.fqn; | ||
return { | ||
name: v.name, | ||
value: result, | ||
evaluateName: v.fqn == undefined ? vari.fqn + '.' + v.name : v.fqn, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Cant we just use |
||
variablesReference | ||
}; | ||
}); | ||
|
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.
What does
fqn
stand for?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.
Fully Qualified Name.Should I change the field name to Fully Qualified Name?