提交 8a3a8d0f 编写于 作者: I isidor

debug: move show more stack frames logic to call stack controller

fixes #6299
上级 d1236f74
......@@ -193,6 +193,38 @@ export class BaseDebugController extends treedefaults.DefaultController {
// call stack
export class CallStackController extends BaseDebugController {
protected onLeftClick(tree: tree.ITree, element: any, event: mouse.IMouseEvent): boolean {
if (typeof element === 'number') {
return this.showMoreStackFrames(tree, element);
}
return super.onLeftClick(tree, element, event);
}
protected onEnter(tree: tree.ITree, event: IKeyboardEvent): boolean {
const element = tree.getFocus();
if (typeof element === 'number') {
return this.showMoreStackFrames(tree, element);
}
return super.onEnter(tree, event);
}
// user clicked / pressed on 'Load More Stack Frames', get those stack frames and refresh the tree.
private showMoreStackFrames(tree: tree.ITree, threadId: number): boolean {
const thread = this.debugService.getModel().getThreads()[threadId];
if (thread) {
thread.getCallStack(this.debugService, true)
.done(() => tree.refresh(), errors.onUnexpectedError);
}
return true;
}
}
export class CallStackActionProvider implements renderer.IActionProvider {
constructor( @IInstantiationService private instantiationService: IInstantiationService) {
......
......@@ -224,7 +224,7 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
dataSource: this.instantiationService.createInstance(viewer.CallStackDataSource),
renderer: this.instantiationService.createInstance(viewer.CallStackRenderer),
accessibilityProvider: this.instantiationService.createInstance(viewer.CallstackAccessibilityProvider),
controller: new viewer.BaseDebugController(this.debugService, this.contextMenuService, actionProvider)
controller: new viewer.CallStackController(this.debugService, this.contextMenuService, actionProvider)
}, debugTreeOptions(nls.localize({ comment: ['Debug is a noun in this context, not a verb.'], key: 'callStackAriaLabel'}, "Debug Call Stack")));
this.toDispose.push(this.tree.addListener2('selection', (e: tree.ISelectionEvent) => {
......@@ -251,19 +251,6 @@ export class CallStackView extends viewlet.CollapsibleViewletView {
const sideBySide = (originalEvent && (originalEvent.ctrlKey || originalEvent.metaKey));
this.debugService.openOrRevealSource(stackFrame.source, stackFrame.lineNumber, preserveFocus, sideBySide).done(null, errors.onUnexpectedError);
}
// user clicked on 'Load More Stack Frames', get those stack frames and refresh the tree.
if (typeof element === 'number') {
const thread = this.debugService.getModel().getThreads()[element];
if (thread) {
thread.getCallStack(this.debugService, true)
.then(() => this.tree.refresh())
.then(() => {
this.tree.clearFocus();
this.tree.clearSelection();
}).done(null, errors.onUnexpectedError);
}
}
}));
this.toDispose.push(this.tree.addListener2(events.EventType.FOCUS, (e: tree.IFocusEvent) => {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册