Skip to content

feat: support ZLS with Zig 0.17 - #705

Open
cerisier wants to merge 17 commits into
mainfrom
cerisier/zls-0.17-parity
Open

cerisier wants to merge 17 commits into
mainfrom
cerisier/zls-0.17-parity

Conversation

@cerisier

Copy link
Copy Markdown
Member

ZLS on Zig 0.17 asks the Zig executable for build metadata. In Bazel workspaces, that metadata needs to come from the Bazel target graph for editor navigation to resolve imports and generated sources.

The 0.17 launcher serves fresh Bazel metadata through Zig's native build protocol. A patched ZLS prebuilt preserves absolute source paths, and the consumer test exercises go-to-definition and reload against a Bazel workspace. Zig 0.16 continues to use its custom build runner.

@cerisier cerisier changed the title Support ZLS with Zig 0.17 feat: support ZLS with Zig 0.17 Nov 12, 2026
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/README.md Resolved
Comment thread zig/zls/owned_process.zig Resolved
Comment thread zig/zls/owned_process.zig Resolved
Comment thread zig/zls/owned_process.zig Resolved
Comment thread zig/zls/owned_process.zig Resolved
Comment thread zig/zls/workspace_printer.zig Resolved
Comment thread zig/zls/zls_bsp.zig Resolved
Comment thread zig/zls/zls_runner_017.zig Resolved
@cerisier
cerisier marked this pull request as ready for review November 13, 2026 10:38
@cerisier
cerisier force-pushed the cerisier/zls-0.17-parity branch from 0b974a5 to 6819f1f Compare November 13, 2026 10:41
@cerisier
cerisier requested a review from aherrmann November 16, 2026 10:43
Comment thread zig/zls/owned_process.zig
const darwin_wexited = 0x4;
const darwin_wnowait = 0x20;

extern "c" fn waitid(c_uint, c_uint, *std.c.siginfo_t, c_int) c_int;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

On Linux stdlib provides waitid, that could remove the need for the libc dependency on Linux.

Saving through source.fixAll and source.organizeImports launches ast-check twice. Supervising each command adds a 250 ms cleanup grace period even after the SDK exits.

Replace the proxy with the SDK for ordinary compiler commands, preserving its process group, streams and native exit status. Keep supervision for the editor session and metadata service. Cover passthrough PID, arguments, streams, environment, working directory and exit status in the consumer test.
teh-cmc pushed a commit to zml/zml that referenced this pull request Nov 18, 2026
Saving Zig files runs two synchronous code actions. The compiler proxy
adds a 250 ms cleanup wait to each `zig ast-check`, making every save
noticeably slower.

Pin rules_zig to `fdad034e362e5de4190bd704cc8d17907117c57e` from
[rules_zig #705](hermeticbuild/rules_zig#705),
where SDK commands replace the proxy process directly and avoid that
delay.

Checked on macOS ARM64 with `bazel build --config=remote //:completion`
and the Neovim Lua/LSP save emulation using the existing Zig 0.17.0 SDK.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants