zed-industries/zed
Extensions
Active contributors: kubkon, maxdeviant
Purpose
Zed supports WASM-based extensions. An extension can ship languages, themes, snippets, slash commands, MCP-style context servers, and debug adapters. The runtime sandboxes extensions in WASM and exposes a stable host API.
Crates
| Crate | Role |
|---|---|
crates/extension |
Core extension types and runtime model |
crates/extension_host |
The host that loads and runs extensions |
crates/extension_api |
Public Rust API for extension authors (compiles to WASM) |
crates/extensions_ui |
In-app UI for browsing, installing, configuring extensions |
crates/extension_cli |
CLI for building / packaging extensions (binary) |
extensions/ (top-level) |
First-party bundled extensions (html, glsl, proto, test-extension) |
Key abstractions
| Type | Crate | Description |
|---|---|---|
Extension |
extension |
A loaded extension instance |
ExtensionHost |
extension_host |
Manages installed extensions + WASM runtime |
ExtensionHostProxy |
extension |
Cross-crate handle to the host (used by zed::main) |
ExtensionManifest |
extension |
Parsed extension.toml |
ContextServer |
crates/context_server |
MCP-style external tool server contributed by an extension |
How it works
graph TD
user[User] -->|install| EUI[extensions_ui]
EUI --> Reg[(zed.dev registry)]
Reg --> EUI
EUI -->|hand off| EH[ExtensionHost]
EH --> WASM[WASM module]
WASM -->|calls| API[extension_api]
API -.->|host calls| EH
EH --> Lang[LanguageRegistry]
EH --> Theme[ThemeRegistry]
EH --> Snip[SnippetProvider]
EH --> Cmd[Slash commands]
EH --> Ctx[ContextServer registry]Extension lifecycle
extensions_uishows the registry catalog (served fromzed.dev).- Installing fetches the prebuilt extension archive (built by
extension_cli) and writes it under the user's extensions dir. ExtensionHostdiscovers it on next reload (or hot, depending on the extension type).- The WASM module exposes hooks:
init, language registration, slash-command handlers, context-server connectors. - The host calls those hooks during normal editor operation.
What extensions can contribute
- Languages — full text-language definitions, registered through
crates/language_extension. - Themes — theme TOML files (
crates/theme_extension). - Snippets — JSON snippet bundles.
- Slash commands — single-shot generators in the agent panel and elsewhere.
- Context servers — external processes the agent can use as tools (MCP-style).
- Debug adapters — DAP wrappers (
crates/debug_adapter_extension). - Git hosting providers — extras that integrate with external Git hosts (
crates/git_hosting_providers). - Indexed docs — the
indexed-docsslash command.
First-party extensions
Bundled inside the repo at extensions/:
extensions/html/— HTML language supportextensions/glsl/— GLSL language supportextensions/proto/— protobuf language supportextensions/test-extension/— testing fixtureextensions/workflows/— extension-related GitHub Actions
The top-level extensions/EXTRACTION.md and extensions/README.md describe the layout.
Integration points
- Reads:
extension.toml, the WASM blob, optional grammar/snippet/theme files. - Talks to:
LanguageRegistry,ThemeRegistry,SnippetProvider,ContextServerregistry,DapAdapterregistry. - Bumping:
.github/workflows/extension_bump.ymlandextension_auto_bump.ymlrunextension_clito publish updates.
Entry points for modification
- Hosting features for a new contribution kind — extend
crates/extension(new manifest entry) andcrates/extension_host(new wiring). - Sandbox / WASM ABI —
crates/extension_host. - The author-facing API —
crates/extension_api. - The in-app UI —
crates/extensions_ui.
Related pages
- Language services — where extension languages register
- AI agent — context servers feed the agent
- DAP — extension-contributed debug adapters
Built by Factory AutoWiki from public repository content. It is a generated preview for codebase exploration, not source-maintained documentation.