Skip to content
This repository has been archived by the owner on Oct 2, 2021. It is now read-only.

Commit

Permalink
Fix microsoft/vscode#25594 - respect stackTrace range arguments
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed May 24, 2017
1 parent 7e6fae3 commit 63554b9
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
10 changes: 8 additions & 2 deletions src/chrome/chromeDebugAdapter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1218,15 +1218,21 @@ export abstract class ChromeDebugAdapter implements IDebugAdapter {

// Only process at the requested number of frames, if 'levels' is specified
let stack = this._currentPauseNotification.callFrames;
if (args.levels) {
const totalFrames = stack.length;
if (typeof args.startFrame === 'number') {
stack = stack.slice(args.startFrame);
}

if (typeof args.levels === 'number') {
stack = stack.filter((_, i) => i < args.levels);
}

const stackFrames = stack.map(frame => this.callFrameToStackFrame(frame))
.concat(this.asyncFrames(this._currentPauseNotification.asyncStackTrace));

const stackTraceResponse: IInternalStackTraceResponseBody = {
stackFrames
stackFrames,
totalFrames
};
this._pathTransformer.stackTraceResponse(stackTraceResponse);
this._sourceMapTransformer.stackTraceResponse(stackTraceResponse);
Expand Down
1 change: 1 addition & 0 deletions src/debugAdapterInterfaces.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ export interface IThreadsResponseBody {

export interface IStackTraceResponseBody {
stackFrames: DebugProtocol.StackFrame[];
totalFrames?: number;
}

export interface IInternalStackFrame extends DebugProtocol.StackFrame {
Expand Down

0 comments on commit 63554b9

Please sign in to comment.