zls
zls copied to clipboard
ZLS fails to resolve Zig standard library directory
Zig Version
0.15.1
ZLS Version
0.15.0
Client / Code Editor / Extensions
nvim 0.11.3 & neovim/nvim-lspconfig with Mason
Steps to Reproduce and Observed Behavior
- Download Zig version
0.15.1and add the installation folder to the path - Clone Neovim kickstart configuration in
.config/nvim/ - Change the LSP section as follows:
local servers = {
-- clangd = {},
-- gopls = {},
-- pyright = {},
-- rust_analyzer = {},
-- ... etc. See `:help lspconfig-all` for a list of all the pre-configured LSPs
--
-- Some languages (like typescript) have entire language plugins that can be useful:
-- https://github.com/pmizio/typescript-tools.nvim
--
-- But for many setups, the LSP (`ts_ls`) will work just fine
-- ts_ls = {},
--
-- Add ZLS down here
zls = { cmd = { '/home/user/dev/scripts/zls/zig-out/bin/zls' } },
lua_ls = {
-- cmd = { ... },
-- filetypes = { ... },
-- capabilities = {},
settings = {
Lua = {
completion = {
callSnippet = 'Replace',
},
-- You can toggle below to ignore Lua_LS's noisy `missing-fields` warnings
-- diagnostics = { disable = { 'missing-fields' } },
},
},
},
}
- Open any Zig file
- ZLS sends this error:
LSP[zls][Warning] zig standard library directory could not be resolved.
Expected Behavior
I expect ZLS to automatically find the standard library directory based on the Zig installation path as was the case in ZLS 0.14.0.
Log Output
info ( main ): Starting ZLS 0.14.0 @ 'zls'
info ( main ): Log File: /home/user/.cache/zls/zls.log (info)
info (server): Client Info: Neovim-0.11.3+gb2684d9f66
info (server): Autofix Mode: source.fixall
info (server): added Workspace Folder: file:///home/user/dev/scripts/aoc
error (config): Failed to parse zig env JSON result
info (server): Set config option 'builtin_path' to "/home/user/.cache/zls/builtin.zig"
info (server): Set config option 'zig_exe_path' to "/home/user/.zig/zig"
info (server): Set config option 'global_cache_path' to "/home/user/.cache/zls"
info (store ): Loaded build file 'file:///home/user/dev/scripts/aoc/build.zig'
error (config): Failed to parse zig env JSON result
warn (server): zig standard library directory could not be resolved
info ( main ): Starting ZLS 0.14.0 @ 'zls'
info ( main ): Log File: /home/user/.cache/zls/zls.log (info)
info (server): Client Info: Neovim-0.11.3+gb2684d9f66
info (server): Autofix Mode: source.fixall
info (server): added Workspace Folder: file:///home/user/dev/scripts/aoc
error (config): Failed to parse zig env JSON result
info (server): Set config option 'builtin_path' to "/home/user/.cache/zls/builtin.zig"
info (server): Set config option 'zig_exe_path' to "/home/user/.zig/zig"
info (server): Set config option 'global_cache_path' to "/home/user/.cache/zls"
info (store ): Loaded build file 'file:///home/user/dev/scripts/aoc/build.zig'
error (server): failed to write message: error.BrokenPipe
error ( diag ): failed to publish diagnostics: error.BrokenPipe
According to the provided log you are using zls 0.14.0
According to the provided log you are using zls 0.14.0
I know it's weird since I built it from source using tag 0.15.0.