Skip to content

Commit

Permalink
chore: outout channel append line type (#4303)
Browse files Browse the repository at this point in the history
  • Loading branch information
Aaaaash authored Jan 13, 2025
1 parent 76244d0 commit b367234
Showing 1 changed file with 12 additions and 3 deletions.
15 changes: 12 additions & 3 deletions packages/output/src/browser/output.channel.ts
Original file line number Diff line number Diff line change
Expand Up @@ -157,9 +157,18 @@ export class OutputChannel extends Disposable {

appendLine(line: string): void {
let value = line;
if (!line.endsWith('\r\n')) {
value = line + '\r\n';
if (typeof line !== 'string') {
try {
value = JSON.stringify(line);
} catch (e) {
value = `[${typeof line}]`;
}
}

if (!value.endsWith('\r\n')) {
value = value + '\r\n';
}

this.eventBus.fire(
new ContentChangeEvent(
new ContentChangeEventPayload(this.name, ContentChangeType.appendLine, value, this.outputLines),
Expand All @@ -169,7 +178,7 @@ export class OutputChannel extends Disposable {
if (this.shouldLogToBrowser) {
// eslint-disable-next-line no-console
console.log(
`%c[${this.name}]` + `%c ${line}}`,
`%c[${this.name}]` + `%c ${value}}`,
'background:rgb(50, 150, 250); color: #fff',
'background: none; color: inherit',
);
Expand Down

0 comments on commit b367234

Please sign in to comment.