Feature improvements

Diagnostics

show diagnostics from running build.zig (#2377)

Errors from failing to compile a build.zig file are now reported as diagnostics in the editor. They will also continue to be written to the logs. This works even if build on save is not enabled.

Show Example

Diagnostics in a build.zig file (Neovim with folke/trouble.nvim)

mark diagnostics about unused variables as “unnecessary” (#2387)

Any diagnostics that come from unused variables will now be marked as “unnecessary” over the LSP protocol. This informs the editor that the diagnostic is caused by unused or unnecessary code which may be used to show the diagnostic in a different style.

Show Example

Highlighting of unused variables (Neovim with folke/tokyonight.nvim)

The squiggly line is gone and the variable is faded out instead.

Semantic Tokens

add token modifier for mutable declarations (#2244)

Declarations that are var as opposed to const will now get a non-standard LSP token modifier called “mutable”. Depending on the theme being used, this may affect how they are displayed.

Show Example

Highlighting of mutable declarations (Neovim with folke/tokyonight.nvim)

Tokyonight is unaffected by default so this highlight has been configured manually. Notice how "variable" is rendered in italic.

Code Analysis

Improvements to code analysis are not typically included in the release notes, since each release contains numerous minor changes that are difficult to summarize individually. However, it should be mentioned that this release stands out for containing a greater number of contributions to code analysis than usual. Special thanks goes to FnControlOption who has contributed the majority of code analysis related improvements in this release.

add token modifier for variables with static lifetime (#2260)

Variables with static lifetime will now get the standard LSP token modifier called “static”. Depending on the theme being, this may affect how they are displayed.

Show Example

Special highlight of static variables
(Neovim with folke/tokyonight.nvim)

add token tag for escape sequences (#2243)

In some editors, such as Neovim, escape sequences in string literals would lose their highlighting when using LSP-based semantic highlighting instead of syntax-based highlighting. To address this, the server now emits a non-standard escapeSequence token tag if possible.

support for organizing imports at the bottom of a file (#2391)

The source.organizeImports will move all imports to the bottom of the file if at least one of them is already located there:

const std = @import("std");
const print = std.debug.print;

pub fn main() !void {
    print("Hello World\n", .{});
}

const builtin = @import("builtin");

pub fn main() !void {
    print("Hello World\n", .{});
}

const std = @import("std");
const print = std.debug.print;
const builtin = @import("builtin");

watch for changes in unopened files (#2238)

The language server now registers for the workspace/didChangeWatchedFiles LSP notification to track modifications to files that are not directly opened in the editor. Without this mechanism, edits made by external programs (such as Git) could cause the server’s view of the files to become out of sync, potentially leading to incorrect results.

highlight matching control flow keywords (#2323)

Document highlight and references request on while, for or switch keywords will show all break or continue keywords that reference them. A request on break or continue will have the opposite response.

Show Example

Highlighting of control flow statements (Neovim with folke/tokyonight.nvim)

Holding the cursor on the outer for will highlight the referenced break and continue keywords in bold.

This behaviour must be manually in Neovim. See document highlighting

improved webassembly support (#2278, #2328)

Even though a wasm32-wasi builds has been available since the 0.11.0 release, running in webassembly needed further care to be usable in practice due how restrictive this target can be compared to others. Over time we have improve webassembly support thanks to the testing in the Zig Playground. Further improvements to the playground are planned, alongside ongoing work to make ZLS usable in VS Code as a browser extension.

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.14.0…0.15.0

Release Artifacts

Release filenames have changed

The operating system and cpu archtecture in the filename have been swapped to match the equivalent change that happened in Zig’s tarballs. armv7a also has been renamed to arm for the same reason.

All files are signed with minisign using this public key:

RWR+9B91GBZ0zOjh6Lr17+zKf5BoSuFvrx2xSeDE57uIYvnKBGmMjOex
OSArchFilenameSignatureSize
Windowsx86_64zls-x86_64-windows-0.15.0.zip minisig4.25 MiB
Windowsaarch64zls-aarch64-windows-0.15.0.zip minisig4.04 MiB
Windowsx86zls-x86-windows-0.15.0.zip minisig4.3 MiB
macOSx86_64zls-x86_64-macos-0.15.0.tar.xz minisig1.11 MiB
macOSaarch64zls-aarch64-macos-0.15.0.tar.xz minisig971.43 KiB
Linuxx86_64zls-x86_64-linux-0.15.0.tar.xz minisig3.6 MiB
Linuxaarch64zls-aarch64-linux-0.15.0.tar.xz minisig3.38 MiB
Linuxarmzls-arm-linux-0.15.0.tar.xz minisig3.5 MiB
Linuxriscv64zls-riscv64-linux-0.15.0.tar.xz minisig4.22 MiB
Linuxpowerpc64lezls-powerpc64le-linux-0.15.0.tar.xzminisig3.47 MiB
Linuxx86zls-x86-linux-0.15.0.tar.xz minisig3.57 MiB
Linuxloongarch64zls-loongarch64-linux-0.15.0.tar.xzminisig3.22 MiB
Linuxs390xzls-s390x-linux-0.15.0.tar.xz minisig3.95 MiB
WASIWasmzls-wasm32-wasi-0.15.0.tar.xz minisig2.21 MiB