From 45650d7b5a2e3aef303e07cb0d2b2eb76ea98327 Mon Sep 17 00:00:00 2001 From: isidor Date: Thu, 28 Apr 2016 09:44:33 +0200 Subject: [PATCH] debug: only change call stack input when thread count changes fixes #5784 --- src/vs/workbench/parts/debug/browser/debugViews.ts | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/src/vs/workbench/parts/debug/browser/debugViews.ts b/src/vs/workbench/parts/debug/browser/debugViews.ts index e06c2c02960..13762931110 100644 --- a/src/vs/workbench/parts/debug/browser/debugViews.ts +++ b/src/vs/workbench/parts/debug/browser/debugViews.ts @@ -273,9 +273,7 @@ export class CallStackView extends viewlet.CollapsibleViewletView { const model = this.debugService.getModel(); this.toDispose.push(model.onDidChangeCallStack(() => { - const threads = model.getThreads(); - const threadsArray = Object.keys(threads).map(ref => threads[ref]); - this.tree.setInput(threadsArray.length === 1 ? threadsArray[0] : model).done(() => { + this.updateTree(model).done(() => { const focussedThread = model.getThreads()[this.debugService.getViewModel().getFocusedThreadId()]; if (!focussedThread) { this.pauseMessage.hide(); @@ -299,6 +297,15 @@ export class CallStackView extends viewlet.CollapsibleViewletView { })); } + private updateTree(model: debug.IModel): TPromise { + const threads = model.getThreads(); + const threadsArray = Object.keys(threads).map(ref => threads[ref]); + // Only show the threads in the call stack if there is more than 1 thread. + const newTreeInput = threadsArray.length === 1 ? threadsArray[0] : model; + + return this.tree.getInput() === newTreeInput ? this.tree.refresh() : this.tree.setInput(newTreeInput); + } + public shutdown(): void { this.settings[CallStackView.MEMENTO] = (this.state === splitview.CollapsibleState.COLLAPSED); super.shutdown();