added debugger

This commit is contained in:
Kilian Schüttler 2025-03-27 03:46:27 +01:00
parent 8e36f3ae24
commit c1c2f165fa
4 changed files with 24 additions and 19 deletions

View File

@ -420,7 +420,7 @@
} }
:global(.highlightOp) { :global(.highlightOp) {
@apply border border-forge-sec rounded; @apply border-forge-sec rounded;
} }
:global(.current-operation-highlight) { :global(.current-operation-highlight) {
@ -432,18 +432,6 @@
@apply font-bold text-orange-300; @apply font-bold text-orange-300;
} }
@keyframes pulse {
0% {
background-color: rgba(251, 146, 60, 0.1);
}
50% {
background-color: rgba(251, 146, 60, 0.3);
}
100% {
background-color: rgba(251, 146, 60, 0.1);
}
}
:global(.breakpoint-glyph) { :global(.breakpoint-glyph) {
margin-left: 3px; margin-left: 3px;
width: 0; width: 0;

View File

@ -11,7 +11,12 @@
let render: () => void = $state(() => {}); let render: () => void = $state(() => {});
let stepper: DebugStepper | undefined = $state(); let stepper: DebugStepper | undefined = $state();
let breakpoints: Set<number> = $state(new Set<number>()); let breakpoints: Set<number> = $state(new Set<number>());
$effect(() => {
if (stepper?.finished) {
fState.document.stepperManager.unregister(stepper);
}
})
function contentsUpdatedEvent() { function contentsUpdatedEvent() {
render(); render();
} }
@ -75,6 +80,8 @@
<div class="debug-info"> <div class="debug-info">
{#if stepper.onBreak} {#if stepper.onBreak}
<span class="break-indicator">Paused at operation {stepper.currentIdx}</span> <span class="break-indicator">Paused at operation {stepper.currentIdx}</span>
{:else if stepper.finished}
<span class="running-indicator">Done</span>
{:else} {:else}
<span class="running-indicator">Running...</span> <span class="running-indicator">Running...</span>
{/if} {/if}

View File

@ -8,6 +8,7 @@ export class DebugStepper {
onBreak: boolean = $state(false); onBreak: boolean = $state(false);
opList: OperatorListModel | null = null; opList: OperatorListModel | null = null;
callback: (() => void) | null = null; callback: (() => void) | null = null;
finished = $state(false);
constructor(pageNum: number, breakPoints: Set<number>) { constructor(pageNum: number, breakPoints: Set<number>) {
this.pageNum = pageNum; this.pageNum = pageNum;
@ -17,10 +18,19 @@ export class DebugStepper {
} }
updateBreakPoints(breakPoints: Set<number>) { updateBreakPoints(breakPoints: Set<number>) {
this.breakPoints = Array.from(breakPoints).filter(a => a > this.currentIdx).sort(function (a, b) { this.breakPoints = Array.from(breakPoints)
return b - a; .filter((a) => a > this.currentIdx)
}); .sort(function (a, b) {
return b - a;
});
}
cleanBreakPoints() {
this.breakPoints = this.breakPoints
.filter((a) => a > this.currentIdx)
.sort(function (a, b) {
return b - a;
});
} }
public async breakIt(idx: number, callback: () => void) { public async breakIt(idx: number, callback: () => void) {
@ -41,6 +51,7 @@ export class DebugStepper {
public step() { public step() {
this.nextBreakPoint = this.currentIdx + 1; this.nextBreakPoint = this.currentIdx + 1;
this.cleanBreakPoints();
this._resume(); this._resume();
} }
@ -53,7 +64,6 @@ export class DebugStepper {
} }
public getNextBreakPoint() { public getNextBreakPoint() {
return this.nextBreakPoint ?? this.breakPoints.pop(); return this.nextBreakPoint ?? this.breakPoints.pop();
} }

File diff suppressed because one or more lines are too long