Page
Library
Module
Module type
Parameter
Class
Class type
Source
amlc-lsp brings compiler-backed diagnostics and AML keyword completion to editors that support the Language Server Protocol. It supports legacy AML and the Octra AppliedML contract dialect without using an RPC node.
Until the package is accepted into the OPAM repository, install from a source checkout:
opam switch create . 4.14.2
eval "$(opam env)"
opam install .Once the package is available from the OPAM repository, install it with:
opam install amlc-lspamlc-lsp requires a compatible amlc executable on PATH. Set AMLC=/absolute/path/to/amlc to select another executable. It must support amlc check file.aml --diagnostics=json: one JSON diagnostic per stdout line, with message, severity, and start/end positions. The server reports an explicit diagnostic rather than guessing from human-readable compiler output. The server still starts when the executable is absent, but reports that compiler-backed AML diagnostics are unavailable.
For offline AppliedML contract diagnostics, also provide rehovot-check on PATH or set REHOVOT_CHECK=/absolute/path/to/rehovot-check. The OPAM package does not bundle this checker. Build the pinned helper separately when needed:
# macOS: brew install pkg-config gmp
# Debian/Ubuntu: sudo apt install pkg-config libgmp-dev
opam install zarith yojson dune
PREFIX="$HOME/.local" sh scripts/build-rehovot-checkNix remains available as an optional reproducible development environment; it is not required for installation or editor use.
By default the server detects legacy AMLC from form/term declarations and routes contracts, current program files, and interfaces to AppliedML's offline checker. Comments and strings do not affect that choice. For an ambiguous file or a workspace that deliberately uses one dialect, set the server dialect to legacy, appliedml, or auto (the default). Clients may send it as initializationOptions.dialect or in workspace/didChangeConfiguration as settings.amlcLsp.dialect.
vim.filetype.add({ extension = { aml = "aml" } })
vim.lsp.config("amlc_lsp", {
cmd = { "amlc-lsp" },
init_options = { dialect = "auto" }, -- or "legacy" / "appliedml"
filetypes = { "aml" },
root_markers = { "project.amlp", ".git" },
single_file_support = true,
})
vim.lsp.enable("amlc_lsp")Install amlc-lsp so it is on PATH, install the repository's zed directory as a development extension, then open an .aml file. The extension uses Tree-sitter for syntax highlighting and starts amlc-lsp.
Zed compiles a development extension locally. For that workflow, Cargo must provide the wasm32-wasip2 target (for example, rustup target add wasm32-wasip2). This is not a runtime requirement for a published extension; an extension-registry release is not published yet.
rehovot-check is installed.Semantic highlighting uses compiler-reported token roles when available. The legacy AMLC fallback intentionally covers only compiler-verified functions; syntax highlighting remains the responsibility of the editor grammar.
See CONTRIBUTING.md for the OCaml/opam build and test workflow. Nix is optional.
This project is BSD-3-Clause. AMLC and Lite Node code used by the optional Nix package and Rehovot checker are covered by the notices in THIRD_PARTY_NOTICES.md.