ZLS issues with VS code

I am using the latest prebuild binaries from both zig and zls and I am running into some problems, some may be features that are just not supported yet, in that case just let me know.

  1. No suggestions and syntax highlighting from modules
    I have the following file structure:
Project
 |
 +-- module1
 |  |  
 |  +-- src
 |  |  |
 |  |  +-- root.zig
 |  +-- build.zig
 |  +-- build.zon.zig
 +-- application
 |  |  
 |  +-- src
 |  |  |
 |  |  +-- main.zig
 |  +-- build.zig
 |  +-- build.zon.zig

Inside module I get the correct suggestions and references but not in the application when the module is installed as follows in build.zig

const module1 = b.dependency("module1 ", .{
        .target = target,
        .optimize = optimize,
    });
    step.root_module.addImport("module1 ", module1.module("module1"));
}

In the build.zig.zon the dependency is specified as:

.module1 = .{
    .path = "../module1",
},
  1. No suggestions and syntax highlighting from some header files. some also work fine. for example, for windows I get the correct suggestions from the windows.h file
pub usingnamespace @cImport({
    @cDefine("WIN32_LEAN_AND_MEAN", "1");
    @cInclude("windows.h");
});

but for vulkan it doesn’t seem to work eventhough I add the include path in build.zig of module1 like this:

if (b.env_map.get("VK_SDK_PATH")) |path| {
    module.addLibraryPath(.{ .cwd_relative = std.fmt.allocPrint(b.allocator, "{s}\\lib", .{path}) catch @panic("OOM") });
    module.addIncludePath(.{ .cwd_relative = std.fmt.allocPrint(b.allocator, "{s}\\include", .{path}) catch @panic("OOM") });
} else {
    std.log.err("Vulkan SDK not found", .{});
    std.os.exit(1);
}

where the resulting path becomes: C:\VulkanSDK\1.3.236.0\Include and C:\VulkanSDK\1.3.236.0\Lib which are both correct as the vulkan code does compile.

  1. No suggestions regarding header paths when added.

Are these unsupported features or are these problems with my current setup? I have some trouble finding that out.

1 Like