Merge pull request #143925 from xisui-MSFT/dev/xisui/fix_disabled_breakpoint_icon

Fix disabled breakpoint icon in disassembly view
This commit is contained in:
Rob Lourens 2022-03-14 16:40:02 -07:00 committed by GitHub
commit 861340560f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -44,6 +44,7 @@ import { applyFontInfo } from 'vs/editor/browser/config/domFontInfo';
interface IDisassembledInstructionEntry {
allowBreakpoint: boolean;
isBreakpointSet: boolean;
isBreakpointEnabled: boolean;
instruction: DebugProtocol.DisassembledInstruction;
instructionAddress?: bigint;
}
@ -52,6 +53,7 @@ interface IDisassembledInstructionEntry {
const disassemblyNotAvailable: IDisassembledInstructionEntry = {
allowBreakpoint: false,
isBreakpointSet: false,
isBreakpointEnabled: false,
instruction: {
address: '-1',
instruction: localize('instructionNotAvailable', "Disassembly not available.")
@ -232,6 +234,7 @@ export class DisassemblyView extends EditorPane {
const index = this.getIndexFromAddress(bp.instructionReference);
if (index >= 0) {
this._disassembledInstructions!.row(index).isBreakpointSet = true;
this._disassembledInstructions!.row(index).isBreakpointEnabled = bp.enabled;
changed = true;
}
}
@ -247,6 +250,18 @@ export class DisassemblyView extends EditorPane {
}
});
bpEvent.changed?.forEach((bp) => {
if (bp instanceof InstructionBreakpoint) {
const index = this.getIndexFromAddress(bp.instructionReference);
if (index >= 0) {
if (this._disassembledInstructions!.row(index).isBreakpointEnabled !== bp.enabled) {
this._disassembledInstructions!.row(index).isBreakpointEnabled = bp.enabled;
changed = true;
}
}
}
});
// get an updated list so that items beyond the current range would render when reached.
this._instructionBpList = this._debugService.getModel().getInstructionBreakpoints();
@ -363,7 +378,7 @@ export class DisassemblyView extends EditorPane {
}
}
newEntries.push({ allowBreakpoint: true, isBreakpointSet: found !== undefined, instruction: instruction });
newEntries.push({ allowBreakpoint: true, isBreakpointSet: found !== undefined, isBreakpointEnabled: !!found?.enabled, instruction: instruction });
}
const specialEntriesToRemove = this._disassembledInstructions.length === 1 ? 1 : 0;
@ -467,6 +482,7 @@ class BreakpointRenderer implements ITableRenderer<IDisassembledInstructionEntry
templateId: string = BreakpointRenderer.TEMPLATE_ID;
private readonly _breakpointIcon = 'codicon-' + icons.breakpoint.regular.id;
private readonly _breakpointDisabledIcon = 'codicon-' + icons.breakpoint.disabled.id;
private readonly _breakpointHintIcon = 'codicon-' + icons.debugBreakpointHint.id;
private readonly _debugStackframe = 'codicon-' + icons.debugStackframe.id;
private readonly _debugStackframeFocused = 'codicon-' + icons.debugStackframeFocused.id;
@ -542,9 +558,16 @@ class BreakpointRenderer implements ITableRenderer<IDisassembledInstructionEntry
icon.classList.remove(this._breakpointHintIcon);
if (element?.isBreakpointSet) {
icon.classList.add(this._breakpointIcon);
if (element.isBreakpointEnabled) {
icon.classList.add(this._breakpointIcon);
icon.classList.remove(this._breakpointDisabledIcon);
} else {
icon.classList.remove(this._breakpointIcon);
icon.classList.add(this._breakpointDisabledIcon);
}
} else {
icon.classList.remove(this._breakpointIcon);
icon.classList.remove(this._breakpointDisabledIcon);
}
}
}