ZLS not pulling in information from dependencies

I’m starting to use packages. However when I add a dependency and start using it I’m unable to get any language server information (e.g, go to definition, function declaration information, completion suggestions) about the third party package. Is this a feature that ZLS doesn’t support yet, or am i just configuring wrong?


    const exe = b.addExecutable(.{
        .name = "multihash",
        .root_source_file = .{ .path = "src/main.zig" },
        .target = target,
        .optimize = optimize,

    const clap_dep = b.dependency("clap", .{});
    exe.root_module.addImport("clap", clap_dep.module("clap"));

    // This declares intent for the executable to be installed into the
    // standard location when the user invokes the "install" step (the default
    // step when running `zig build`).


    .name = "multihash",
    // This is a [Semantic Version](https://semver.org/).
    // In a future version of Zig it will be used for package deduplication.
    .version = "0.12.0",

    // This field is optional.
    // This is currently advisory only; Zig does not yet do anything
    // with this value.
    .minimum_zig_version = "0.12.0-dev.3158+1e67f5021",

    // This field is optional.
    // Each dependency must either provide a `url` and `hash`, or a `path`.
    // `zig build --fetch` can be used to fetch all dependencies of a package, recursively.
    // Once all dependencies are fetched, `zig build` no longer requires
    // internet connectivity.
    .dependencies = .{
        .clap = .{
            .url = "https://github.com/Hejsil/zig-clap/archive/refs/tags/0.8.0.tar.gz",
            .hash = "1220949d4e88864579067b6d4cdad6476c6176f27e782782c2c39b7f2c4817a10efb",
    .paths = .{
        // This makes *all* files, recursively, included in this package. It is generally
        // better to explicitly list the files and directories instead, to insure that
        // fetching from tarballs, file system paths, and version control all result
        // in the same contents hash.

I’m using neovim as my editor, and have zls configured as so (using nvim-lspconfig):

local zig_opts = {
	flags = {
		debounce_text_changes = 150,
	settings = {
		zls = {

Check whether :LspLog shows errors. Also for me it shows a bunch of info messages of the style Set config option 'enable_autofix' to 'true', I imagine those would be missing if the config doesn’t work.

my lazy config
return {
    init = function()
        settings = {
          zls = {
            path = "/home/sze/development/workspace/zig/active/current/zig",
            zls = {
              path = "/home/sze/development/workspace/zig/active/zls/zig-out/bin/zls",
              enable_snippets = true,
              enable_ast_check_diagnostics = true,
              enable_autofix = true,
              enable_import_embedfile_argument_completions = true,
              warn_style = true,
              enable_semantic_tokens = true,
              enable_inlay_hints = true,
              inlay_hints_hide_redundant_param_names = true,
              inlay_hints_hide_redundant_param_names_last_token = true,
              operator_completions = true,
              include_at_in_builtins = true,
              max_detail_length = 1048576,
1 Like

I’m not familiar with Zig, but I had the same problem and found that my ZLS version was 0.11.0 while Zig is 0.12.0. After updating ZLS, it worked perfectly for me. It might help you to check if your ZLS is up to date or matches your Zig version.