-
-
Notifications
You must be signed in to change notification settings - Fork 0
Code-grade editor: syntax highlighting + tree-based folding via Lezer (new @jsvision/lang) #102
Copy link
Copy link
Closed
Labels
area: frameworkLarger framework infrastructureLarger framework infrastructureeffort: XLExtra large — epic / requirements-firstExtra large — epic / requirements-firstenhancementNew feature or requestNew feature or requestepicLarge multi-part feature; likely needs its own requirements/plan (CodeOps RD)Large multi-part feature; likely needs its own requirements/plan (CodeOps RD)priority: mediumValuable; schedule after the high tierValuable; schedule after the high tier
Description
Activity
Metadata
Metadata
Assignees
Labels
area: frameworkLarger framework infrastructureLarger framework infrastructureeffort: XLExtra large — epic / requirements-firstExtra large — epic / requirements-firstenhancementNew feature or requestNew feature or requestepicLarge multi-part feature; likely needs its own requirements/plan (CodeOps RD)Large multi-part feature; likely needs its own requirements/plan (CodeOps RD)priority: mediumValuable; schedule after the high tierValuable; schedule after the high tier
Summary
Build the code-development-grade editor (line numbers, syntax highlighting, tree-based folding)
on top of the existing
@jsvision/uieditor, using Lezer (@lezer/*) as the language engine.This is the build follow-through for the closed epic #18 ("RD-08 Editor family: a
code-development-grade editor … in-house, no CodeMirror dep"). A 9-probe feasibility spike returned
GO; the spike branch/package were never committed, so the decision now lives in
codeops/features/code-editor/plans/feasibility-spike/decision-memo.md(reconstructed).Reinterpreting #18's "no CodeMirror dep"
Still holds. Lezer is CodeMirror's incremental parser, not its editor view. We take the parser
(pure JS, headless — no DOM, no WASM, no native; passes
check:deps) and reject CodeMirror'sview/language/commandsand Monaco. The shipped@jsvision/uieditor is the view.Architecture (settled)
Three moving parts:
@jsvision/ui→@jsvision/editor— tracked in Refactor: extract the editor into its own package (@jsvision/editor) #101, landsbefore this build. Coupling is real: the editor imports 9
uisubsystems + reachescontrols/measure.jsanddialog/message-box.js, and@jsvision/filesdepends on it.Tokenizer/FoldProvider) in@jsvision/core— pure zero-dep declarations,so the Lezer package depends only on
core+@lezer/*(never onui/editor).@jsvision/lang—@lezer/*as regular deps.core/uikeep{}runtime deps (mirrors@jsvision/forms→zod). The indent-based defaultfolder + gutter live in
@jsvision/editor(zero-dep), so basic folding works without Lezer.Lezer only — no TextMate fallback. It is Lezer or we don't build this. Accepted consequence: the
supported-language set = languages that have (or for which we author) a Lezer grammar; a language
with no Lezer grammar is out of scope until one exists (no regex/TextMate second path).
Work
@jsvision/editor) — prerequisite.Tokenizer/FoldProviderseam types to@jsvision/core.@jsvision/lang(@lezer/*deps); implement the(from,to,tag)Tokenizer+FoldProviderfor one language end-to-end.@jsvision/editor(works without@jsvision/lang).Inputadapter; off-frame/time-budgeted parse for large files.make_requirementsRD-08 with the decision-memo as settled evidence.yarn verify+check:depsstays clean (core/ui remain zero-dep).Not in scope / re-measure
Per-probe timings and exact
@lezer/*versions from the original spike are unrecoverable (lostwith the uncommitted spike). Re-spike only if a specific number becomes load-bearing.
Related
codeops/features/code-editor/plans/feasibility-spike/decision-memo.mdformat.tssums ZWJ/multi-codepoint emoji width (>2) whileclamping the cell to 1|2.