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
.envrcfile for your project by runningdevbox generate direnvin your project’s root directory (the same directory with yourdevbox.jsonfile. -
You can now open your project in Zed and it will automatically load your Devbox shell environment
variables from the
.envrcfile.
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 Updatesin 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.jsonfile:
- 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.jsonfile: