gram-lsp
Rust Language Server Protocol implementation for Gram (.gram) files in the tree-sitter-gram workspace. Parsing and diagnostics are provided by gram-data; gram-lsp handles the LSP wire protocol only.
Features
- stdio LSP — diagnostics, hover, go to definition, find references, basic completions.
- Semantic checks — duplicate named element definitions inside a
subject_pattern_elementslist (per spec).
To validate
.gramfiles from the command line, usegram lint(gram checkis a legacy alias).gram-lspfocuses purely on the language server.
Build
From the repository root:
The binary is target/release/gram-lsp (debug: target/debug/gram-lsp).
Install it with:
Run
Editors should launch this command and speak LSP over the process stdin/stdout. The server uses UTF-8 sources and UTF-16 positions on the wire, as required by LSP.
Tests
Zed
The Gram Zed extension (editors/zed/; editors/zed/README.md) starts gram-lsp stdio. Unless you override the binary in Zed settings (see below), the extension uses gram-lsp on PATH if worktree.which finds it; otherwise it downloads gram-lsp-{target}.tar.gz from the GitHub release tagged v + extension.toml version, built by gram-lsp-release-assets.yml.
The extension manifest declares download_file and process:exec for that flow. If you restrict extension capabilities, allow download_file for github.com under gram-data/tree-sitter-gram.
Optional: custom binary path
If gram-lsp is not on PATH, point Zed at it in ~/.config/zed/settings.json (macOS), $XDG_CONFIG_HOME/zed/settings.json (Linux), or .zed/settings.json:
The key under "lsp" must match the language server id in extension.toml (gram-lsp). If another extension registers servers for Gram, you can order or disable them with languages.Gram.language_servers; see Configuring languages | Zed.
Open a .gram file and use Zed: open LSP logs if diagnostics or hover do not appear.
See also
- Spec:
specs/006-gram-lsp/spec.md - Quickstart:
specs/006-gram-lsp/quickstart.md - CLI tool:
tools/gram/(gram check,gram extension)