zigtools / zls

A Zig language server supporting Zig developers with features like autocomplete and goto definition
MIT License
2.65k stars 274 forks source link

Emacs, nothing works #906

Open jgarvin opened 1 year ago

jgarvin commented 1 year ago

Zig Version

0.11.0-dev.1095+8bd734d60

Zig Language Server Version

0.11.0-dev.107+20baa59

Steps to Reproduce

Note that rust-analyzer with lsp-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

jgarvin commented 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.

acristoffers commented 1 year ago

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.

Luexa commented 1 year ago

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?