Merge from vscode de81ccf04849309f843db21130c806a5783678f7 (#4738)

This commit is contained in:
Anthony Dresser
2019-03-28 13:06:16 -07:00
committed by GitHub
parent cc2951265e
commit e6785ffe95
77 changed files with 562 additions and 835 deletions

View File

@@ -4,7 +4,7 @@
*--------------------------------------------------------------------------------------------*/
import * as nls from 'vs/nls';
import { RunOnceScheduler, ignoreErrors } from 'vs/base/common/async';
import { RunOnceScheduler, ignoreErrors, sequence } from 'vs/base/common/async';
import * as dom from 'vs/base/browser/dom';
import { IViewletViewOptions } from 'vs/workbench/browser/parts/views/viewsViewlet';
import { IDebugService, State, IStackFrame, IDebugSession, IThread, CONTEXT_CALLSTACK_ITEM_TYPE, IDebugModel } from 'vs/workbench/contrib/debug/common/debug';
@@ -28,6 +28,7 @@ import { TreeResourceNavigator2, WorkbenchAsyncDataTree } from 'vs/platform/list
import { onUnexpectedError } from 'vs/base/common/errors';
import { HighlightedLabel } from 'vs/base/browser/ui/highlightedlabel/highlightedLabel';
import { createMatches, FuzzyScore } from 'vs/base/common/filters';
import { Event } from 'vs/base/common/event';
const $ = dom.$;
@@ -45,6 +46,7 @@ export class CallStackView extends ViewletPanel {
private dataSource: CallStackDataSource;
private tree: WorkbenchAsyncDataTree<CallStackItem | IDebugModel, CallStackItem, FuzzyScore>;
private contributedContextMenu: IMenu;
private parentSessionToExpand = new Set<IDebugSession>();
constructor(
private options: IViewletViewOptions,
@@ -80,7 +82,11 @@ export class CallStackView extends ViewletPanel {
this.needsRefresh = false;
this.dataSource.deemphasizedStackFramesToShow = [];
this.tree.updateChildren().then(() => this.updateTreeSelection());
this.tree.updateChildren().then(() => {
this.parentSessionToExpand.forEach(s => this.tree.expand(s));
this.parentSessionToExpand.clear();
this.updateTreeSelection();
});
}, 50);
}
@@ -193,7 +199,8 @@ export class CallStackView extends ViewletPanel {
this.onCallStackChangeScheduler.schedule();
}
}));
this.disposables.push(this.debugService.getViewModel().onDidFocusStackFrame(() => {
const onCallStackChange = Event.any<any>(this.debugService.getViewModel().onDidFocusStackFrame, this.debugService.getViewModel().onDidFocusSession);
this.disposables.push(onCallStackChange(() => {
if (this.ignoreFocusStackFrameEvent) {
return;
}
@@ -216,6 +223,13 @@ export class CallStackView extends ViewletPanel {
this.onCallStackChangeScheduler.schedule();
}
}));
this.disposables.push(this.debugService.onDidNewSession(s => {
if (s.parentSession) {
// Auto expand sessions that have sub sessions
this.parentSessionToExpand.add(s.parentSession);
}
}));
}
layoutBody(height: number, width: number): void {
@@ -253,11 +267,20 @@ export class CallStackView extends ViewletPanel {
updateSelectionAndReveal(session);
}
} else {
const expansionsPromise = ignoreErrors(this.tree.expand(thread.session))
.then(() => ignoreErrors(this.tree.expand(thread)));
if (stackFrame) {
expansionsPromise.then(() => updateSelectionAndReveal(stackFrame));
const expandPromises = [() => ignoreErrors(this.tree.expand(thread))];
let s: IDebugSession | undefined = thread.session;
while (s) {
const sessionToExpand = s;
expandPromises.push(() => ignoreErrors(this.tree.expand(sessionToExpand)));
s = s.parentSession;
}
sequence(expandPromises.reverse()).then(() => {
const toReveal = stackFrame || session;
if (toReveal) {
updateSelectionAndReveal(toReveal);
}
});
}
}
@@ -574,7 +597,7 @@ class CallStackDataSource implements IAsyncDataSource<IDebugModel, CallStackItem
if (sessions.length === 0) {
return Promise.resolve([]);
}
if (sessions.length > 1) {
if (sessions.length > 1 || this.debugService.getViewModel().isMultiSessionView()) {
return Promise.resolve(sessions.filter(s => !s.parentSession));
}