Target design
This example uses the planned manifest and
HostAPI (Writing an Extension Part B), which are not built. A working example of today’s API is Part A of the same page.
Languages are data-only contributions. This is the Unison entry that will live in editors/code/src/languages/unison.rs (as a static contribution) — a third-party extension would put the same in moonkale.toml:
[[contributes.language]]
id = "unison"
aliases = ["u"]
extensions = [".u"]
tree_sitter = "grammars/unison.wasm" # compiled grammar; same file on all platforms
queries = { highlights = "queries/highlights.scm", locals = "queries/locals.scm" }
comments = { line = "--", block = ["{-", "-}"] }
brackets = [["(", ")"], ["[", "]"], ["{", "}"]]
lsp = { transport = "stdio", command = "ucm", args = ["lsp"], platforms = ["desktop"] }What happens:
- Indexing loads the grammar, highlights
.ufiles, extractsSymbolnodes vialocals.scm. - The Code Editor receives highlights as decorations — CodeMirror needs no Unison mode.
- On desktop,
lsp-localdiscoversucmand starts it; on web, the server does, if installed. lang == 'unison'becomes available inwhenclauses for other contributions.
No Rust code is required. If you do want code (a codebase browser panel for Unison’s database-backed codebase), add a panel and a source — see Example - Data Source.