Diagnostics from Zig
Errors come only from Zig itself: in-process AstGen while typing and zig build on save. Inactive code can optionally be marked.
Built on an incremental query engine. Errors come only from Zig itself, comptime is evaluated, and the project model comes from the official build system.
brew install jinzhongjia/tap/zig-analyzer
1const std = @import("std"); 2 3const Point = struct { x: i32, y: i32 }; 4 5fn manhattan(a: Point, b: Point) u32 { 6 return @abs(a.x - b.x) + @abs(a.y - b.y); 7} 8 9test manhattan { 10 const p: Point = .{ .x = 1, .y = 2 }; 11 const d: u32 = manhattan(a:p, b:.{ .x = 4, .y = 6 }); 12 try std.testing.expectEqual(7, d); 13}
fn manhattan(a: Point, b: Point) u32
Accuracy first: results are correct and complete, never truncated or approximated for speed.
Errors come only from Zig itself: in-process AstGen while typing and zig build on save. Inactive code can optionally be marked.
Generics and type constructors are evaluated, and generic function bodies are analyzed with the instances from their call sites.
The project model comes from the official build system protocol. Files without build.zig use single-file mode.
Goto definition, declaration, and type definition; find references; document highlight; document and workspace symbols.
Completion with auto-import and snippets, hover, signature help, inlay hints, and semantic tokens.
Rename, plus code actions for unused names, var to const, missing switch prongs and struct fields, and organizing imports.
Identical to zig fmt, for .zig and .zon, with one edit per changed region.
Highlighting, formatting, and diagnostics in any .zon; completion, goto, and inlay hints for typed imports and build.zig.zon.
Naming checks from the Zig style guide with safe rename fixes, and unused private declarations. Comments suppress them per line or range.
Each package installs the ReleaseSafe build of the latest release, with its debug information.
macOS and Linux, with Homebrew:
brew install jinzhongjia/tap/zig-analyzerx86_64 and aarch64, from the AUR, with a helper such as yay:
yay -S zig-analyzer-binx86_64 and aarch64, with Scoop:
scoop bucket add jin https://github.com/jinzhongjia/scoop-bucket
scoop install jin/zig-analyzerEach release has an archive for x86_64 and aarch64 on Linux, macOS, and Windows, signed with minisign and with a build provenance attestation. Put zig-analyzer in PATH, and keep the debug information file next to it.
minisign -Vm zig-analyzer-<version>-<target>-ReleaseSafe.tar.gz -p minisign.pubRequires Zig 0.17.0 or 0.17.1:
git clone https://github.com/jinzhongjia/zig-analyzer
cd zig-analyzer
zig build -Doptimize=ReleaseSafeThe plugins can install the server for you and check its signature.
Extension on the Marketplace and Open VSX.
Extension, used together with the Zig extension.
Plugin zig-analyzer.nvim, or the built-in client alone.
Plugin zig-analyzer.vim, for yegappan/lsp or vim-lsp.
Package zig-analyzer.el, for the built-in Eglot.
Helix, Sublime Text, Kate, JetBrains IDEs, coc.nvim, and any LSP client.