when I jump to a definition of a function/type used in one of the source files of the project and get sent to std/somewhere else, it doesn't do syntax highlighting for those files, only the files under my project. lsp completion works there but not syntax highlighting. this issue only happens when I open source files inside/under a project. when I open a zig file that isn't under a project and jump to a definition, it highlights the other files correctly.
#In projects, ZLS does syntax highlighting only for files under the project, not files outside (std)
1 messages · Page 1 of 1 (latest)
example:
project's main.zig:
when I jump to definition of posix:
if I do this again but main.zig is NOT under a project with a build.zig etc..:
my zls setup in nvim:
what's the zls log look like
like the output of lspinfo or something else?
not sure how you have it all set up/how it works in neovim, but check .cache/zls/zls.log
info ( main ): Starting ZLS 0.15.1 @ '/usr/local/bin/zls'
info ( main ): Log File: /home/toji/.cache/zls/zls.log (info)
info (server): Client Info: Neovim (0.12.0-dev+b92b95e)
info (server): added Workspace Folder: file:///home/toji/dev/quartz/quartz
info (server): Set config option 'semantic_tokens' to "partial"
info (server): Set config option 'builtin_path' to "/home/toji/.cache/zls/builtin.zig"
info (server): Set config option 'zig_lib_path' to "/usr/lib/zig"
info (server): Set config option 'zig_exe_path' to "/usr/bin/zig"
info (server): Set config option 'build_runner_path' to "/home/toji/.cache/zls/build_runner/<hash>/build_runner.zig"
info (server): Set config option 'global_cache_path' to "/home/toji/.cache/zls"
info (server): trying to start Build-On-Save for 'file:///home/toji/dev/quartz/quartz'
info ( main ): Starting ZLS 0.15.1 @ '/usr/local/bin/zls'
info ( main ): Log File: /home/toji/.cache/zls/zls.log (info)
info (server): Client Info: Neovim (0.12.0-dev+b92b95e)
info (server): Set config option 'semantic_tokens' to "partial"
info (server): Set config option 'builtin_path' to "/home/toji/.cache/zls/builtin.zig"
info (server): Set config option 'zig_lib_path' to "/usr/lib/zig"
info (server): Set config option 'zig_exe_path' to "/usr/bin/zig"
info (server): Set config option 'build_runner_path' to "/home/toji/.cache/zls/build_runner/<hash>/build_runner.zig"
info (server): Set config option 'global_cache_path' to "/home/toji/.cache/zls"
doesn't look like there are errors
while viewing the external files?
yep
here's the zls part of the output I get when running :LspInfo:
https://0x0.st/PHl-.txt
what's your build.zig look like
const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const exe = b.addExecutable(.{
.name = "quartz",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{},
}),
});
b.installArtifact(exe);
const run_step = b.step("run", "Run the app");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| run_cmd.addArgs(args);
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
const run_exe_tests = b.addRunArtifact(exe_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_exe_tests.step);
}
very basic