Skip to content

Commit

Permalink
Show locals in variable explorer
Browse files Browse the repository at this point in the history
  • Loading branch information
joyceerhl committed Apr 25, 2021
1 parent 70073c0 commit 86a198e
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion src/client/datascience/debugLocationTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ export class DebugLocationTracker implements DebugAdapterTracker {
return false;
}

private isContinueEvent(message: DebugProtocol.ProtocolMessage): boolean {
protected isContinueEvent(message: DebugProtocol.ProtocolMessage): boolean {
if (message.type === 'event') {
const eventMessage = message as DebugProtocol.Event;
if (eventMessage.event === 'continue') {
Expand Down
12 changes: 9 additions & 3 deletions src/client/datascience/jupyter/debuggerVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -204,6 +204,8 @@ export class DebuggerVariables extends DebugLocationTracker
// TODO: Figure out what resource to use
this.updateVariables(undefined, message as DebugProtocol.VariablesResponse);
this.monkeyPatchDataViewableVariables(message);
} else if (this.isContinueEvent(message)) {
this.lastKnownVariables = [];
} else if (message.type === 'event' && message.event === 'terminated') {
// When the debugger exits, make sure the variables are cleared
this.lastKnownVariables = [];
Expand Down Expand Up @@ -342,10 +344,14 @@ export class DebuggerVariables extends DebugLocationTracker
}
return true;
});

this.lastKnownVariables = allowedVariables.map((v) => {
// There will be multiple variable requests sent from the client,
// one per scope. Combine the variables from the new response with
// the existing this.lastKnownVariables, and only clear
// this.lastKnownVariables when the user steps. TODO: how to display
// shadowed names?
this.lastKnownVariables = this.lastKnownVariables.concat(allowedVariables.map((v) => {
return convertDebugProtocolVariableToIJupyterVariable(v);
});
}));

this.refreshEventEmitter.fire();
}
Expand Down

0 comments on commit 86a198e

Please sign in to comment.