Bundle language tools with CodeMirror package

This commit is contained in:
2026-07-09 21:25:04 +09:00
parent 59cb8f31e4
commit 8eac5c5cb4
24 changed files with 155 additions and 219 deletions
+8 -9
View File
@@ -41,26 +41,23 @@ The WebAssembly package is for execution, not syntax highlighting.
## Language tools
Source-level tooling lives in the Rust language tools crate and its generated JavaScript/WebAssembly package.
Source-level tooling lives in the Rust language tools crate.
This component is responsible for operations that must preserve source text details such as comments and whitespace.
It is an internal crate used by the future Rust LSP and by the CodeMirror package's bundled formatter WebAssembly.
Important paths:
```text
crates/decodal-language-tools/
packages/decodal-language-tools/
```
The npm package is `decodal-language-tools`.
The JSR package is `@hare/decodal-language-tools`.
The current language tools package exposes the formatter.
The current language tools crate exposes the formatter.
Future LSP functionality should build on the same source-level tooling layer rather than on the runtime core.
## Web editor components
The Web playground editor uses CodeMirror 6 with a generated Lezer parser.
This is the source of syntax highlighting, folding, indentation, and editor syntax tree behavior in the browser UI.
This is the source of syntax highlighting, folding, indentation, editor syntax tree behavior, and the browser formatter command in the browser UI.
Important paths:
@@ -69,6 +66,8 @@ editors/lezer-decodal/decodal.grammar
packages/decodal-codemirror/src/decodal.js
packages/decodal-codemirror/src/decodal-parser.js
packages/decodal-codemirror/src/decodal-parser.terms.js
packages/decodal-codemirror/src/format.js
packages/decodal-codemirror/wasm/
```
The npm package is `decodal-codemirror`.
@@ -112,8 +111,8 @@ Consumers that need syntax information should use the component that matches the
- Rust execution and embedding: `decodal`
- Browser execution: `decodal-wasm`
- Source formatting and future LSP tooling: `decodal-language-tools`
- Web editor syntax: Lezer / CodeMirror
- Web formatting and editor syntax: Lezer / CodeMirror
- Rust LSP internals: `decodal-language-tools`
- General editor syntax: Tree-sitter
This avoids having a separate token stream API whose behavior would have to be kept compatible with both runtime parsing and editor grammars.