ZLS 0.16.0

Feature improvements

Workspace Symbols (#2339)

The workspace/symbol request has been implemented. It provides an editor with a project-wide list of all symbols that match a query string.

Show Example

Workspace symbol search for "iter" in the ZLS codebase.

The query search is case-insensitive and ignores underscore characters to avoid missing results from spelling differences between snake_case and camelCase. To implement workspace symbols and improve cross-file symbol references (explained further below), all files within workspace folders are loaded during startup. The .zig-cache and zig-pkg subdirectories are excluded from this.

The impact on memory usage has been tested with Zig and ZLS codebases to ensure that ZLS doesn’t use unreasonable amounts of memory.

CodebaseAfter startupAfter requesting workspace symbols
ZLS11.8 MiB17.4 MiB
Zig compiler234.0 MiB338.8 MiB

The extra resource cost for workspace symbols will only apply once they have been requested.

Reliable symbol references across files (#2608)

This is about the feature that implements editor functionally like “Find All References” or “Rename Symbol”.

The implementation of symbol references was fundamentally broken with regards to how it dealt with references across files. It has been reworked completely to more reliably find all references within files of the same build system module. In the future, this can handle additional cases like references across modules or within the standard library.

Accurate module @import resolution (#2510)

To resolve module @imports and other build system dependant features, a custom build runner extracts the releveant information out of a build.zig. This data would however previously merge the entire build graph into one single module and compilation unit. This can easily lead to incorrect results in any non trivial project that contains multiple modules so it has been reworked to keep track of each individual module so that analysis can differentiate between them just like how the compiler does it.

Some examples of what has been improved:

Folding Ranges for @import()s (#2514)

A sequence of three or more @import() declarations will get a folding range to be collapsed. Depending on the editor, folding ranges for imports can be collapsed by default.

Completions

Go to definition on container type jump to @This() alias (#2582)

const Foo = struct {
    //^^^ Go to Definition here
    const Me = @This();
    //    ^^ will jump there
}

This is related to an open proposal about using @This() aliases for documentation.

Compile log output in build on save diagnostics (#2493)

The output of @compileLog statements that were collected during build on save will now be provided through diagnostics.

Show Example

Expand branching types in hover popup (#2349)

Types that resolve differently based on comptime control flow will show all possibilities in the hover popup.

Show Example

Hover popup on a variable of type std.Io.Evented.

Contributors

Here is a list of everyone who has made at least one contribution to this release of ZLS:

Sponsors

We’d like to take a second to thank all our awesome contributors and donators/backers/sponsors; if you have time or money to spare, consider partaking in either of these options - they help keep ZLS awesome for everyone!

OpenCollective Backers

Full Changelog: 0.15.0…0.16.0

Release Artifacts

All files are signed with minisign using this public key:

RWR+9B91GBZ0zOjh6Lr17+zKf5BoSuFvrx2xSeDE57uIYvnKBGmMjOex
OSArchFilenameSignatureSize
Windowsx86_64zls-x86_64-windows-0.16.0.zip minisig4.58 MiB
Windowsaarch64zls-aarch64-windows-0.16.0.zip minisig4.35 MiB
Windowsx86zls-x86-windows-0.16.0.zip minisig4.69 MiB
macOSx86_64zls-x86_64-macos-0.16.0.tar.xz minisig1.19 MiB
macOSaarch64zls-aarch64-macos-0.16.0.tar.xz minisig1.03 MiB
Linuxx86_64zls-x86_64-linux-0.16.0.tar.xz minisig3.83 MiB
Linuxaarch64zls-aarch64-linux-0.16.0.tar.xz minisig3.64 MiB
Linuxarmzls-arm-linux-0.16.0.tar.xz minisig3.75 MiB
Linuxriscv64zls-riscv64-linux-0.16.0.tar.xz minisig4.58 MiB
Linuxpowerpc64lezls-powerpc64le-linux-0.16.0.tar.xzminisig3.72 MiB
Linuxx86zls-x86-linux-0.16.0.tar.xz minisig3.87 MiB
Linuxloongarch64zls-loongarch64-linux-0.16.0.tar.xzminisig3.54 MiB
Linuxs390xzls-s390x-linux-0.16.0.tar.xz minisig4.1 MiB
WASIwasm32zls-wasm32-wasi-0.16.0.tar.xz minisig2.38 MiB