From 188b1a51fe48a225c2a977e2b32c472b46845d36 Mon Sep 17 00:00:00 2001 From: Rob Lourens Date: Wed, 16 Feb 2022 17:24:47 -0800 Subject: [PATCH] Implement 'important' debug output message category. Fix #138091 --- .../workbench/contrib/debug/browser/debugSession.ts | 13 ++++++++----- src/vs/workbench/contrib/debug/common/debug.ts | 2 +- .../contrib/debug/test/browser/mockDebug.ts | 2 +- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/src/vs/workbench/contrib/debug/browser/debugSession.ts b/src/vs/workbench/contrib/debug/browser/debugSession.ts index cad60226f6d9c..6d7ec022e420e 100644 --- a/src/vs/workbench/contrib/debug/browser/debugSession.ts +++ b/src/vs/workbench/contrib/debug/browser/debugSession.ts @@ -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'; @@ -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) (child).name = null; - this.appendToRepl(child, severity.Info, source); + this.appendToRepl(child, Severity.Info, event.body.category === 'important', source); }); }); return; @@ -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 @@ -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); } }); })); @@ -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 }); + } } } diff --git a/src/vs/workbench/contrib/debug/common/debug.ts b/src/vs/workbench/contrib/debug/common/debug.ts index 02be8d7a2de28..906fb5ac9b7b8 100644 --- a/src/vs/workbench/contrib/debug/common/debug.ts +++ b/src/vs/workbench/contrib/debug/common/debug.ts @@ -312,7 +312,7 @@ export interface IDebugSession extends ITreeElement { hasSeparateRepl(): boolean; removeReplExpressions(): void; addReplExpression(stackFrame: IStackFrame | undefined, name: string): Promise; - 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; diff --git a/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts b/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts index 0e3c9d22c5251..81c394466eca9 100644 --- a/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts +++ b/src/vs/workbench/contrib/debug/test/browser/mockDebug.ts @@ -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' };