Repository navigation
vscode: in-preview typography zoom for the Codev Markdown Preview (#1070) - #1461
Conversation
…), cap-check first
…nd, not constant), name over-wide 1-col case, expand dev-approval script
…le-column container cap (constant measure 50+6/n by construction) as first-class deferred option
…ttons + write-back
… tracks font size
…stepping, refresh README to em tokens, document write-scope defensive branch
Architect integration review (vscode lane)Risk tier: medium. The headline
280 lines across 7 files, touching one shared package, is medium by our triage table, not high. Consultation coverage already exceeds what medium requires (3-way: gemini APPROVE, codex APPROVE, claude COMMENT). Post-consultation fixes — verified independentlySingle-pass protocols never re-review the commit that answers the consultation, so I checked all three of 1. Clamp-before-step ( The old code clamped only the result. From a stored
So the reviewer's specific claim that decrease "returns 47" was factually wrong; result-clamping already caught it. The builder said so and fixed the genuine issue anyway. Under the new code, Verifying a reviewer's claim against the file instead of implementing it as stated is exactly right. 2. 3. Write-scope defensive branch — documented, no behaviour change. The comment at the call site is accurate: Architecture fit
The one judgement that is not mineAt 1200px / 24px the change produces a single ~100-character column. That is the designed trade — em prevents the measure collapsing to too-narrow and pays for it with an over-wide single-column case at that boundary. Measured, predicted, and flagged, with the whole-column container cap ( No blocking findings from me. Merge decision rests with the repo owner. |
PIR Review: In-preview typography controls (zoom) for the Codev Markdown Preview
Fixes #1070
Summary
Adds an in-surface zoom control to the Codev Markdown Preview so a reviewer can resize the prose without leaving for the Settings editor. Three commands (increase / decrease / reset font size) are surfaced as native
editor/titlebuttons plus command-palette entries, gated to the preview; they stepcodev.markdownPreview.fontSize(wired by #1053) and write the value back to the setting, so the control and the Settings editor stay one source of truth, and the existingonDidChangeConfigurationre-render reflows live. Separately, the shared canvas's horizontal-mode column tokens were made em-relative so the reading measure scales with the prose under zoom rather than collapsing to too-narrow.Files Changed
apps/vscode/package.json(+41 / -0) — 3 commands,editor/titlebuttons (+/−) + Reset in the overflow menu,commandPaletteentries, all gatedactiveCustomEditorId == codev.markdownPreviewapps/vscode/src/markdown-preview/font-size-control.ts(+79 / -0) — new; pure stepping/clamp + write-scope resolution (novscodeimport)apps/vscode/src/extension.ts(+44 / -0) — command handlers +configTargetFor/stepMarkdownPreviewFontSizeapps/vscode/src/__tests__/preview-font-size-control.test.ts(+71 / -0) — new; unit tests for the pure logicpackages/artifact-canvas/src/styles/default-theme.css(+8 / -3) —column-width400px→25em,column-gap48px→3empackages/artifact-canvas/src/__tests__/default-theme.test.ts(+9 / -0) — locks the em column tokensCommits
029bbeee6[PIR vscode: in-preview typography controls (zoom) for the Codev Markdown Preview #1070] Surface Reset Font Size in the preview title overflow menu98ad33c54[PIR vscode: in-preview typography controls (zoom) for the Codev Markdown Preview #1070] Make horizontal-mode column tokens em-relative so measure tracks font size6ddca99bb[PIR vscode: in-preview typography controls (zoom) for the Codev Markdown Preview #1070] Add in-preview font-size zoom: commands + editor-title buttons + write-back(Plan-revision and thread commits omitted; they touch no shipped code.)
Test Results
pnpm compile(vscode: check-types + lint + esbuild): ✓ pass (only pre-existing lint warning intunnel.ts, untouched)pnpm test:unit: ✓ 845 pass (72 files) — neededpnpm --filter 'codev-vscode^...' buildfirst to buildcodev-types/codev-sdkdist in a fresh worktreepnpm test: ✓ 177 pass;pnpm build: ✓ (dist CSS confirmed25em/3em)verify: ✓ build + tests--codev-canvas-font-sizetoken the preview injects): cap fallback holds (tall fence/table stay bounded with inner scroll at 24/28px), measured chars/line matched the plan grid exactly at 20/24/28px, and the flagged 1200px·24px over-wide single-column case reproduced as predicted.Architecture Updates
No arch changes. This adds a UI affordance (commands + title-bar menus) and changes two token values in the shared canvas theme (px→em); it introduces no new module boundary, invariant, port, or state, and the server/client isolation and resolver contracts are untouched. The durable knowledge from this work is design wisdom, routed to lessons (below), not system-shape facts.
Lessons Learned Updates
Two COLD lessons added to
codev/resources/lessons-learned.md(UI/UX), both[From #1070]:activeCustomEditorIdtracks the active editor, not focus — correct for gating a custom editor's menu visibility, but a trap for scoping a keybinding that shadows a workbench default (it stays true when focus leaves the editor, silently stealing the global key). This is why v1 ships buttons + palette but no keybindings.measure = 50 + 6/nby construction), which must be JS-computed and recompute on font-size change, not just resize.Neither rises to the always-injected HOT tier (both are surface-specific recipes, not repo-wide invariants).
Things to Look At During PR Review
resolveWriteScope+configTargetFor): the control writesfontSizeback to the scope the value already lives in (workspace-folder → workspace → global) so a workspace override can't silently swallow a click. Global is the default for a fresh personal preference. Worth a sanity check that this matches how you'd expect the setting to behave under a.vscode/settings.jsonoverride.0(the documented "use built-in default" sentinel) to bothfontSizeandlineHeight, so a user who tuned either in Settings gets back to baseline from the surface.steppedFontSizenever returns0— the sentinel is reset-only.getClientRectswidth,columnGap: '48px'), so they're independent of the stylesheet and needed no edits — verified at implement time.How to Test Locally
pir-1070→ Review Diffafx dev pir-1070⊖ ⊕buttons; Reset lives in the⋯overflow menu and in the palette (all only when the preview is the active editor).cmd+=/cmd+-/cmd+0still perform workbench zoom everywhere (no keybindings shipped).