Add ry canvas: a zoomable, transcluding map of R code - #91
Conversation
A standalone project that consumes ry as a library and puts a whole R codebase on one infinite surface. Zoom out for architecture, zoom in and definitions resolve through structure into real selectable source. Click a resolved name and its definition splices into the body you are reading, indented and framed, recursively — the camera never moves, so following a reference never costs you your place. canvas/core builds ry's syntax, semantics and ide crates to wasm32-unknown-unknown, unchanged: they have no threading or filesystem access outside test helpers. It projects a project into one flat index of cards, classified tokens, inferred types and — the part that makes inline expansion possible — every reference that resolves to another project definition, from item_naming(..).non_locals resolved through package_definitions. Reference edges come from item_interface_reads, the projection already maintained for the incremental firewall. The wasm boundary is a raw C ABI rather than wasm-bindgen: one string in, one string out does not justify a generated binding layer and a toolchain to install. canvas/web draws structure in WebGL2 and hands the last zoom decade to the DOM, which buys selectable text, browser find, font fallback and screen-reader access that a glyph atlas cannot offer. Four crossfaded bands run from colored blocks through per-line and per-token bars to full highlighted source. Layout is deterministic and expansion is local: frame sub-columns and shelf rows are fixed from collapsed sizes, so opening a definition can only ever push things downward. Its own cargo workspace, excluded from the root one, so moving it out of this repository stays a directory move. Verified against stringr (35 files, 167 definitions, 297 references): 64 ms native, 214 ms in wasm, 60 fps at both overview and reading zoom, 1.2 ms relayout. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01MJqJJRwRnzXgLnpTFEwYiP
Deploying ry-lang with
|
| Latest commit: |
17ee2c9
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://2c217691.ry-lang.pages.dev |
| Branch Preview URL: | https://claude-ast-code-viewer-zoom.ry-lang.pages.dev |
|
Reviewed by checking the branch out and running it rather than reading the diff, since most of the claims here are testable. Not merging — it is a new subproject and that is the author's call — but here is what holds and what does not. Verified
It also merges cleanly with current Four things to fix or answer1. The payload figure does not describe the download. The table says 2. The 3. Nothing builds 4. Two lockfiles, and they have already diverged. Smaller
On the design decisionsNo objection to any of them, and two are worth endorsing explicitly. Raw C ABI over wasm-bindgen is right for a one-string-in-one-string-out surface. And holding layout fixed from collapsed sizes so expansion only pushes downward is the decision the whole idea rests on — a canvas whose landmarks move cannot build spatial memory, and it is easy to get that wrong by reflowing. The wasm finding deserves to outlive this PR either way: the analysis core is browser-portable as-is, with no threading or filesystem assumptions to unpick. That is worth knowing even if the canvas itself ends up in its own repository. Generated by Claude Code |
Closed: the canvas now lives in its own repository, felix-andreas/ry-canvas, and depends on ry over a git dependency pinned by its own
Cargo.lockrather than by path.What changed in the move, beyond the packaging:
197 KiBrow described the in-memory index, not the download, and the module shipped withoutwasm-opt— the build now runswasm-opt -Oz(2.20 MiB → 1.37 MiB raw, 583 KiB → 501 KiB gzipped, and it loads faster), and the README carries a cost table separating download from index payload. The vendored stringr also now ships the full MIT permission notice, not just the CRAN stub.cargo check --target wasm32-unknown-unknown, typecheck, web build) plus a weekly run against the pinned ry commit, so a break surfaces before someone hits it mid-bump.just gateis the same set locally.One correction to this PR's description: the claim that
cargo check --workspacefails onreplbecauseextendr-engineneeds R was true for the base this branch was cut from, butrofyhas since been removed andcargo check -p replpasses on currentmain. The reviewer was right.The branch
claude/ast-code-viewer-zoom-xv1wixis left in place with the original in-tree commit, so nothing here is lost.