Skip to content

Commit

Permalink
Skip the multi-group frame for single groups & small app scope improv…
Browse files Browse the repository at this point in the history
…ement
  • Loading branch information
jasonpaulos committed Sep 29, 2023
1 parent b5e6556 commit d2aeca7
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
7 changes: 6 additions & 1 deletion src/debugAdapter/debugRequestHandlers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,8 +312,13 @@ export class TxnGroupDebugSession extends LoggingDebugSession {
if (typeof frame !== 'undefined') {
if (frame instanceof ProgramStackFrame) {
const programScope = new ProgramStateScope(args.frameId);
let scopeName = 'Program State';
const appID = frame.currentAppID();
if (typeof appID !== 'undefined') {
scopeName += `: App ${appID}`;
}
scopes.push(
new Scope("Program State", this._variableHandles.create(programScope), false)
new Scope(scopeName, this._variableHandles.create(programScope), false)
);
}
scopes.push(
Expand Down
5 changes: 5 additions & 0 deletions src/debugAdapter/traceReplayEngine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ export class TraceReplayEngine {
this.stack = [
new TopLevelTransactionGroupsFrame(this, simulateResponse)
];
if (simulateResponse.txnGroups.length === 1) {
// If only a single group, get rid of the top-level frame
this.forward();
this.stack.shift();
}
}

private resetCurrentAppState() {
Expand Down
2 changes: 1 addition & 1 deletion tests/adapter.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ async function assertVariables(dc: DebugClient, {
assert.ok(scopesResponse.success);
const scopes = scopesResponse.body.scopes;

const executionScope = scopes.find(scope => scope.name === 'Program State');
const executionScope = scopes.find(scope => scope.name.startsWith('Program State'));
assert.ok(executionScope);

const executionScopeResponse = await dc.variablesRequest({ variablesReference: executionScope.variablesReference });
Expand Down

0 comments on commit d2aeca7

Please sign in to comment.