Language support for Sema — a Lisp dialect with first-class LLM primitives — in the Zed editor.
From inside Zed: cmd-shift-P → zed: extensions → search for Sema → Install.
The extension is pending publish to the Zed extension registry. Until it lands there, install it as a dev extension:
- Clone this repository:
git clone https://github.com/sema-lisp/zed-sema.git- In Zed, open the command palette (
cmd-shift-P) →zed: install dev extension- Select the cloned
zed-semadirectory.
The tree-sitter-sema grammar is fetched automatically by Zed at the commit pinned in extension.toml — no manual grammar setup is required.
- Syntax highlighting — special forms, LLM primitives (
llm/chat,defagent,deftool, …), slash-namespaced builtins (string/trim,json/encode), keyword literals (:foo), booleans,nil, numbers, characters, strings, and quote/quasiquote/unquote operators. - Comments —
;line comments and#| … |#block comments, with TODO/FIXME highlighting injected inside them. - Auto-pairs & bracket matching —
(),[],{}, and"". - Code outline — top-level
define,defun,defn,defmacro,defagent,deftool,define-record-type,lambda/fn, block forms (let,let*,letrec,begin,do,cond,case,when,unless,try), andmodule/import. - Auto-indent — 2-space indentation for lists, vectors, and hash maps; outdent on closing delimiters.
- Vim text objects —
af/iffor function definitions (define,defun,lambda,fn,defmacro),ac/icfor agents and tools (defagent,deftool), plus comment objects. - Runnables & tasks — a gutter play button (▶) on each top-level form that runs the current file through the
sema-runtask, backed by thesemaCLI. - Debugging (DAP) — launch-and-debug
.semaprograms via Sema's debug adapter (sema dap): breakpoints, stepping, and variable inspection. Pick Sema in Zed's debugger, or add a launch config (see below). - MCP server — the extension registers Sema's MCP context server (
sema mcp), exposing Sema's tools (eval, build, notebook, docs) to Zed's agent panel. - Secret redaction — string arguments to
llm/configure,llm/define-provider, andllm/auto-configureare hidden during screen sharing.
The syntax queries work on their own, but the run tasks and language server need the sema CLI on your PATH:
cargo install sema-langSee sema-lang.com for other install options.
The extension draws a play button (▶) in the gutter next to each top-level form. (Zed only renders runnables anchored to nodes — there's no whole-file ▶ — so it's anchored to each form; clicking any of them runs the file.)
Zed doesn't let an extension bundle the task the ▶ runs, so you add it once, yourself. Run zed: open tasks (a global tasks.json that applies to every project) or create a project .zed/tasks.json, and add:
[
{
"label": "sema run",
"command": "sema",
"args": ["$ZED_FILE"],
"tags": ["sema-run"]
}
]The tags match the runnable's sema-run tag, so clicking a ▶ runs sema on the current file. Tasks run in your project shell, so sema resolves from your PATH. This is a one-time setup. You can also run it without the gutter via zed: spawn task → sema run.
The extension registers the language server automatically — no settings needed. Open a .sema file and sema lsp starts (the sema binary is resolved from your PATH). Completions, hover, go-to-definition, references, rename, and semantic tokens work out of the box.
Pick Sema when starting a debug session, or add a launch config to .zed/debug.json:
[
{
"label": "Debug Sema Program",
"adapter": "sema",
"request": "launch",
"program": "$ZED_FILE",
"stopOnEntry": false
}
]The adapter runs sema dap over stdio (the sema binary is resolved from your PATH, or a per-adapter override).
The sema MCP context server is registered automatically; enable it in Zed's agent panel to give the assistant access to Sema's tools (eval, build, notebook, docs). It runs sema mcp.
If the MCP server fails to start (
Broken pipe/ timeout), it's because Zed launched from the GUI can't findsemaon itsPATH— the context-server API can't resolve it the way the LSP/debugger can. Point Zed at the full path in your settings:{ "context_servers": { "sema": { "command": { "path": "/Users/you/.cargo/bin/sema", "arguments": ["mcp"] } } } }(Find the path with
which sema.) The extension honors this override.
- Website — sema-lang.com
- Playground — sema.run
- Documentation — sema-lang.com/docs
- Grammar — tree-sitter-sema
- Repository — sema-lisp/zed-sema