debug: only change call stack input when thread count changes

fixes #5784
This commit is contained in:
isidor
2016-04-28 09:44:36 +02:00
parent dad2546fa8
commit 45650d7b5a
@@ -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<void> {
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();