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, snippets, 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- [Snippets](./snippets.md)
19- [Slash Commands](./slash-commands.md)
20- [MCP Servers](./mcp-extensions.md)
21
22## Developing an Extension Locally
23
24Before starting to develop an extension for Zed, be sure to [install Rust via rustup](https://www.rust-lang.org/tools/install).
25
26> Rust must be installed via rustup. If you have Rust installed via homebrew or otherwise, installing dev extensions will not work.
27
28When developing an extension, you can use it in Zed without needing to publish it by installing it as a _dev extension_.
29
30From the extensions page, click the `Install Dev Extension` button (or the {#action zed::InstallDevExtension} action) and select the directory containing your extension.
31
32If 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.
33
34If 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".
35
36## Directory Structure of a Zed Extension
37
38A Zed extension is a Git repository that contains an `extension.toml`. This file must contain some
39basic information about the extension:
40
41```toml
42id = "my-extension"
43name = "My extension"
44version = "0.0.1"
45schema_version = 1
46authors = ["Your Name <you@example.com>"]
47description = "Example extension"
48repository = "https://github.com/your-name/my-zed-extension"
49```
50
51In 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:
52
53```
54my-extension/
55 extension.toml
56 Cargo.toml
57 src/
58 lib.rs
59 languages/
60 my-language/
61 config.toml
62 highlights.scm
63 themes/
64 my-theme.json
65 snippets/
66 snippets.json
67 rust.json
68```
69
70## WebAssembly
71
72Procedural 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:
73
74```toml
75[package]
76name = "my-extension"
77version = "0.0.1"
78edition = "2021"
79
80[lib]
81crate-type = ["cdylib"]
82
83[dependencies]
84zed_extension_api = "0.1.0"
85```
86
87Use 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.
88
89In 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:
90
91```rs
92use zed_extension_api as zed;
93
94struct MyExtension {
95 // ... state
96}
97
98impl zed::Extension for MyExtension {
99 // ...
100}
101
102zed::register_extension!(MyExtension);
103```
104
105> `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.
106
107## Forking and cloning the repo
108
1091. Fork the repo
110
111> **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.
112
1132. Clone the repo to your local machine
114
115```sh
116# Substitute the url of your fork here:
117# git clone https://github.com/zed-industries/extensions
118cd extensions
119git submodule init
120git submodule update
121```
122
123## Extension License Requirements
124
125As of October 1st, 2025, extension repositories must include a license.
126The following licenses are accepted:
127
128- [Apache 2.0](https://www.apache.org/licenses/LICENSE-2.0)
129- [BSD 2-Clause](https://opensource.org/license/bsd-2-clause)
130- [BSD 3-Clause](https://opensource.org/license/bsd-3-clause)
131- [CC BY 4.0](https://creativecommons.org/licenses/by/4.0)
132- [GNU GPLv3](https://www.gnu.org/licenses/gpl-3.0.en.html)
133- [GNU LGPLv3](https://www.gnu.org/licenses/lgpl-3.0.en.html)
134- [MIT](https://opensource.org/license/mit)
135- [Unlicense](https://unlicense.org)
136- [zlib](https://opensource.org/license/zlib)
137
138This allows us to distribute the resulting binary produced from your extension code to our users.
139Without a valid license, the pull request to add or update your extension in the following steps will fail CI.
140
141Your 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).
142
143> This license requirement applies only to your extension code itself (the code that gets compiled into the extension binary).
144> It does not apply to any tools your extension may download or interact with, such as language servers or other external dependencies.
145> 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.
146
147## Extension Publishing Prerequisites
148
149Before publishing your extension, make sure that you have chosen a unique extension ID for your extension in the [extension manifest](#directory-structure-of-a-zed-extension).
150This will be the primary identifier for your extension and cannot be changed after your extension has been published.
151Also, ensure that you have filled out all the required fields in the manifest.
152
153Furthermore, please make sure that your extension fulfills the following preconditions before you move on to publishing your extension:
154
155- Extension IDs and names must not contain the words `zed`, `Zed` or `extension`, since they are all Zed extensions.
156- Your extension ID should provide some information on what your extension tries to accomplish. E.g. for themes, it should be suffixed with `-theme`, snippet extensions should be suffixed with `-snippets` and so on. An exception to that rule are extension that provide support for languages or popular tooling that people would expect to find under that ID. You can take a look at the list of [existing extensions](https://github.com/zed-industries/extensions/blob/main/extensions.toml) to get a grasp on how this usually is enforced.
157- Extensions should provide something that is not yet available in the marketplace as opposed to fixing something that could be resolved within an existing extension. For example, if you find that an existing extension's support for a language server is not functioning properly, first try contributing a fix to the existing extension as opposed to submitting a new extension immediately.
158 - If you receive no response or reaction within the upstream repository within a reasonable amount of time, feel free to submit a pull request that aims to fix said issue. Please ensure that you provide your previous efforts within the pull request to the extensions repository for adding your extension. Zed maintainers will then decide on how to proceed on a case by case basis.
159- Extensions that intend to provide a language, debugger or MCP server must not ship the language server as part of the extension. Instead, the extension should either download the language server or check for the availability of the language server in the users environment using the APIs as provided by the [Zed Rust Extension API](https://docs.rs/zed_extension_api/latest/zed_extension_api/).
160- Themes and icon themes should not be published as part of extensions that provide other features, e.g. language support. Instead, they should be published as a distinct extension. This also applies to theme and icon themes living in the same repository.
161
162Note that non-compliance will be raised during the publishing process by reviewers and delay the release of your extension.
163
164## Publishing your extension
165
166To publish an extension, open a PR to [the `zed-industries/extensions` repo](https://github.com/zed-industries/extensions).
167
168In your PR, do the following:
169
1701. Add your extension as a Git submodule within the `extensions/` directory under the `extensions/{extension-id}` path
171
172```sh
173git submodule add https://github.com/your-username/foobar-zed.git extensions/my-extension
174git add extensions/my-extension
175```
176
177> **Note:** Your extension must live under te
178
179> All extension submodules must use HTTPS URLs and not SSH URLS (`git@github.com`).
180
1812. Add a new entry to the top-level `extensions.toml` file containing your extension:
182
183```toml
184[my-extension]
185submodule = "extensions/my-extension"
186version = "0.0.1"
187```
188
189If your extension is in a subdirectory within the submodule, you can use the `path` field to point to where the extension resides:
190
191```toml
192[my-extension]
193submodule = "extensions-my-extension"
194path = "packages/zed"
195version = "0.0.1"
196```
197
198> Note that the [required extension license](#extension-license-requirements) must reside at the specified path, a license at the root of the repository will not work. However, you are free to symlink an existing license within the repository or choose an alternative license from the list of accepted licenses for the extension code.
199
2003. Run `pnpm sort-extensions` to ensure `extensions.toml` and `.gitmodules` are sorted
201
202Once your PR is merged, the extension will be packaged and published to the Zed extension registry.
203
204## Updating an extension
205
206To update an extension, open a PR to [the `zed-industries/extensions` repo](https://github.com/zed-industries/extensions).
207
208In your PR do the following:
209
2101. Update the extension's submodule to the commit of the new version. For this, you can run
211
212```sh
213# From the root of the repository:
214git submodule update --remote extensions/your-extension-name
215```
216
217to update your extension to the latest commit available in your remote repository.
218
2192. Update the `version` field for the extension in `extensions.toml`
220 - Make sure the `version` matches the one set in `extension.toml` at the particular commit.
221
222If you'd like to automate this process, there is a [community GitHub Action](https://github.com/huacnlee/zed-extension-action) you can use.
223
224> **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.