Files
Decodal/packages/decodal-language-tools/README.md
T
2026-07-09 18:34:41 +09:00

40 lines
975 B
Markdown

# decodal-language-tools
Source-level language tooling for Decodal.
This package is generated from the Rust crate in `crates/decodal-language-tools` with `wasm-pack`.
It currently exposes a comment-preserving formatter that is shared by the official playground and future editor/LSP tooling.
Use `decodal-codemirror` separately when you need CodeMirror 6 language support.
Use `decodal-wasm` separately when you need to evaluate Decodal in a browser.
## Install
```sh
npm install decodal-language-tools
```
JSR:
```sh
deno add jsr:@hare/decodal-language-tools
```
## Usage
```js
import init, { formatSource } from 'decodal-language-tools';
await init();
const result = JSON.parse(formatSource('Server={# host\nhost=String default "localhost";};'));
if (result.ok) {
console.log(result.source);
} else {
console.error(result.error);
}
```
The exported functions return JSON strings so callers can handle diagnostics without depending on Rust data structures.