From f4c73d1f2b74d2ae319ab383e379a545ed26fc3d Mon Sep 17 00:00:00 2001 From: ivanbuhov Date: Wed, 30 Nov 2016 17:07:48 +0200 Subject: [PATCH] Enable loading more than 20 call frames --- src/custom-typings/debugProtocolExtensions.d.ts | 1 + src/debug-adapter/webKitDebugAdapter.ts | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/custom-typings/debugProtocolExtensions.d.ts b/src/custom-typings/debugProtocolExtensions.d.ts index b2b526f..8691bf6 100644 --- a/src/custom-typings/debugProtocolExtensions.d.ts +++ b/src/custom-typings/debugProtocolExtensions.d.ts @@ -54,6 +54,7 @@ declare module 'vscode-debugprotocol' { interface IStackTraceResponseBody { stackFrames: DebugProtocol.StackFrame[]; + totalFrames?: number; } interface IScopesResponseBody { diff --git a/src/debug-adapter/webKitDebugAdapter.ts b/src/debug-adapter/webKitDebugAdapter.ts index b4e5194..7440f77 100644 --- a/src/debug-adapter/webKitDebugAdapter.ts +++ b/src/debug-adapter/webKitDebugAdapter.ts @@ -460,7 +460,7 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter { // Only process at the requested number of frames, if 'levels' is specified let stack = this._currentStack; if (args.levels) { - stack = this._currentStack.filter((_, i) => i < args.levels); + stack = this._currentStack.filter((_, i) => args.startFrame <= i && i < args.startFrame + args.levels); } const stackFrames: DebugProtocol.StackFrame[] = stack @@ -515,7 +515,7 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter { // or eval script. If its source has a name, it's probably an anonymous function. const frameName = callFrame.functionName || (script && script.url ? '(anonymous function)' : '(eval code)'); return { - id: i, + id: args.startFrame + i, name: frameName, source: source, line: callFrame.location.lineNumber, @@ -523,7 +523,7 @@ export class WebKitDebugAdapter implements DebugProtocol.IDebugAdapter { }; }); - return { stackFrames }; + return { stackFrames: stackFrames, totalFrames: this._currentStack.length }; } public scopes(args: DebugProtocol.ScopesArguments): DebugProtocol.IScopesResponseBody {