提交 2eca3865 编写于 作者: I isidor

Allow a stack frame with no source that has a presentationHint

fixes #20677
上级 8e285069
......@@ -226,6 +226,15 @@
padding-right: 0.8em;
}
.debug-viewlet .debug-call-stack .stack-frame.label {
text-align: center;
font-style: italic;
}
.debug-viewlet .debug-call-stack .stack-frame.label > .file {
display: none;
}
.debug-viewlet .debug-call-stack .stack-frame > .file {
float: right;
}
......
......@@ -370,7 +370,8 @@ export class StackFrame implements IStackFrame {
}
public openInEditor(editorService: IWorkbenchEditorService, preserveFocus?: boolean, sideBySide?: boolean): TPromise<any> {
return editorService.openEditor({
return this.source.name === UNKNOWN_SOURCE_LABEL ? TPromise.as(null) : editorService.openEditor({
resource: this.source.uri,
description: this.source.origin,
options: {
......@@ -449,9 +450,9 @@ export class Thread implements IThread {
return response.body.stackFrames.map((rsf, level) => {
if (!rsf) {
return new StackFrame(this, 0, new Source({ name: UNKNOWN_SOURCE_LABEL }, true), nls.localize('unknownStack', "Unknown stack location"), null, null);
return new StackFrame(this, 0, new Source({ name: UNKNOWN_SOURCE_LABEL }, rsf.presentationHint), nls.localize('unknownStack', "Unknown stack location"), null, null);
}
let source = rsf.source ? new Source(rsf.source, rsf.source.presentationHint === 'deemphasize') : new Source({ name: UNKNOWN_SOURCE_LABEL }, true);
let source = rsf.source ? new Source(rsf.source, rsf.source.presentationHint) : new Source({ name: UNKNOWN_SOURCE_LABEL }, rsf.presentationHint);
if (this.process.sources.has(source.uri.toString())) {
source = this.process.sources.get(source.uri.toString());
} else {
......@@ -972,7 +973,7 @@ export class Model implements IModel {
public deemphasizeSource(uri: uri): void {
this.processes.forEach(p => {
if (p.sources.has(uri.toString())) {
p.sources.get(uri.toString()).deemphasize = true;
p.sources.get(uri.toString()).presenationHint = 'deemphasize';
}
});
this._onDidChangeCallStack.fire();
......
......@@ -10,7 +10,7 @@ export class Source {
public uri: uri;
constructor(public raw: DebugProtocol.Source, public deemphasize: boolean) {
constructor(public raw: DebugProtocol.Source, public presenationHint: string) {
const path = raw.path || raw.name;
this.uri = raw.sourceReference > 0 ? uri.parse(`${DEBUG_SCHEME}:${path}`) : uri.file(path);
}
......
......@@ -524,7 +524,8 @@ export class CallStackRenderer implements IRenderer {
}
private renderStackFrame(stackFrame: debug.IStackFrame, data: IStackFrameTemplateData): void {
stackFrame.source.deemphasize ? dom.addClass(data.stackFrame, 'disabled') : dom.removeClass(data.stackFrame, 'disabled');
stackFrame.source.presenationHint === 'deemphasize' ? dom.addClass(data.stackFrame, 'disabled') : dom.removeClass(data.stackFrame, 'disabled');
stackFrame.source.presenationHint === 'label' ? dom.addClass(data.stackFrame, 'label') : dom.removeClass(data.stackFrame, 'label');
data.file.title = stackFrame.source.raw.path || stackFrame.source.name;
if (stackFrame.source.raw.origin) {
data.file.title += `\n${stackFrame.source.raw.origin}`;
......
......@@ -15,9 +15,9 @@ suite('Debug - Source', () => {
path: '/xx/yy/zz',
sourceReference: 0
};
const source = new Source(rawSource, false);
const source = new Source(rawSource, 'label');
assert.equal(source.deemphasize, false);
assert.equal(source.presenationHint, 'label');
assert.equal(source.name, rawSource.name);
assert.equal(source.inMemory, false);
assert.equal(source.reference, rawSource.sourceReference);
......@@ -29,9 +29,9 @@ suite('Debug - Source', () => {
name: 'internalModule.js',
sourceReference: 11
};
const source = new Source(rawSource, true);
const source = new Source(rawSource, 'deemphasize');
assert.equal(source.deemphasize, true);
assert.equal(source.presenationHint, 'deemphasize');
assert.equal(source.name, rawSource.name);
assert.equal(source.inMemory, true);
assert.equal(source.reference, rawSource.sourceReference);
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册