Skip to content

Repository files navigation

Echo for Zed

Zed extension for the Echo language.

  • Syntax highlighting / folds / outline — tree-sitter grammar generated from echo_syntax via xo tools grammar tree-sitter.
  • Language featuresxo lsp (diagnostics, hover, go-to-def, completion, rename, format, semantic tokens, …). Echo ships LSP in every xo binary (no special Cargo feature).

This repo is both the Zed extension and the tree-sitter package root (grammar.js, queries/, src/parser.c).

Language server resolution

When you open an .echo file, the extension starts xo lsp in this order:

  1. Settings overridelsp.xo.binary.path / arguments
  2. PATHworktree.which("xo") (shell environment)
  3. Known install layout~/.local/bin/xo, $XDG_DATA_HOME/xo/current/bin/xo, $XO_INSTALL_ROOT/bin/xo (from scripts/install.sh)
  4. GitHub release downloadlatest modoterra/echo release that has assets (stable first, else newest pre-release), cached under the extension work directory as xo-<version>/bin/xo

Status shows as “Checking for update” / “Downloading” while fetching.

Does it pull the latest release?

Yes, when resolution falls through to GitHub:

Situation Behavior
Newer release published Next language-server start downloads xo-<new-tag>/ and removes older xo-* dirs
Same version already cached Reuses xo-<tag>/bin/xo (no re-download)
xo on PATH / settings path Never hits GitHub — uses that binary (dev preferred)
Only pre-releases exist (current Echo) Uses latest pre-release after stable lookup fails

It tracks GitHub Releases, not unreleased main. To use a local LSP (e.g. the reliability polish branch), put a built xo on PATH or set lsp.xo.binary.path.

Release asset contract (Echo CI)

Assets are attached when a GitHub Release is published (docs/ci.md, docs/install.md).

Platform Asset name (current) Archive layout
Linux x86_64 xo-linux-x86_64.tar.gz bin/xo, bin/libecho_runtime.a, std/…, version
macOS arm64 xo-macos-arm64.tar.gz same
Windows x86_64 xo-windows-x86_64.tar.gz bin/xo.exe, …

Also accepted if published later: Rust triples (xo-x86_64-unknown-linux-gnu.tar.gz), version-prefixed names, or .zip on Windows. The extension prefers bin/xo so co-located std/ resolves, and sets XO_INSTALL_ROOT to the unpack root when using a downloaded tree.

Install (recommended)

A. System xo + dev extension (best while hacking Echo)

cd ../echo
cargo build -p xo --release
# optional: install onto PATH / XDG
./scripts/install.sh install
# or just:
export PATH="$PWD/target/release:$PATH"

Install this repo as a Zed dev extension (zed: install dev extension → select zed-echo). LSP will pick up xo from PATH.

B. Settings pin (debug binary, no PATH change)

{
  "lsp": {
    "xo": {
      "binary": {
        "path": "/absolute/path/to/echo/target/debug/xo",
        "arguments": ["lsp"]
      }
    }
  }
}

C. Auto-download from GitHub

Leave xo off PATH and omit settings. Opening an .echo file downloads the latest release asset for your OS (today: pre-release v0.0.1-alpha.*).

Regenerate syntax after Echo surface changes

Grammar and queries/highlights.scm are derived from ../echo. Do not hand-edit them as language authority.

cd ../echo
cargo build -p xo
./target/debug/xo tools grammar tree-sitter -o ../zed-echo

cd ../zed-echo
tree-sitter generate
tree-sitter build --wasm -o grammars/echo.wasm
cp queries/highlights.scm languages/echo/highlights.scm
# restore this README from git (generator may overwrite it)

Rebuild the extension Wasm:

cargo build --target wasm32-wasip2 --release
cp target/wasm32-wasip2/release/zed_echo.wasm extension.wasm

Layout

Path Role
extension.toml Extension + language server + grammar registration
src/lib.rs Resolves / downloads xo for LSP
languages/echo/ Zed language config, highlights, folds, outline
grammar.js / src/parser.c Generated tree-sitter grammar
queries/highlights.scm Tree-sitter package highlights (source for Zed copy)
grammars/echo.wasm Compiled grammar (for local packaging)

Notes

  • Comments are ; to EOL (not //).
  • Statement leaders are single glyphs ($, ~, ?, |, …); see Echo docs/syntax.md.
  • Tree-sitter is a structural basemap. Prefer xo lsp semantic tokens for bind/use fidelity.
  • Grammar fetch: extension.toml points at modoterra/echo / grammars/tree-sitter-echo (public git URL + commit pin). Do not commit machine-local file:///… paths.

Community

Use common sense and decency. There is no formal code of conduct. We reserve the right to moderate this community to the extent of the law and the policy of the host. Write community@modoterra.xyz if you need us.

About

Echo language support for Zed: tree-sitter + xo lsp

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages