Skip to content

Commit

Permalink
Honor 'deemphasize' hint of Source objects in CALL STACK view
Browse files Browse the repository at this point in the history
fixes #18396
  • Loading branch information
isidorn committed Jan 11, 2017
1 parent 3eb77a6 commit fc4ae77
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 11 deletions.
6 changes: 3 additions & 3 deletions src/vs/workbench/parts/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -432,10 +432,10 @@ export class Thread implements debug.IThread {

return response.body.stackFrames.map((rsf, level) => {
if (!rsf) {
return new StackFrame(this, 0, new Source({ name: UNKNOWN_SOURCE_LABEL }, false), nls.localize('unknownStack', "Unknown stack location"), null, null);
return new StackFrame(this, 0, new Source({ name: UNKNOWN_SOURCE_LABEL }, true), nls.localize('unknownStack', "Unknown stack location"), null, null);
}

return new StackFrame(this, rsf.id, rsf.source ? new Source(rsf.source) : new Source({ name: UNKNOWN_SOURCE_LABEL }, false), rsf.name, rsf.line, rsf.column);
return new StackFrame(this, rsf.id, rsf.source ? new Source(rsf.source, rsf.source.presentationHint === 'deemphasize') : new Source({ name: UNKNOWN_SOURCE_LABEL }, true), rsf.name, rsf.line, rsf.column);
});
}, (err: Error) => {
if (this.stoppedDetails) {
Expand Down Expand Up @@ -560,7 +560,7 @@ export class Process implements debug.IProcess {
this.threads.forEach(thread => {
thread.getCallStack().forEach(stackFrame => {
if (stackFrame.source.uri.toString() === uri.toString()) {
stackFrame.source.available = false;
stackFrame.source.deemphasize = true;
}
});
});
Expand Down
4 changes: 1 addition & 3 deletions src/vs/workbench/parts/debug/common/debugSource.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,12 @@ import { DEBUG_SCHEME } from 'vs/workbench/parts/debug/common/debug';
export class Source {

public uri: uri;
public available: boolean;

private static INTERNAL_URI_PREFIX = `${DEBUG_SCHEME}://internal/`;

constructor(public raw: DebugProtocol.Source, available = true) {
constructor(public raw: DebugProtocol.Source, public deemphasize: boolean) {
const path = raw.path || raw.name;
this.uri = raw.sourceReference > 0 ? uri.parse(Source.INTERNAL_URI_PREFIX + raw.sourceReference + '/' + path) : uri.file(path);
this.available = available;
}

public get name() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -554,7 +554,7 @@ export class CallStackRenderer implements IRenderer {
}

private renderStackFrame(stackFrame: debug.IStackFrame, data: IStackFrameTemplateData): void {
stackFrame.source.available ? dom.removeClass(data.stackFrame, 'disabled') : dom.addClass(data.stackFrame, 'disabled');
stackFrame.source.deemphasize ? dom.addClass(data.stackFrame, 'disabled') : dom.removeClass(data.stackFrame, 'disabled');
data.file.title = stackFrame.source.raw.path || stackFrame.source.name;
data.label.textContent = stackFrame.name;
data.label.title = stackFrame.name;
Expand Down
8 changes: 4 additions & 4 deletions src/vs/workbench/parts/debug/test/common/debugSource.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ suite('Debug - Source', () => {
path: '/xx/yy/zz',
sourceReference: 0
};
const source = new Source(rawSource);
const source = new Source(rawSource, false);

assert.equal(source.available, true);
assert.equal(source.deemphasize, false);
assert.equal(source.name, rawSource.name);
assert.equal(source.inMemory, false);
assert.equal(source.reference, rawSource.sourceReference);
Expand All @@ -30,9 +30,9 @@ suite('Debug - Source', () => {
name: 'internalModule.js',
sourceReference: 11
};
const source = new Source(rawSource);
const source = new Source(rawSource, true);

assert.equal(source.available, true);
assert.equal(source.deemphasize, true);
assert.equal(source.name, rawSource.name);
assert.equal(source.inMemory, true);
assert.equal(source.reference, rawSource.sourceReference);
Expand Down

0 comments on commit fc4ae77

Please sign in to comment.