1---
2title: Developing Extensions
3description: "Create Zed extensions: languages, themes, debuggers, slash commands, and more."
4---
5
6# Developing Extensions {#developing-extensions}
7
8Zed extensions are Git repositories containing an `extension.toml` manifest. They can provide languages, themes, debuggers, slash commands, and MCP servers.
9
10## Extension Features {#extension-features}
11
12Extensions can provide:
13
14- [Languages](./languages.md)
15- [Debuggers](./debugger-extensions.md)
16- [Themes](./themes.md)
17- [Icon Themes](./icon-themes.md)
18- [Slash Commands](./slash-commands.md)
19- [MCP Servers](./mcp-extensions.md)
20
21## Developing an Extension Locally
22
23Before starting to develop an extension for Zed, be sure to [install Rust via rustup](https://www.rust-lang.org/tools/install).
24
25> Rust must be installed via rustup. If you have Rust installed via homebrew or otherwise, installing dev extensions will not work.
26
27When developing an extension, you can use it in Zed without needing to publish it by installing it as a _dev extension_.
28
29From the extensions page, click the `Install Dev Extension` button (or the {#action zed::InstallDevExtension} action) and select the directory containing your extension.
30
31If you need to troubleshoot, check Zed.log ({#action zed::OpenLog}) for additional output. For debug output, close and relaunch Zed from the command line with `zed --foreground`, which shows more verbose INFO-level logs.
32
33If you already have the published version of the extension installed, the published version will be uninstalled prior to the installation of the dev extension. After successful installation, the `Extensions` page will indicate that the upstream extension is "Overridden by dev extension".
34
35## Directory Structure of a Zed Extension
36
37A Zed extension is a Git repository that contains an `extension.toml`. This file must contain some
38basic information about the extension:
39
40```toml
41id = "my-extension"
42name = "My extension"
43version = "0.0.1"
44schema_version = 1
45authors = ["Your Name <you@example.com>"]
46description = "Example extension"
47repository = "https://github.com/your-name/my-zed-extension"
48```
49
50> **Note:** If you are working on a theme extension with the intent to publish it later, suffix your theme extension ID with `-theme`. Otherwise, this may be raised during [extension publishing](#publishing-your-extension).
51
52In addition to this, there are several other optional files and directories that can be used to add functionality to a Zed extension. An example directory structure of an extension that provides all capabilities is as follows:
53
54```
55my-extension/
56 extension.toml
57 Cargo.toml
58 src/
59 lib.rs
60 languages/
61 my-language/
62 config.toml
63 highlights.scm
64 themes/
65 my-theme.json
66```
67
68## WebAssembly
69
70Procedural parts of extensions are written in Rust and compiled to WebAssembly. To develop an extension that includes custom code, include a `Cargo.toml` like this:
71
72```toml
73[package]
74name = "my-extension"
75version = "0.0.1"
76edition = "2021"
77
78[lib]
79crate-type = ["cdylib"]
80
81[dependencies]
82zed_extension_api = "0.1.0"
83```
84
85Use the latest version of the [`zed_extension_api`](https://crates.io/crates/zed_extension_api) available on crates.io. Make sure it's still [compatible with Zed versions](https://github.com/zed-industries/zed/blob/main/crates/extension_api#compatible-zed-versions) you want to support.
86
87In the `src/lib.rs` file in your Rust crate you will need to define a struct for your extension and implement the `Extension` trait, as well as use the `register_extension!` macro to register your extension:
88
89```rs
90use zed_extension_api as zed;
91
92struct MyExtension {
93 // ... state
94}
95
96impl zed::Extension for MyExtension {
97 // ...
98}
99
100zed::register_extension!(MyExtension);
101```
102
103> `stdout`/`stderr` is forwarded directly to the Zed process. In order to see `println!`/`dbg!` output from your extension, you can start Zed in your terminal with a `--foreground` flag.
104
105## Forking and cloning the repo
106
1071. Fork the repo
108
109> **Note:** It is very helpful if you fork the `zed-industries/extensions` repo to a personal GitHub account instead of a GitHub organization, as this allows Zed staff to push any needed changes to your PR to expedite the publishing process.
110
1112. Clone the repo to your local machine
112
113```sh
114# Substitute the url of your fork here:
115# git clone https://github.com/zed-industries/extensions
116cd extensions
117git submodule init
118git submodule update
119```
120
121## Extension License Requirements
122
123As of October 1st, 2025, extension repositories must include a license.
124The following licenses are accepted:
125
126- [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
127- [BSD 2-Clause](https://opensource.org/license/bsd-2-clause)
128- [BSD 3-Clause](https://opensource.org/license/bsd-3-clause)
129- [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html)
130- [GNU LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html)
131- [MIT](https://opensource.org/license/mit)
132- [zlib](https://opensource.org/license/zlib)
133
134This allows us to distribute the resulting binary produced from your extension code to our users.
135Without a valid license, the pull request to add or update your extension in the following steps will fail CI.
136
137Your license file should be at the root of your extension repository. Any filename that has `LICENCE` or `LICENSE` as a prefix (case insensitive) will be inspected to ensure it matches one of the accepted licenses. See the [license validation source code](https://github.com/zed-industries/extensions/blob/main/src/lib/license.js).
138
139> This license requirement applies only to your extension code itself (the code that gets compiled into the extension binary).
140> It does not apply to any tools your extension may download or interact with, such as language servers or other external dependencies.
141> If your repository contains both extension code and other projects (like a language server), you are not required to relicense those other projects—only the extension code needs to be one of the aforementioned accepted licenses.
142
143## Publishing your extension
144
145To publish an extension, open a PR to [the `zed-industries/extensions` repo](https://github.com/zed-industries/extensions).
146
147In your PR, do the following:
148
1491. Add your extension as a Git submodule within the `extensions/` directory
150
151```sh
152git submodule add https://github.com/your-username/foobar-zed.git extensions/foobar
153git add extensions/foobar
154```
155
156> All extension submodules must use HTTPS URLs and not SSH URLS (`git@github.com`).
157
1582. Add a new entry to the top-level `extensions.toml` file containing your extension:
159
160```toml
161[my-extension]
162submodule = "extensions/my-extension"
163version = "0.0.1"
164```
165
166> If your extension is in a subdirectory within the submodule you can use the `path` field to point to where the extension resides.
167
1683. Run `pnpm sort-extensions` to ensure `extensions.toml` and `.gitmodules` are sorted
169
170Once your PR is merged, the extension will be packaged and published to the Zed extension registry.
171
172> Extension IDs and names should not contain `zed` or `Zed`, since they are all Zed extensions.
173
174## Updating an extension
175
176To update an extension, open a PR to [the `zed-industries/extensions` repo](https://github.com/zed-industries/extensions).
177
178In your PR do the following:
179
1801. Update the extension's submodule to the commit of the new version. For this, you can run
181
182```sh
183# From the root of the repository:
184git submodule update --remote extensions/your-extension-name
185```
186
187to update your extension to the latest commit available in your remote repository.
188
1892. Update the `version` field for the extension in `extensions.toml`
190 - Make sure the `version` matches the one set in `extension.toml` at the particular commit.
191
192If you'd like to automate this process, there is a [community GitHub Action](https://github.com/huacnlee/zed-extension-action) you can use.
193
194> **Note:** If your extension repository has a different license, you'll need to update it to be one of the [accepted extension licenses](#extension-license-requirements) before publishing your update.