zls icon indicating copy to clipboard operation
zls copied to clipboard

Can't find Zig built in header

Open iacore opened this issue 2 months ago • 1 comments

Zig Version

0.15.1

ZLS Version

0.15.0

Client / Code Editor / Extensions

VS Code

Steps to Reproduce and Observed Behavior

  1. extract a.tar.gz
  2. Open project in VS Code
  3. Open main.zig
Image

Expected Behavior

zls should find the header.

Log Output


iacore avatar Oct 09 '25 12:10 iacore

I think zls doesn't scan added include path or sysroot. I hope that zls could work for cross-compiled programs.

Currently, this won't work:

    const in_zls = b.option(bool, "zls", "ZLS mode") orelse false;
    std.debug.print("in_zls: {}", .{in_zls});

...
// exe has .link_libc = true

    if (in_zls) {
        exe.root_module.addIncludePath(.{ .cwd_relative = "/sysroot/usr/include" });
    }

iacore avatar Oct 09 '25 13:10 iacore