Setting up Zig on Windows for VS Code
Install Scoop §
Install Zig §
Use scoop to install Zig:
Query Zig version:
Install ZLS (Zig Language Server) §
ZLS provides better integration with Zig for editors that support LSP (Language Server Protocol).
- For Windows, go here and type in the Zig verson.
- Click “Prebuilt Binary”.
- Download the ZIP for OS: Windows, Arch: x86_64.
- Place it somewhere, e.g.
C:\my_bin\zls-windows-x86_64-0.13.0
. - Add the location to your
PATH
: Edit the System Environment Variables → Environment Variables → System Variables → Path → Edit… → New.
Verify Zig and ZLS §
Open and shell (e.g. Git Bash) and verify that both zig
and zls
are on the PATH
, and that the versions match:
Set up VS Code §
Open VS Code.
- File → New Window.
- File → Add Folder to Workspace…
- Choose the location of your project.
- Ctrl + Shift + P → Extensions: Install Extensions
- Type “Zig”, choose “Zig Language”, and click Install.
- Respond to the following prompts:
Verify Zig and ZLS integration §
- Open a ZIG source file. It should have syntax highlighting, which shows the Zig Language extension is working.
- Try something like right-clicking on a symbol and selecting Go to Definition. This shows that ZLS is working.