Skip to content

Commit

Permalink
Implement 'important' debug output message category. Fix #138091
Browse files Browse the repository at this point in the history
  • Loading branch information
roblourens committed Feb 17, 2022
1 parent f271bbe commit 188b1a5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 7 deletions.
13 changes: 8 additions & 5 deletions src/vs/workbench/contrib/debug/browser/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import { dispose, IDisposable } from 'vs/base/common/lifecycle';
import { mixin } from 'vs/base/common/objects';
import * as platform from 'vs/base/common/platform';
import * as resources from 'vs/base/common/resources';
import severity from 'vs/base/common/severity';
import Severity from 'vs/base/common/severity';
import { URI } from 'vs/base/common/uri';
import { generateUuid } from 'vs/base/common/uuid';
import { IPosition, Position } from 'vs/editor/common/core/position';
Expand Down Expand Up @@ -1055,7 +1055,7 @@ export class DebugSession implements IDebugSession {
resolved.forEach((child) => {
// Since we can not display multiple trees in a row, we are displaying these variables one after the other (ignoring their names)
(<any>child).name = null;
this.appendToRepl(child, severity.Info, source);
this.appendToRepl(child, Severity.Info, event.body.category === 'important', source);
});
});
return;
Expand All @@ -1065,7 +1065,7 @@ export class DebugSession implements IDebugSession {
return;
}

const outputSeverity = event.body.category === 'stderr' ? severity.Error : event.body.category === 'console' ? severity.Warning : severity.Info;
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 debug extension provided the telemetry key
// and the user opted in telemetry
Expand Down Expand Up @@ -1104,7 +1104,7 @@ export class DebugSession implements IDebugSession {
}

if (typeof event.body.output === 'string') {
this.appendToRepl(event.body.output, outputSeverity, source);
this.appendToRepl(event.body.output, outputSeverity, event.body.category === 'important', source);
}
});
}));
Expand Down Expand Up @@ -1297,7 +1297,10 @@ export class DebugSession implements IDebugSession {
this.debugService.getViewModel().updateViews();
}

appendToRepl(data: string | IExpression, severity: severity, source?: IReplElementSource): void {
appendToRepl(data: string | IExpression, severity: Severity, isImportant?: boolean, source?: IReplElementSource): void {
this.repl.appendToRepl(this, data, severity, source);
if (isImportant) {
this.notificationService.notify({ message: data.toString(), severity: severity, source: this.name });
}
}
}
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ export interface IDebugSession extends ITreeElement {
hasSeparateRepl(): boolean;
removeReplExpressions(): void;
addReplExpression(stackFrame: IStackFrame | undefined, name: string): Promise<void>;
appendToRepl(data: string | IExpression, severity: severity, source?: IReplElementSource): void;
appendToRepl(data: string | IExpression, severity: severity, isImportant?: boolean, source?: IReplElementSource): void;

// session events
readonly onDidEndAdapter: Event<AdapterEndEvent | undefined>;
Expand Down
2 changes: 1 addition & 1 deletion src/vs/workbench/contrib/debug/test/browser/mockDebug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export class MockSession implements IDebugSession {
return Promise.resolve(undefined);
}

appendToRepl(data: string | IExpression, severity: Severity, source?: IReplElementSource): void { }
appendToRepl(data: string | IExpression, severity: Severity, isImportant?: boolean, source?: IReplElementSource): void { }

configuration: IConfig = { type: 'mock', name: 'mock', request: 'launch' };
unresolvedConfiguration: IConfig = { type: 'mock', name: 'mock', request: 'launch' };
Expand Down

0 comments on commit 188b1a5

Please sign in to comment.