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?
build.zig
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`).
b.installArtifact(exe);
build.zig.zon
.{
.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.
"build.zig",
"build.zig.zon",
"src",
"LICENSE",
"README.md",
},
}
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 = {
warn_style=true,
inlay_hints_show_variable_type_hints=true,
}
},
}