Note: This branch (
use-new-roc-lsp) uses a fork of tree-sitter-roc with modern Roc syntax support. It is not ready to merge until the changes land upstream at faldor20/tree-sitter-roc.
An extension for Zed that adds Roc language support:
- syntax highlighting through treesitter and
- type tooltips, error marker, completion ... through the roc language server
- Install Roc from the roc-lang website
- Ensure the
rocbinary is in your PATH - Install Zed from the Zed website
- Website: roc-lang.org
- Tree Sitter: tree-sitter-roc
- Language Server: This extension uses the new experimental LSP integrated into the
rocCLI viaroc experimental-lsp.
- Open Zed's command palette (Cmd+Shift+P / Ctrl+Shift+P)
- Run "zed: install dev extension"
- Select this repository folder
- Click "Rebuild" if prompted
Note: The version shown in Zed's Extensions panel may display the marketplace version (e.g., v0.0.6) even when the dev extension is active. This is a Zed caching behavior when the extension ID matches a marketplace extension.
Check Zed's logs (Command palette → "zed: open log file") and look for:
compiling Rust extension /path/to/your/zed-roc
If the path points to your local repository (not ~/Library/Application Support/Zed/extensions/installed/roc), the dev extension is active.
extension.toml- Extension manifest (id, version, grammar source, language config)languages/roc/config.toml- Language configuration (file extensions, comments, brackets)languages/roc/*.scm- Tree-sitter queries (highlights, indents, etc.)grammars/roc/- Git clone of tree-sitter-roc (must match repository in extension.toml)
The grammars/roc/ directory must be a git clone of the repository specified in extension.toml. To update:
- Update the commit hash in
extension.tomlunder[grammars.roc] - Update the grammar submodule:
cd grammars/roc git fetch origin git checkout <commit-hash>
- Sync query files:
cp grammars/roc/queries/*.scm languages/roc/ - Delete cached wasm to force recompilation:
rm grammars/roc.wasm - In Zed, click "Rebuild" on the extension
Extension not detecting .roc files:
- Check Zed logs for errors (Command palette → "zed: open log file")
- Ensure
languages = ["languages/roc"]is inextension.toml
Conflict with marketplace version:
- Uninstall the marketplace Roc extension first
- If uninstall doesn't work, quit Zed and manually edit the extensions index.json to remove "roc" entries
- Zed stores extensions in:
- macOS:
~/Library/Application Support/Zed/extensions/ - Linux:
~/.local/share/zed/extensions/
- macOS:
Grammar compilation errors:
- Ensure
grammars/roc/is a git clone of the repository URL inextension.toml - The git remote origin must match the repository URL exactly
# Sync query files from grammar to languages
cp grammars/roc/queries/*.scm languages/roc/
# Clean build artifacts
rm -f grammars/roc.wasm extension.wasm
# Check Zed logs (macOS)
tail -f ~/Library/Logs/Zed/Zed.log | grep -i roc