Skip to content

Commit

Permalink
debug: only change call stack input when thread count changes
Browse files Browse the repository at this point in the history
fixes #5784
  • Loading branch information
isidorn committed Apr 28, 2016
1 parent dad2546 commit 45650d7
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/vs/workbench/parts/debug/browser/debugViews.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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();
Expand All @@ -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();
Expand Down

0 comments on commit 45650d7

Please sign in to comment.