Crate: editors/code. Opens any File{Text} node; lowest priority so specialised editors (markdown WYSIWYG, flow) win for their kinds, with “Open with…” to override.
Replacement requirements and the current CodeMirror feature/interface survey: Code Editor Requirements. Rust replacement milestones: Rust Code Editor Roadmap. M1 code and verification record: Rust Code Editor Implementation.
Architecture
- Document in Rust:
ropey::Rope+ version + undo stack. Edits becomecorepatches (ADR-0009 Patches not snapshots). - Backend options: CodeMirror 6 remains the default via JS Interop Boundary. The opt-in
RustCodeEditorPanelinpackages/code-viewhas live LSP/context acceptance, bounded accessibility context and tested backend migration. See Rust Code Editor Implementation and Rust Code Editor Accessibility and Cutover for its contract and remaining physical-desktop/Android gates. The default is prepared but unflipped. - Decorations are data:
Highlight,Fold,Diagnostic,InlayHint,Gutterproduced by Indexing (tree-sitter) and LSP and Terminal, consumed by any backend. The CodeMirror bundle therefore ships no language packages.
Languages (initial)
| Language | Grammar | LSP | Why first |
|---|---|---|---|
| Rust | tree-sitter-rust | rust-analyzer | dogfooding |
| Julia | tree-sitter-julia | LanguageServer.jl | host of Flow Editor targets (Lux.jl, MTK) |
| Go | tree-sitter-go | gopls | mature, simple |
| Unison | community grammar (verify) | ucm | database-backed codebase = a natural Source |
| Lean 4 | tree-sitter-lean (verify) | lake serve | infoview as an extra panel |
Each is a LanguageContribution in editors/code/src/languages/, proving the contribution point works (Example - Language).
Features by phase
- Open/edit/save, highlighting from tree-sitter, folding, search.
- LSP: diagnostics, hover, completion, go-to-definition (which is a graph edge!), references.
- Semantic tokens, inlay hints, code actions, format.
- “Show AST”, “show call graph of this function” → open a
GraphViewin the Graph View.
Big cases
Backend chosen by measured size — see Case Selector (design).
Unicode input
\name → symbol with a dropdown, in this editor and every other input: Unicode Input (design, not built).
Unison note
Unison stores code in a codebase DB, not files. A UnisonSource extension (definitions as nodes, dependency edges) would make Moonkale one of the few editors that shows Unison the way Unison thinks. Good showcase; later phase.
Designs not built yet
Removed from editors/code/src as comment-only files in Milestone 18 phase 1:
- Decorations (
decorations.rs) in a neutral form —Highlight { range, token },Fold,Diagnostic,InlayHint,Gutter— produced by the index/LSP and consumed by any backend. Today diagnostics and wiki-link marks go to CodeMirror in their own messages, and highlighting is the bundle’s (P-093). - Document (
document.rs): rope + version + undo stack + node id, turning backend edits intocorepatches and applying incoming changes (external change → reconcile or prompt). Todayext-api::Documentholds aString; the Rust editor shares revisioned undo history through Workspace. - A Rust-native backend (
backend/native.rs): a virtualised Dioxus text view or a wgpu text renderer over the same rope and decorations. The opt-in Rust extension now uses editor-core and a virtualized Dioxus view incode-view; neutral decorations and feature parity remain unfinished.
CodeMirror’s find/replace controls use the shell theme tokens and the current
English, German or Chinese locale (P-219, 2026-10-22). codemirror-search opens
the real search panel in German, checks its styles, and selects a match.
Density and chrome (WP-63, 2026-10-28)
Text panels use shared density-aware actions: Save is primary in Simple, with wrap, reload, editor switching and settings in ⋯. Detailed expands the same actions. Optional Rust-editor chrome follows its extension choice.