A Zig language server supporting Zig developers with features like autocomplete and goto definition
Installing ZLS for the first time? Check out the Installation Guide!
New inlay hints have been added for variable declarations, captured values and struct literal fields.
These new inlay hints can be seperately configured with the following new config options:
inlay_hints_show_parameter_name
inlay_hints_show_variable_type_hints
inlay_hints_show_struct_literal_field_type
The new enable_build_on_save
config option enables ZLS compile your project with zig build
and report back diagnostics.
You can control which build step should be executed with the build_on_save_step
config option which defaults to the "install" step.
Note: The vscode-zig extension provides a similar feature.
@compileError
as deprecated (#1764)Any symbol that calls @compileError
will marked as deprecated in completions, hover and semantic highlighting. Different editors/clients may represent this information differently (or not at all).
Note: The error message does not need to start with "Deprecated;".
Most Color Themes in VS Code do not visualize deprecated tokens. The following setting can be used in VS Code to highlight deprecated tokens with a strikethrough.
"editor.semanticTokenColorCustomizations": {
"rules": {
"*.deprecated": {
"strikethrough": true
},
}
},
Completions of the .*
and .?
operations will now show the result type.
While editing a build.zig
file, you will now receive filesystem completions inside string literals when typing a valid file path.
std
and builtin
(#1656)Completions inside an @import
will include the std
and builtin
module with their file path. (#1656)
Editor/Client | Config Option | Default Value |
---|---|---|
VS Code | editor.suggest.insertMode |
"insert" |
Sublime Text LSP | completion_insert_mode |
"insert" |
Helix | completion_replace |
false |
Emacs lsp-mode | lsp-completion-default-behaviour |
:replace |
A config option in Vim/Neovim depends on the LSP or completion plugin being used.
Kate Editor has a config option for this feature "Configure
-> Editing
-> Auto Completion
-> Auto word completion
-> Remove tail on complete
" but it does not use ZLS.
Declarations to function alias that take a self parameter are now included when providing completions on member access.
The following example would previously not give any completions.
Snippets for float and int types have been removed. (#1681)
There are new snippets that add top level declaration for std
, @import
and std_options
(#1498) (#1830)
The config system has been revamped to validate config options like executable or directory paths and provide better diagnostics.
When your editor does not support displaying a message window, you will still find them in ZLS's log output.
ZLS has the following compatibility requirements:
As of right now, a master/nightly build of ZLS does try to be mostly usable with the latest tagged release of Zig but this is done as a best effort and is subject to change. (#1020)
When your ZLS and Zig version are incompatible, ZLS will show you a warning:
When your editor does not support displaying a message window, you will still find them in ZLS's log output.
The autofix feature is now disabled by default. (#1657)
enable_ast_check_diagnostics
Getting quickly informed about compile errors while coding is a vital feature that has little reason to be disabled.
enable_import_embedfile_argument_completions
This feature has been unstable in the past which is no longer the case.
include_at_in_builtins
This options served as a workaround for an issue with builtin completions in Sublime Text 3 which has been resolved.
max_detail_length
This options served as a workaround for an issue with long completion detail entries bricking the preview window in Sublime Text (#261) which can automatically be set by querying which editor/client is being used.
The DocumentScope is an internal datastructure of ZLS that keeps track of variables, declarations and their scopes. Most analysis relies on it to perform symbol lookups, iterate symbols or quickly traverse scopes. Every time a document is modified, the DocumentScope is rebuilt for the entire document so it has been rewritten with Data-oriented design principles in mind to reduce its performance footprint. (#1517)
Here is a benchmark where the DocumentScope is constructed and deinitialized 100 times on Zig's Sema.zig:
Benchmark 1 (33 runs): ./document_scope_old
measurement mean ± σ min … max outliers delta
wall_time 3.67s ± 23.5ms 3.64s … 3.74s 2 ( 6%) 0%
peak_rss 11.1MB ± 64.1KB 10.9MB … 11.2MB 0 ( 0%) 0%
cpu_cycles 12.8G ± 99.1M 12.6G … 13.0G 1 ( 3%) 0%
instructions 24.3G ± 689 24.3G … 24.3G 2 ( 6%) 0%
cache_references 45.7M ± 848K 44.5M … 47.9M 1 ( 3%) 0%
cache_misses 6.36M ± 284K 5.89M … 6.92M 0 ( 0%) 0%
branch_misses 111M ± 1.20M 110M … 114M 0 ( 0%) 0%
Benchmark 3 (66 runs): ./document_scope_new
measurement mean ± σ min … max outliers delta
wall_time 1.82s ± 13.4ms 1.79s … 1.88s 3 ( 5%) ⚡- 50.4% ± 0.2%
peak_rss 8.19MB ± 57.8KB 8.08MB … 8.32MB 6 ( 9%) ⚡- 26.0% ± 0.2%
cpu_cycles 7.04G ± 51.3M 6.92G … 7.25G 3 ( 5%) ⚡- 44.9% ± 0.2%
instructions 9.86G ± 2.01K 9.86G … 9.86G 0 ( 0%) ⚡- 59.5% ± 0.0%
cache_references 45.4M ± 327K 44.7M … 46.3M 2 ( 3%) - 0.7% ± 0.5%
cache_misses 1.22M ± 462K 651K … 2.53M 8 (12%) ⚡- 80.9% ± 2.7%
branch_misses 79.4M ± 1.27M 75.9M … 81.0M 3 ( 5%) ⚡- 28.7% ± 0.5%
When encountering issues, do not hesitate to report your issues on the Github issue tracker or ZLS Discord Server.
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!
Full Changelog: https://github.com/zigtools/zls/compare/0.11.0...0.12.0
Thanks @Techatrix for writing these release notes!
Feature improvements:
New capabilities:
Analysis:
Performance:
Config:
Behind the scenes:
@import(builtin)
by @nektro in https://github.com/zigtools/zls/pull/445
inline fn
by @Jarred-Sumner in https://github.com/zigtools/zls/pull/479
std.math.cast
, std.ChildProcess
, tests on Windows and enable Windows in CI by @leecannon in https://github.com/zigtools/zls/pull/496
@import
/@embedFile
argument completions by @SuperAuguste in https://github.com/zigtools/zls/pull/514
zls.json
in setup wizard by @Techatrix in https://github.com/zigtools/zls/pull/568
]
by @leecannon in https://github.com/zigtools/zls/pull/581
zig build
work with latest master by @leecannon in https://github.com/zigtools/zls/pull/587
chmod +x
command to macOS install instructions by @haze in https://github.com/zigtools/zls/pull/640
textDocument/publishDiagnostics
by @Techatrix in https://github.com/zigtools/zls/pull/665
OptionsStep
in build_runner by @leecannon in https://github.com/zigtools/zls/pull/686
@minimum
and @maximum
with @min
and @max
in data/master.zig
. by @IntegratedQuantum in https://github.com/zigtools/zls/pull/713
Full Changelog: https://github.com/zigtools/zls/compare/0.9.0...0.10.0
zls release that works and compiles for the zig 0.9.0 release! Enjoy <3
Second zls release, hope this helps you write awesome Zig code!
First ZLS tagged release, have fun! zls.json with default options shipped along with the binary.