feat(vscode): live preview — per-step diagrams synced to cursor (#42) #60

Merged
toph merged 14 commits from vscode-preview-clean into main 2026-07-04 18:46:18 +00:00
Owner

Third VSCode subsystem, on the foundation (#44) + highlighting (#48): a cursor-synced live preview. Two phases in one vertical.

Phase 1 — evaluator, closes the first stages of #42. The evaluator snapshots its folded state at each step boundary, and fold_emit emits one self-contained foldedForm frame per step (baseline + one per panel), each tagged beloch:step. Exact (Num), float only at the FOLD boundary. cube-root.bel emits 4 frames with face counts growing 1→2→4→8; through.bel (no steps) stays 1 frame.

Phase 2 — renderer + webview. fold2svg gains data-step/data-construction hooks + a --step selector, and overlays only auxiliary named constructions (not the ones already drawn as creases/corners). The webview is a dumb SVG display: the host renders CP + per-step folded SVGs via resolveBeloch() + fold2svg, and the webview drives all controls by CSS/DOM — CP/folded toggle, sync on/off (off = step manually), construction selector, current-step highlight. No fold geometry client-side; re-render only on document change.

Includes dogfood packaging: a .vsix package/dogfood script, an F5 launch config, and a README documenting both the dev-host and installed paths.

No animation in this slice — all interpolation / rigid-fold rotation / per-face isometries / 3D are deferred to a future 3D-viewer slice (see #30, ADR 0015). Per-face isometry emission (#31/#55) lands separately on top of this.

Dogfooded end-to-end (preview loads, follows the cursor). Two findings from that session: the LSP client's error dialog on every .bel open is fixed here (#58); making the sync line-aware is tracked for later (#59).

Built and reviewed task-by-task (six tasks, each with an adversarial review). Supersedes the WIP PR #53 (this branch is the same work, cleanly rebased onto current main with the interleaved design-doc / #55 commits dropped).

For #42.

Third VSCode subsystem, on the foundation (#44) + highlighting (#48): a cursor-synced live preview. Two phases in one vertical. **Phase 1 — evaluator, closes the first stages of #42.** The evaluator snapshots its folded state at each `step` boundary, and `fold_emit` emits one self-contained `foldedForm` frame per step (baseline + one per panel), each tagged `beloch:step`. Exact (`Num`), float only at the FOLD boundary. `cube-root.bel` emits 4 frames with face counts growing 1→2→4→8; `through.bel` (no steps) stays 1 frame. **Phase 2 — renderer + webview.** `fold2svg` gains `data-step`/`data-construction` hooks + a `--step` selector, and overlays only *auxiliary* named constructions (not the ones already drawn as creases/corners). The webview is a dumb SVG display: the host renders CP + per-step folded SVGs via `resolveBeloch()` + `fold2svg`, and the webview drives all controls by CSS/DOM — CP/folded toggle, sync on/off (off = step manually), construction selector, current-step highlight. No fold geometry client-side; re-render only on document change. Includes dogfood packaging: a `.vsix` `package`/`dogfood` script, an F5 launch config, and a README documenting both the dev-host and installed paths. No animation in this slice — all interpolation / rigid-fold rotation / per-face isometries / 3D are deferred to a future 3D-viewer slice (see #30, ADR 0015). Per-face isometry emission (#31/#55) lands separately on top of this. Dogfooded end-to-end (preview loads, follows the cursor). Two findings from that session: the LSP client's error dialog on every `.bel` open is fixed here (#58); making the sync line-aware is tracked for later (#59). Built and reviewed task-by-task (six tasks, each with an adversarial review). Supersedes the WIP PR #53 (this branch is the same work, cleanly rebased onto current `main` with the interleaved design-doc / #55 commits dropped). For #42.
toph added 14 commits 2026-07-04 18:46:01 +00:00
Each crease element now carries class="crease-M/V/U" and data-step (from
beloch:edges provenance) so a webview can style/select by CSS/DOM. Named
constructions (beloch:named_points/named_lines) are wrapped in
<g class="construction" data-construction="name">, rendered by default for
every name (--constructions, if given, narrows the set) — the webview
toggles visibility itself rather than asking the renderer to omit entries.

Add --step <id> to pick which file_frames entry the folded view renders,
matching on its beloch:step tag; unmatched/omitted falls back to the last
frame. foldedFrame(fold, step) gains the same optional step arg and now
defaults to the LAST frame instead of frames[0] — the correct default now
that file_frames holds one frame per step (Phase 1, #42); existing
single-frame fixtures are unaffected since frame 0 === the last frame there.

New fixtures tools/test/fixtures/{x-midpoint,cube-root}.fold (generated via
`beloch fold`) exercise the hooks and multi-step selection.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
toph merged commit 0eeccd66d5 into main 2026-07-04 18:46:18 +00:00
Sign in to join this conversation.
No reviewers
No labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
toph/beloch!60
No description provided.