Skip to content

Releases: zigtools/zls

zls 0.13.0

09 Jun 00:27
Compare
Choose a tag to compare

This release is meant to provide compatibility with Zig 0.13.0

New Contributors

Full Changelog: 0.12.0...0.13.0

zls 0.12.0

26 Apr 14:30
Compare
Choose a tag to compare

Installing ZLS for the first time? Check out the Installation Guide!

What's Changed

New Type Hints (#1444) (#1512) (#1778)

New inlay hints have been added for variable declarations, captured values and struct literal fields.

new type hints

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

Build on Save (#1361)

The new enable_build_on_save config option enables ZLS compile your project with zig build and report back diagnostics.

new build on save

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.

Completions

highlight symbols that call @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).

completions on compile error

Note: The error message does not need to start with "Deprecated;".

Semantic highlighting of deprecated symbols in VS Code

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
    },
  }
},

Detail field to pointer deref and optional unwrap operations (#1745)

Completions of the .* and .? operations will now show the result type.

completions on an optional
completions on a single item pointer

Filesystem completion in build files (#1668)

While editing a build.zig file, you will now receive filesystem completions inside string literals when typing a valid file path.

filesystem completions in build.zig

Module completions for std and builtin (#1656)

Completions inside an @import will include the std and builtin module with their file path. (#1656)

std module completion

completions with 'replace' instead of 'insert' (#1458)

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.

completions for function aliases with self parameters (#1656)

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.

completions on function alias

Snippets

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)

Configuration

validate configuration options (#1366)

The config system has been revamped to validate config options like executable or directory paths and provide better diagnostics.

error messages on bad config

When your editor does not support displaying a message window, you will still find them in ZLS's log output.

ZLS+Zig compatibility check (#1808)

ZLS has the following compatibility requirements:

  • A tagged release of Zig or ZLS must be used with the same tagged release of Zig or ZLS
  • A master/nightly build of ZLS requires master/nightly build of Zig

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:

ZLS 0.12.0 being used with Zig 0.12.0-dev
ZLS 0.12.0 being used with Zig 0.11.0

When your editor does not support displaying a message window, you will still find them in ZLS's log output.

autofix disabled by default

The autofix feature is now disabled by default. (#1657)

removed enable_ast_check_diagnostics

Getting quickly informed about compile errors while coding is a vital feature that has little reason to be disabled.

removed enable_import_embedfile_argument_completions

This feature has been unstable in the past which is no longer the case.

removed include_at_in_builtins

This options served as a workaround for an issue with builtin completions in Sublime Text 3 which has been resolved.

removed 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.

Performance

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%

experiencing issues with ZLS?

When encountering issues, do not hesitate to report your issues on the Github issue tracker or ZLS Discord Server.

New Contributors

Read more

zls 0.11.0

13 Aug 16:23
5bfff2a
Compare
Choose a tag to compare

Thanks @Techatrix for writing these release notes!

Feature improvements:

New capabilities:

  • textDocument/selectionRange (#784)
  • textDocument/semanticTokens/range (#1038)

Analysis:

  • experimental comptime interpreter (#724)
  • branching type resolution (#1031)
  • add anytype resolution based on call references (#1067)
  • resolve type of simple labeled block (#1262)
  • expand var decl alias resolution (#1273)
  • resolve std.ArrayList(T).Slice (#1373)
  • resolve type of loop expressions (#1310)
  • resolve types of slice.len, slice.ptr, and tuple fields (#1315)

Performance:

Config:

  • make argument placeholders optional (#1317)
  • make semantic token configuration an enum (#1064)
  • enable all capabilities by default (#877)

Behind the scenes:

  • switch to diff-match-patch (#982)
  • add a replay feature to zls (#857)
  • code formatting does not depend on zig executable. (#755)
  • update zig submodules to new builtin dependency system (#1017)
  • disable and then reenable cimport resolution (#1091) (#1136)
  • use zig-lsp-codegen (#850)
  • transition from tres to std.json (#1321)

zls 0.10.0

02 Nov 02:21
7ef2244
Compare
Choose a tag to compare

What's Changed

Read more

zls 0.9.0

23 Dec 05:37
cb4e742
Compare
Choose a tag to compare

zls release that works and compiles for the zig 0.9.0 release! Enjoy <3

zls 0.2.0

12 Dec 01:18
abe82f6
Compare
Choose a tag to compare

Second zls release, hope this helps you write awesome Zig code!

zls 0.1.0

15 Nov 22:13
bf4f653
Compare
Choose a tag to compare

First ZLS tagged release, have fun!
zls.json with default options shipped along with the binary.