Skip to content

Commit 914b947

Browse files
authored
Merge pull request #98 from NativeScript/buhov/expandable-stack-trace
Enable loading more than 20 call frames
2 parents 1c327ff + f4c73d1 commit 914b947

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

src/custom-typings/debugProtocolExtensions.d.ts

+1
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ declare module 'vscode-debugprotocol' {
5454

5555
interface IStackTraceResponseBody {
5656
stackFrames: DebugProtocol.StackFrame[];
57+
totalFrames?: number;
5758
}
5859

5960
interface IScopesResponseBody {

src/debug-adapter/webKitDebugAdapter.ts

+3-3
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
460460
// Only process at the requested number of frames, if 'levels' is specified
461461
let stack = this._currentStack;
462462
if (args.levels) {
463-
stack = this._currentStack.filter((_, i) => i < args.levels);
463+
stack = this._currentStack.filter((_, i) => args.startFrame <= i && i < args.startFrame + args.levels);
464464
}
465465

466466
const stackFrames: DebugProtocol.StackFrame[] = stack
@@ -515,15 +515,15 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter {
515515
// or eval script. If its source has a name, it's probably an anonymous function.
516516
const frameName = callFrame.functionName || (script && script.url ? '(anonymous function)' : '(eval code)');
517517
return {
518-
id: i,
518+
id: args.startFrame + i,
519519
name: frameName,
520520
source: source,
521521
line: callFrame.location.lineNumber,
522522
column: callFrame.location.columnNumber
523523
};
524524
});
525525

526-
return { stackFrames };
526+
return { stackFrames: stackFrames, totalFrames: this._currentStack.length };
527527
}
528528

529529
public scopes(args: DebugProtocol.ScopesArguments): DebugProtocol.IScopesResponseBody {

0 commit comments

Comments
 (0)