navigator.lua icon indicating copy to clipboard operation
navigator.lua copied to clipboard

Hard to debug errors in the LSP

Open nitnelave opened this issue 3 years ago • 6 comments

I'm trying to get this working with rust-analyzer, using the default config (at least for rust_analyzer). The setup overall is working for other languages, but rust_analyzer fails. However, the only message I have to try to debug this is when I open a rust buffer, it says Client 4 quit with exit code 101 and signal 0, which is not very useful.

How can I get the errors from the LSP to be able to diagnose the issue, or the actual command-line run to be able to reproduce it?

nitnelave avatar Apr 20 '22 12:04 nitnelave

Could you share your setup? You lsp log should be in ~/.cache/nvim/lsp.log

For me I use the default setup for rust_analyzer(nightly) it works fine so far. Could you share your minimum setup for me to reproduce? image

ray-x avatar Apr 20 '22 23:04 ray-x

Just to be clear, the issue here is not about my setup (it was simply a problem of rust-analyzer being out of date), but rather about the difficulty of tracking down the error, since there was no message. It would be nice to have an error message, at least pointing to the log files.

nitnelave avatar Apr 22 '22 13:04 nitnelave

You can enable the navigator log by set debug=true and the log will be available $HOME/.cache/nvim/gh.log. Also there are neovim lsp log. You can check the neovim help.

ray-x avatar Apr 23 '22 09:04 ray-x

I guess that's better than nothing, but having something pop up directly in the :messages if the client crashes would be nice.

nitnelave avatar Apr 25 '22 15:04 nitnelave

If fact the plugin has no idea why lsp crashed. You have to check the neovim lsp logs for that. Navigator provides logs on how you config the lsp. It wraps the lspconfig setup. As neovim will start up the lsp server and the neovim lua is a client communicating to the lspserver. So from neovim client side, it knows whether the client is alive or not, but not when or why server dies. Neovim lsp.log may have more info if you put it in verbose mode (require neovim rebuild) But I doubt it can really help you.

ray-x avatar Apr 26 '22 10:04 ray-x

Maybe in terms of UI and discoverability, just putting a message saying to check the lsp logs with the file path? I'm just trying to think about the perspective of the new user.

nitnelave avatar Apr 26 '22 11:04 nitnelave

Just to be clear, the issue is not about my setup not working correctly (I just needed to update rust analyzer) but rather about the lack of access to errors.

On Thu, 21 Apr 2022, 01:03 rayx, @.***> wrote:

Could you share your setup? You lsp log should be in ~/.cache/nvim/lsp.log

For me I use the default setup for rust_analyzer(nightly) it works fine so far. Could you share your minimum setup for me to reproduce? [image: image] https://user-images.githubusercontent.com/1681295/164338721-bdbe134b-4996-44a4-973f-147b3d868c89.png

— Reply to this email directly, view it on GitHub https://github.com/ray-x/navigator.lua/issues/174#issuecomment-1104535317, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAGCPWONK7E42W7JGP65WRDVGCEMTANCNFSM5T32P56A . You are receiving this because you authored the thread.Message ID: @.***>

nitnelave avatar Oct 11 '22 07:10 nitnelave

The plugin can output to log if there is something wrong with the LSP request. But in case of rust analyzer crash. It can not output anything useful. As that info is inside neovim itself and not exposed. If you want to update rust analyzer inside neovim, you can try mason.nvim plugin (aka lspinstaller) If you want more error info, you have to build the neovim with debug on and it will output additional lsp logs. But I feel it should be something really simple. Can you get your rust analyzer up and running with lspconfig? What is your config?

ray-x avatar Oct 11 '22 08:10 ray-x

Oh, wow the email took several months to be delivered to the github issue :D I haven't had any issue since then, I just sent the email back then. I'll close this, since you apparently can't surface the errors!

nitnelave avatar Oct 11 '22 09:10 nitnelave