I could not get Zls working on Windows using this method (package manager).
But I did manage to get it working with raylib as a submodule. Example here GitHub - everystone/raylib-zig-template
Tested on linux, zls is working.
Now that zls has a 0.12.0 release everything seems to work fine. @msw and @Eirik if you want, you could try again with these versions?
I logged what I did in case it would prove useful to communicate what’s going wrong if there’s something wrong or what mistake(s) I might’ve made – turns out this now is a log of a successful test’s “debug output”:
mkdir zls-test
## NVIM config
# Start with a fresh nvim config
# I am a newbie to nvim (coming from pluginless vim)
# so I use what others think is a "modern" editing experience
git clone https://github.com/LazyVim/starter ./zls-test/config/nvim
rm -Rf zls-test/config/nvim/.git
# let lazyvim starter kit plugin cascade setup & install..
env XDG_CONFIG_HOME=${HOME}/zls-test/config\
XDG_STATE_HOME=${HOME}/zls-test/state\
XDG_DATA_HOME=${HOME}/zls-test/data\
nvim
## ZLS
# get zls as per instructions;
# install zls by copying the binary to zls-test/zls
## RAYLIB example
cd zls-test
git clone https://github.com/SimonLSchlee/zigraylib.git zrl
cd zrl
zig build run ;# ok - works
## Now for the hard (for me) part. Configure to use zls.
# disable mason:
<<EOF cat > ~/zls-test/config/nvim/lua/plugins/no-mason.lua
return {
-- disable mason
{ "williamboman/mason.nvim", enabled = false },
}
EOF
# configure via nvim-lspconfig
<<EOF cat > ~/zls-test/config/nvim/lua/plugins/zls-lspconfig.lua
return {
{
"neovim/nvim-lspconfig",
opts = {
servers = {
zls = {
cmd = {
"/home/phaeton/zls-test/zls",
},
settings = {
zls = {
zig_exe_path = "/home/phaeton/.zvm/bin/zig",
},
},
},
},
},
},
}
EOF
## fine, let's try this?
env XDG_CONFIG_HOME=${HOME}/zls-test/config\
XDG_STATE_HOME=${HOME}/zls-test/state\
XDG_DATA_HOME=${HOME}/zls-test/data\
nvim src/main.zig
# check lsp attachment via :LspInfo, outputs attached client:
# Client: zls (id: 1, bufnr: [1])
# filetypes: zig, zir
# autostart: true
# root directory: /home/phaeton/zls-test/zrl
# cmd: /home/phaeton/zls-test/zls
#
# toying around: yes, indeed it works!
So, it seems to me I can make this work from scratch.
Thanks!
(tested with zvm-installed zig 0.12.0, manually installed zls as per above, no ${XDG_CONFIG_HOME}/zls.json etc., all config present above in log)
I took another look at raylib’s build.zig and raygui, and realized that it can be integrated more easily than I thought (or than it could in the past / not quite sure which) into an example.
Checkout the raygui branch if you want to use raylib + raygui.