提交 61ef2f38 编写于 作者: I isidor

debug: show origin in editor header

fixes #18148
上级 680725f0
......@@ -717,15 +717,7 @@ export class FocusProcessAction extends AbstractDebugAction {
return this.debugService.focusStackFrameAndEvaluate(null, process).then(() => {
const stackFrame = this.debugService.getViewModel().focusedStackFrame;
if (stackFrame) {
return this.editorService.openEditor({
resource: stackFrame.source.uri,
options: {
preserveFocus: true,
selection: { startLineNumber: stackFrame.lineNumber, startColumn: 1 },
revealIfVisible: true,
revealInCenterIfOutsideViewport: true
}
});
return stackFrame.openInEditor(this.editorService, true);
}
});
}
......
......@@ -14,6 +14,7 @@ import { ISuggestion } from 'vs/editor/common/modes';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { Range } from 'vs/editor/common/core/range';
import { RawContextKey, ContextKeyExpr } from 'vs/platform/contextkey/common/contextkey';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
export const VIEWLET_ID = 'workbench.view.debug';
export const REPL_ID = 'workbench.panel.repl';
......@@ -170,6 +171,7 @@ export interface IStackFrame extends ITreeElement {
getScopes(): TPromise<IScope[]>;
restart(): TPromise<any>;
toString(): string;
openInEditor(editorService: IWorkbenchEditorService, preserveFocus?: boolean, sideBySide?: boolean): TPromise<any>;
}
export interface IEnablement extends ITreeElement {
......
......@@ -19,6 +19,7 @@ import { ISuggestion } from 'vs/editor/common/modes';
import { Position } from 'vs/editor/common/core/position';
import * as debug from 'vs/workbench/parts/debug/common/debug';
import { Source } from 'vs/workbench/parts/debug/common/debugSource';
import { IWorkbenchEditorService } from 'vs/workbench/services/editor/common/editorService';
const MAX_REPL_LENGTH = 10000;
const UNKNOWN_SOURCE_LABEL = nls.localize('unknownSource', "Unknown Source");
......@@ -351,6 +352,19 @@ export class StackFrame implements debug.IStackFrame {
public toString(): string {
return `${this.name} (${this.source.inMemory ? this.source.name : this.source.uri.fsPath}:${this.lineNumber})`;
}
public openInEditor(editorService: IWorkbenchEditorService, preserveFocus?: boolean, sideBySide?: boolean): TPromise<any> {
return editorService.openEditor({
resource: this.source.uri,
description: this.source.origin,
options: {
preserveFocus,
selection: { startLineNumber: this.lineNumber, startColumn: 1 },
revealIfVisible: true,
revealInCenterIfOutsideViewport: true
}
}, sideBySide);
}
}
export class Thread implements debug.IThread {
......
......@@ -283,14 +283,7 @@ export class DebugService implements debug.IDebugService {
this.windowService.getWindow().focus();
aria.alert(nls.localize('debuggingPaused', "Debugging paused, reason {0}, {1} {2}", event.body.reason, stackFrameToFocus.source ? stackFrameToFocus.source.name : '', stackFrameToFocus.lineNumber));
return this.editorService.openEditor({
resource: stackFrameToFocus.source.uri,
options: {
selection: { startLineNumber: stackFrameToFocus.lineNumber, startColumn: 1 },
revealIfVisible: true,
revealInCenterIfOutsideViewport: true
}
});
return stackFrameToFocus.openInEditor(this.editorService);
}
});
}
......
......@@ -309,15 +309,7 @@ export class CallStackController extends BaseDebugController {
private focusStackFrame(stackFrame: debug.IStackFrame, event: IKeyboardEvent | IMouseEvent, preserveFocus: boolean): void {
this.debugService.focusStackFrameAndEvaluate(stackFrame).then(() => {
const sideBySide = (event && (event.ctrlKey || event.metaKey));
return this.editorService.openEditor({
resource: stackFrame.source.uri,
options: {
preserveFocus,
selection: { startLineNumber: stackFrame.lineNumber, startColumn: 1 },
revealIfVisible: true,
revealInCenterIfOutsideViewport: true
},
}, sideBySide);
return stackFrame.openInEditor(this.editorService, preserveFocus, sideBySide);
}, errors.onUnexpectedError);
}
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册