Skip to content

Commit

Permalink
debug: fix ANSI styling disappearing from REPL when a session ends (#…
Browse files Browse the repository at this point in the history
…229753)

Fixes #229752
  • Loading branch information
connor4312 authored Sep 25, 2024
1 parent fd83a56 commit 848d216
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,8 @@ export class DebugExpressionRenderer {

renderValue(container: HTMLElement, expressionOrValue: IExpressionValue | string, options: IRenderValueOptions = {}): IDisposable {
const store = new DisposableStore();
const supportsANSI = !!options.session?.capabilities.supportsANSIStyling;
// Use remembered capabilities so REPL elements can render even once a session ends
const supportsANSI = !!options.session?.rememberedCapabilities?.supportsANSIStyling;

let value = typeof expressionOrValue === 'string' ? expressionOrValue : expressionOrValue.value;

Expand Down
2 changes: 2 additions & 0 deletions src/vs/workbench/contrib/debug/browser/debugSession.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ const TRIGGERED_BREAKPOINT_MAX_DELAY = 1500;

export class DebugSession implements IDebugSession, IDisposable {
parentSession: IDebugSession | undefined;
rememberedCapabilities?: DebugProtocol.Capabilities;

private _subId: string | undefined;
raw: RawDebugSession | undefined; // used in tests
Expand Down Expand Up @@ -369,6 +370,7 @@ export class DebugSession implements IDebugSession, IDisposable {

this.initialized = true;
this._onDidChangeState.fire();
this.rememberedCapabilities = this.raw.capabilities;
this.debugService.setExceptionBreakpointsForSession(this, (this.raw && this.raw.capabilities.exceptionBreakpointFilters) || []);
this.debugService.getModel().registerBreakpointModes(this.configuration.type, this.raw.capabilities.breakpointModes || []);
} catch (err) {
Expand Down
4 changes: 3 additions & 1 deletion src/vs/workbench/contrib/debug/common/debug.ts
Original file line number Diff line number Diff line change
Expand Up @@ -412,8 +412,10 @@ export interface IDebugSession extends ITreeElement {
readonly onDidChangeState: Event<void>;
readonly onDidChangeReplElements: Event<IReplElement | undefined>;

// DA capabilities
/** DA capabilities. Set only when there is a running session available. */
readonly capabilities: DebugProtocol.Capabilities;
/** DA capabilities. These are retained on the session even after is implementation ends. */
readonly rememberedCapabilities?: DebugProtocol.Capabilities;

// DAP events

Expand Down

0 comments on commit 848d216

Please sign in to comment.