Zed Editor
Zed is a fast, open source code editor designed for collaboration and AI support, that is available for macOS and Linux. Zed has support for loading environments directly from Direnv's .envrc
files, meaning you can easily use Zed w/ Devbox via our direnv integration.
Setting up your Project for Zed
-
Make sure that you have direnv installed on your host. To use direnv across all your projects, we recommend installing it with devbox global using
devbox global add direnv
. You can also follow this guide to configure direnv for your system -
Generate a
.envrc
file for your project by runningdevbox generate direnv
in your project's root directory (the same directory with yourdevbox.json
file. -
You can now open your project in Zed and it will automatically load your Devbox shell environment variables from the
.envrc
file.
Troubleshooting your Zed Setup
If you are having trouble getting Zed's LSP to detect your Devbox environment, try the following steps:
-
Make sure you are up to date with the latest version of Zed. You can check for updates by going to
Zed > Check for Updates
in the Zed menu. -
You may need to explicitly tell your LSP to use the binaries in your $PATH variable. To do this, add the following to the
~/.config/zed/config.json
file:
{
...
"lsp": {
"<lsp-name>": {
"binary": {"path_lookup": true}
}
},
...
}
- If you have a version of the binary/language server installed on your host machine, Zed's default behavior for loading direnv directly may cause conflicts with the packages installed via Devbox. To fix this, add the following to your
~/.config/zed/config.json
file:
{
"load_direnv": "shell_hook"
}