Skip to content
This repository has been archived by the owner on Jul 15, 2023. It is now read-only.

Fix loading of child types #2320

Merged
merged 1 commit into from
Feb 15, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 2 additions & 12 deletions src/debugAdapter/goDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1115,7 +1115,7 @@ class GoDebugSession extends LoggingDebugSession {
// expressions passed to loadChildren defined per https://github.com/derekparker/delve/blob/master/Documentation/api/ClientHowto.md#loading-more-of-a-variable
if (vari.kind === GoReflectKind.Array || vari.kind === GoReflectKind.Slice) {
variablesPromise = Promise.all(vari.children.map((v, i) => {
return loadChildren(`*(*${this.removeRepoFromTypeName(v.type)})(${v.addr})`, v).then((): DebugProtocol.Variable => {
return loadChildren(`*(*"${v.type}")(${v.addr})`, v).then((): DebugProtocol.Variable => {
let { result, variablesReference } = this.convertDebugVariableToProtocolVariable(v);
return {
name: '[' + i + ']',
Expand Down Expand Up @@ -1147,7 +1147,7 @@ class GoDebugSession extends LoggingDebugSession {
if (v.fullyQualifiedName === undefined) {
v.fullyQualifiedName = vari.fullyQualifiedName + '.' + v.name;
}
return loadChildren(`*(*${this.removeRepoFromTypeName(v.type)})(${v.addr})`, v).then((): DebugProtocol.Variable => {
return loadChildren(`*(*"${v.type}")(${v.addr})`, v).then((): DebugProtocol.Variable => {
let { result, variablesReference } = this.convertDebugVariableToProtocolVariable(v);
return {
name: v.name,
Expand All @@ -1165,16 +1165,6 @@ class GoDebugSession extends LoggingDebugSession {
});
}

// removes all parts of the repo path from a type name.
// e.g. github.com/some/repo/package.TypeName becomes package.TypeName
private removeRepoFromTypeName(typeName: string): string {
const i = typeName.lastIndexOf('/');
if (i === -1) {
return typeName;
}
return typeName.substr(i + 1);
}

private cleanupHandles(): void {
this._variableHandles.reset();
this.stackFrameHandles.reset();
Expand Down