This guide covers local development for the rescript-zed extension. For more detailed information about Zed extension development, see the official Zed documentation.
Before starting to develop this extension, make sure you have:
- Rust installed via rustup (required for Zed extensions)
- Zed editor installed
Note: Rust must be installed via rustup. If you have Rust installed via homebrew or otherwise, installing dev extensions will not work.
When developing the extension, you can use it in Zed without needing to publish it by installing it as a dev extension.
-
Clone this repository
-
Install the dev extension in Zed:
- Open Zed
- Open the Extensions page (Cmd + Shift + P, then type "zed: extensions")
- Click the
Install Dev Extensionbutton (or use thezed: install dev extensionaction) - Select the directory containing this extension
-
Making changes:
- Edit the extension code as needed
- You do not need to build anything manually before installing/reinstalling
- After making changes, use the "Reinstall" button from the Extensions menu to reload your changes
-
Sanity check (optional):
- You can run
cargo buildin the extension directory to verify the Rust code compiles - This is not required for (re)installing the extension, but can help catch compilation errors early
- You can run
If you need to troubleshoot, here are some useful debugging tools:
View Zed logs:
tail -f ~/Library/Logs/Zed/Zed.logOr use the zed: open log command from Zed.
For more verbose debug output (recommended):
Close Zed completely and relaunch it from the command line with:
zed --foregroundThis will show more verbose INFO level logging in your terminal, including println! and dbg! output from your extension code. This is the preferred way to debug extensions during development.
View language server logs:
Open Cmd + Shift + P and find:
dev: open language server logs
If you're also developing the ReScript language server locally, you can configure Zed to use your local build instead of the published version.
Add the following to your Zed settings (zed: open settings file):
{
"lsp": {
"rescript-language-server": {
"binary": {
"path": "/absolute-path/to/your/node-or-bun",
"arguments": [
"/path/to/your/rescript-vscode/server/out/cli.js",
"--stdio"
]
}
}
}
}Replace the paths with your actual local paths:
path: Path to your Node.js/Bun runtime (e.g.,/Users/username/.bun/bin/bunor/usr/local/bin/node)- First argument: Path to your local language server CLI (e.g.,
/Users/username/Projects/rescript-vscode/server/out/cli.js)
Note: Make sure your local language server is built before using it. For rescript-vscode, this typically means running the build command in that repository first.
If you already have the published version of the extension installed, it will be uninstalled automatically when you install the dev extension. The Extensions page will indicate that the upstream extension is "Overridden by dev extension".
To publish updates to the extension, follow the Zed extension publishing guidelines.