fixes #71183
fixes #71092
This commit is contained in:
isidor 2019-03-27 12:29:36 +01:00
parent 9ce7505342
commit 310baf6d19
3 changed files with 23 additions and 9 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.$;
@ -193,7 +194,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;
}
@ -253,11 +255,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);
}
});
}
}

View file

@ -214,6 +214,10 @@ export class FocusSessionActionItem extends SelectActionItem {
this.update();
}
protected getActionContext(_: string, index: number): any {
return this.debugService.getModel().getSessions()[index];
}
private update() {
const session = this.debugService.getViewModel().focusedSession;
const sessions = this.getSessions();

View file

@ -8,7 +8,7 @@ import { Action } from 'vs/base/common/actions';
import * as lifecycle from 'vs/base/common/lifecycle';
import { IKeybindingService } from 'vs/platform/keybinding/common/keybinding';
import { IWorkspaceContextService, WorkbenchState } from 'vs/platform/workspace/common/workspace';
import { IDebugService, State, IEnablement, IBreakpoint } from 'vs/workbench/contrib/debug/common/debug';
import { IDebugService, State, IEnablement, IBreakpoint, IDebugSession } from 'vs/workbench/contrib/debug/common/debug';
import { Variable, Breakpoint } from 'vs/workbench/contrib/debug/common/debugModel';
import { IEditorService } from 'vs/workbench/services/editor/common/editorService';
import { IQuickOpenService } from 'vs/platform/quickOpen/common/quickOpen';
@ -366,8 +366,7 @@ export class FocusSessionAction extends AbstractDebugAction {
super(id, label, '', debugService, keybindingService, 100);
}
public run(sessionName: string): Promise<any> {
const session = this.debugService.getModel().getSessions().filter(p => p.getLabel() === sessionName).pop();
public run(session: IDebugSession): Promise<any> {
this.debugService.focusStackFrame(undefined, undefined, session, true);
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
if (stackFrame) {