direnv is an extension for your shell. It augments existing shells with a new feature that can load and unload environment variables depending on the current directory.
This extension adds direnv support to Visual Studio Code by loading environment variables for the workspace root.
This extension automatically loads the custom environment direnv provides for the workspace. If the corresponding .envrc file is not allowed yet it provides the option to allow or view and then allow the file. When any files watches by direnv are modified the extension automatically reloads the environment.
Only allow .envrc files from sources you trust since direnv executes arbitrary shell script.
The extension displays a status icon that indicates whether it is currently working or has succeeded or failed.
Clicking the status item will also reload the custom environment.
This extension requires direnv to be installed. We also recommend hooking direnv into your shell.
Custom tasks with type
When direnv unsets an environment variable then in the terminal it will be set to empty (what POSIX calls null). VSCode does not provide API to unset environment variables for the terminal. The difference between null and unset variables is mostly academic but some programs insist on treating them distinctly.
direnv executes arbitrary shell scripts so this extension requires trusted workspaces.
The logo is copyright 2015 Peter Waller and was created as the direnv logo.