From 729564783c946c9219b8207527725878564dfdcc Mon Sep 17 00:00:00 2001 From: isidor Date: Mon, 19 Jun 2017 15:26:50 +0200 Subject: [PATCH] debug: respect supportsDelayedStackTraceLoading fixes #28808 --- .../parts/debug/common/debugModel.ts | 32 +++++++++---------- 1 file changed, 15 insertions(+), 17 deletions(-) diff --git a/src/vs/workbench/parts/debug/common/debugModel.ts b/src/vs/workbench/parts/debug/common/debugModel.ts index e32e0afb33c..8bac39e3df7 100644 --- a/src/vs/workbench/parts/debug/common/debugModel.ts +++ b/src/vs/workbench/parts/debug/common/debugModel.ts @@ -814,24 +814,22 @@ export class Model implements IModel { } } - public fetchCallStack(thread: IThread): TPromise { - return (thread).fetchCallStack(1).then(() => { - if (!this.schedulers.has(thread.getId())) { - this.schedulers.set(thread.getId(), new RunOnceScheduler(() => { - const callStack = thread.getCallStack(); - // Some adapters might not respect the number levels in StackTraceRequest and might - // return more stackFrames than requested. For those do not send an additional stackTrace request. - if (callStack.length <= 1) { - (thread).fetchCallStack(19).done(() => { - this._onDidChangeCallStack.fire(); - }, errors.onUnexpectedError); - } - }, 420)); - } + public fetchCallStack(thread: Thread): TPromise { + if (thread.process.session.capabilities.supportsDelayedStackTraceLoading) { + // For improved performance load the first stack frame and then load the rest async. + return thread.fetchCallStack(1).then(() => { + if (!this.schedulers.has(thread.getId())) { + this.schedulers.set(thread.getId(), new RunOnceScheduler(() => { + thread.fetchCallStack(19).done(() => this._onDidChangeCallStack.fire(), errors.onUnexpectedError); + }, 420)); + } - this.schedulers.get(thread.getId()).schedule(); - this._onDidChangeCallStack.fire(); - }); + this.schedulers.get(thread.getId()).schedule(); + this._onDidChangeCallStack.fire(); + }); + } + + return thread.fetchCallStack(); } public getBreakpoints(): Breakpoint[] { -- GitLab