Open jgarvin opened 1 year ago
I later tried in vs-code, which put up an error that ZLS couldn't find zig and I needed to set zig_exe. For anyone who finds this in the future, running zls --show-config-path
will tell you where the zls config file is. It expects a top level JSON object, then you can put the key zig_exe
with the path, e.g.:
{
"zig_exe_path" : "/home/xxxx/zig/zig"
}
This was needed because I didn't change my $PATH to include zig.
I'm assuming that if vs-code got the error but emacs didn't that emacs not showing the error is an lsp-mode problem rather than a zls issue, but I'm not sure. Maybe there should be an installation note in README about zls needing zig in the path or for this option to be set though? If so I would have done it as part of the install. At the least there's nothing in the emacs specific directions for this.
Both Neovim and Emacs will write this error to the lsp-log file/buffer, but not show a notification. The notification in VSCode probably comes from the plugin, and not from zls itself.
With lsp-mode
, ZLS stderr goes to a buffer zls::stderr
rather than something directly managed by the LSP client. Perhaps you could try looking in this buffer?
Zig Version
0.11.0-dev.1095+8bd734d60
Zig Language Server Version
0.11.0-dev.107+20baa59
Steps to Reproduce
M-x install-packages
and installlsp-mode
andzig-mode
(setq lsp-zig-zls-executable "~/zls/zig-out/bin/zls")
with your zig path substituted.foo
and runzig init-exe
insidebuild.zig
ormain.zig
in emacs. It should ask if you want to import the project, press 'i' for yes. Messages will indicate successful connection to ZLS.M-x lsp-find-references
on any symbol will not work, even symbols in the same file.M-x lsp-find-definition
will only work on the symbols defined in build.zig or main.zig. Looking up anything imported from std will not work.Note that
rust-analyzer
withlsp-mode
works, so I don't think it's my emacs setup, but emacs is huge so :shrug:Expected Behavior
For finding definitions and references to work.
Actual Behavior
M-x lsp-find-references
on any symbol will not work, even symbols in the same file.M-x lsp-find-definition
will only work on the symbols defined in build.zig or main.zig. Looking up anything imported from std will not work.