Files
Decodal/doc/manual/source/components.md
T

2.7 KiB

Packages and Integrations

Decodal provides separate packages for execution, host embedding, language services, and editor integration.

Rust

decodal

The runtime and embedding API for Rust applications. It handles parsing, evaluation, and materialization of source; host globals; and imports containing either source or structured values.

[dependencies]
decodal = "0.4"

Enable the derive feature to generate a Decodal schema and decoder from a Rust struct.

[dependencies]
decodal = { version = "0.4", features = ["derive"] }

Enable the regex feature to validate regular-expression constraints. This feature requires std.

decodal-language-service

Provides transport-independent semantic evaluation and completion. It accepts an application's HostEnvironment directly, allowing production and editor evaluation to share global bindings and import rules.

decodal-lsp

Connects the language service to the Language Server Protocol. In addition to a stdio server, it exposes a library API that constructs an application-specific environment from the client's InitializeParams.

decodal-language-tools

Provides shared tools for source text, including the formatter. The Rust, LSP, and WebAssembly integrations all use the same formatter implementation.

JavaScript and WebAssembly

decodal-wasm

Provides the evaluator and language service for browsers and other WebAssembly runtimes.

npm install decodal-wasm

It is also published on JSR as @hare/decodal-wasm. Pass globals, loadImport, and completeImport to DecodalLanguageService so JavaScript-owned environments are shared by evaluation and completion.

decodal-codemirror

Language support for CodeMirror 6. It provides syntax highlighting, folding, indentation, and integration with the Decodal formatter.

npm install decodal-codemirror

It is also published on JSR as @hare/decodal-codemirror. Combine it with the decodal-wasm language service when semantic evaluation and completion are required.

Editor syntax

The Tree-sitter grammar is an integration for parsing and highlighting in editors that use Tree-sitter. Tree-sitter is not required by the Decodal runtime, formatter, or LSP.

Choose packages according to the integration you need:

  • Execution and embedding in Rust: decodal
  • Execution and semantic tooling in a browser: decodal-wasm
  • CodeMirror 6: decodal-codemirror
  • Transport-independent Rust language service: decodal-language-service
  • General editor clients: decodal-lsp
  • Syntax grammar for editors that use Tree-sitter: the Tree-sitter integration

See Embedding for concrete environment setup.