QA find from the inline-templates round: the per-push rainbow-depth scan
made analyze O(depth^2), and the ghost-text gate calls it on every
keystroke — 8000 nested begins cost 629ms per request (24s at 50k). A
second quadratic hid in close(): a never-matching closer rescanned the
whole stack. Both fixed by a Stack type owning the frames plus running
counts (rainbow depth, per-rule frames), decremented through the
mismatch recovery's middle-of-stack drain — the exact hazard the old
comment cited for scanning. 8000 deep: 629ms -> 2.3ms; stray-closer
shape: 1.9s -> 12ms. Output is bit-identical: corpus fingerprint (859
files) plus two independent old-algorithm oracles (dev depth oracle, QA
field-for-field differential with fuzz sweep) now pinned as regression
tests alongside a wall-clock scaling test. Stale quadratic comment in
inline.rs's deep-nesting test updated to record the fix.
Co-Authored-By: Claude Fable 5 <[email protected]>
The rainbow painted depth 3-5 pairs with editorBracketHighlight
.foreground4..6, whose VS Code defaults are fully transparent — a begin
typed three levels deep vanished with its end. The extension now uses
contributed vfmt.rainbow1..6 colors with opaque defaults in every theme
variant (dark/light/HC/HC-light), and vfmt/scopePairs additionally
reports genuinely unmatched begin/end/fork/join tokens, painted
vfmt.rainbowUnmatched bright red — file characters are never hidden.
Matched pairs, depths and 78eeef6's counting are unchanged.
Co-Authored-By: Claude Fable 5 <[email protected]>
User-reported: a begin inside a case (or any scope the rainbow filters
off the wire) painted one level deeper than its siblings — the hidden
scope read as an invisible begin/end layer. Depth now counts only
enclosing RAINBOW_KEYWORDS frames, one const shared by the counter and
the wire filter. Corpus: same 8,146 wire pairs, max depth 13 -> 7;
depth-0 bucket goes from near-empty to 2,881 (the palette was rotated).
Also closes M4 QA's e2e gap: the exclude test now asserts the republish
half of reindex(), and that a no-op settings push publishes nothing.
Co-Authored-By: Claude Fable 5 <[email protected]>
Server: custom vfmt/scopePairs request returning every begin/end and
fork/join* pair with its nesting depth (UTF-16 ranges); wire shape pinned
by a literal-JSON test and by smoke.js over a real spawned server.
Extension: paints each depth with the theme's own bracket palette
(editorBracketHighlight.foreground1..6), debounced 250 ms, with a
document.version staleness guard; vfmt.rainbowBeginEnd setting (default
on) honored immediately in both directions.
Corpus sweep: 8,146 block pairs across 859 files, max depth 13, worst
request 2.1 ms (picorv32.v).
Co-Authored-By: Claude Fable 5 <[email protected]>
New pairs.rs: a stack matcher over the token stream for begin/end and 16
relative pairs, with guards for every no-body construct that spells an
opener keyword (extern/DPI prototypes, typedef class, virtual interface,
assert property, covergroup with function sample, ...). Non-cascading
mismatch recovery makes one missing end point at the exact unclosed begin.
Feeds textDocument/documentHighlight (cursor on begin highlights its
matching end) and WARNING diagnostics for unmatched openers/closers —
gated on the parse already failing, so macro/ifdef keyword imbalance in
working code can never warn.
Corpus sweep: 840 clean-parsing files, 11,062 matched pairs, 0 false
positives (reproduced independently by QA).
Co-Authored-By: Claude Fable 5 <[email protected]>