Skip to content

Latest commit

 

History

4 Commits

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Zed Cirru

Cirru language support for Zed.

This first implementation focuses on syntax highlighting and bracket matching. It maps the lexical categories from parser.rs into a lightweight Tree-sitter grammar that highlights:

  • line comments starting with ; or ;;
  • string literals and escape sequences
  • special Cirru operators $ and ,
  • parentheses
  • common keyword, boolean, number, and keyword-like token patterns

Local Development

  1. Generate the parser in grammars/tree-sitter-cirru/.
  2. Install this repository as a Zed dev extension.
  3. Open a .cirru file and confirm highlighting.

The grammar is currently loaded from a local file:// URL in extension.toml so it can be tested immediately on this machine. Before publishing, switch that to the real Git repository URL and a fixed commit hash.

Current Limitations

  • This grammar is intentionally lexical-first. It does not yet model Cirru's indentation tree like parser.rs does.
  • Highlighting is already useful, but structural features such as indentation, outline, and exact top-level form detection still need a second iteration.
  • Once the basic grammar settles, the next step is likely an external scanner for indentation-sensitive parsing.

Installation Notes

If you clone this repo to a new machine and install it as a dev extension, there are a few things to watch out for:

1. grammars/tree-sitter-cirru must be a standalone Git repository

extension.toml uses a file:// URL to point Zed at the grammar source. Zed treats this as a Git remote and tries to git clone it at the specified rev. If grammars/tree-sitter-cirru/ is not itself a Git repo (e.g. after a fresh clone of the parent project), Zed will fail with a checkout error.

Fix: initialise it as a Git repo and create a commit:

cd grammars/tree-sitter-cirru
git init && git add -A && git commit -m "tree-sitter grammar for cirru"

Then update the rev in extension.toml to the new commit hash:

git rev-parse HEAD   # copy this hash into extension.toml

2. Update the file:// path in extension.toml

The repository field under [grammars.cirru] contains an absolute local path (e.g. file:///Users/<username>/repo/cirru/zed-cirru/grammars/tree-sitter-cirru). Make sure this matches the actual path on your machine.

3. Delete the grammars/cirru/ directory before installing

Zed expects to clone the grammar into grammars/cirru/ itself. If that directory already exists (even if empty), Zed will refuse to proceed with:

grammar directory '…/grammars/cirru' already exists, but is not a git clone of '…'

Fix: remove the directory and let Zed recreate it:

rm -rf grammars/cirru

4. Files excluded by .gitignore

The top-level .gitignore excludes many generated files under grammars/tree-sitter-cirru/ (bindings, Cargo.toml, node_modules, etc.). These are not needed for Zed to compile the grammar — Zed only requires src/parser.c and the header files in src/tree_sitter/. As long as those exist (they are tracked in Git), the extension will build correctly.

About

Zed editor syntax highlighting for Cirru

Topics

Resources

Stars

0 stars

Watchers

0 watching

Forks

Contributors

Languages