Skip to content

Commit

Permalink
debug: respect output severity also for objects
Browse files Browse the repository at this point in the history
fixes #16420
  • Loading branch information
isidorn committed Jan 20, 2017
1 parent 857342a commit 27f81b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 4 deletions.
9 changes: 7 additions & 2 deletions src/vs/workbench/parts/debug/common/debugModel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,13 @@ export class Model implements debug.IModel {
this.replElements.pop();
}

const newReplElements = typeof output === 'string' ? output.split('\n').map(line => new OutputElement(line, severity)) : [output];
this.addReplElements(newReplElements);
if (typeof output === 'string') {
this.addReplElements(output.split('\n').map(line => new OutputElement(line, severity)));
} else {
// TODO@Isidor hack, we should introduce a new type which is an output that can fetch children like an expression
(<any>output).severity = severity;
this.addReplElements([output]);
}
}

this._onDidChangeREPLElements.fire();
Expand Down
4 changes: 2 additions & 2 deletions src/vs/workbench/parts/debug/electron-browser/debugService.ts
Original file line number Diff line number Diff line change
Expand Up @@ -323,6 +323,7 @@ export class DebugService implements debug.IDebugService {
return;
}

const outputSeverity = event.body.category === 'stderr' ? severity.Error : event.body.category === 'console' ? severity.Warning : severity.Info;
if (event.body.category === 'telemetry') {
// only log telemetry events from debug adapter if the adapter provided the telemetry key
// and the user opted in telemetry
Expand All @@ -335,11 +336,10 @@ export class DebugService implements debug.IDebugService {
children.forEach(child => {
// Since we can not display multiple trees in a row, we are displaying these variables one after the other (ignoring their names)
child.name = null;
this.model.appendToRepl(child, null);
this.model.appendToRepl(child, outputSeverity);
});
});
} else if (typeof event.body.output === 'string') {
const outputSeverity = event.body.category === 'stderr' ? severity.Error : event.body.category === 'console' ? severity.Warning : severity.Info;
this.model.appendToRepl(event.body.output, outputSeverity);
}
}));
Expand Down

0 comments on commit 27f81b7

Please sign in to comment.