Visual Studio Code is a popular open source code editor from Microsoft with extension support.
This page has not been completed.
Using in Nix based projects
If your project provides a flake.nix along with a development shell, it can be developed on VSCode using one of the two ways (prefer the 2nd way):
-
Open VSCode from a terminal, inside of a devshell (i.e.,
nix develop -c code .
), or - Setup direnv and install the direnv VSCode extension.
.vscode
folder
You can persist Nix related extensions & settings for VSCode in the project root’s .vscode
folder (see example). This enables other people working on the project to inherit the same environment as you.
Working on direnv
-activated projects
If you use direnv, it is rather simple to get setup with VSCode:
Once you have cloned your project repo and have activated the direnv environment (using `direnv allow), you can open it in VSCode to develop it:
-
Launch VSCode, and open the
git clone
’ed project directory as single-folder workspace- NOTE: If you are on Windows, you must use the Remote - WSL extension to open the folder in WSL.
-
When prompted by VSCode, install the workspace recommended extensions.
-
If it doesn’t prompt, press Cmd+Shift+X and search for
@recommended
to install them all manually.
-
If it doesn’t prompt, press Cmd+Shift+X and search for
- Ensure that the direnv extension is fully activated. You should expect to see this in the footer of VSCode:
-
For Haskell projects: Once direnv is activated (and only then) open a Haskell file (
.hs
). You should expect haskell-language-server to startup, as seen in the footer:- Once this processing is complete, all IDE features should work.
- The experience is similar for other languages; for Rust, it will be rust-analyzer.
To give this a try, here are some sample repos: