Closed ndreas closed 2 years ago
Hey there @ndreas
I actually thought this wasn't possible. I thought this because look at how we do the expand:
followed by:
https://github.com/ldelossa/litee.nvim/blob/main/lua/litee/lib/lsp/init.lua#L12
What I thought would occur is, we'd never even send the request if the given client in a multi-client request does not support this.
Can we dig a little deeper into why client.supports_method
is not working correctly?
I'll take a look, the division between litee
and litee-calltree
made me figure it just wasn't handled in the expand. I get no error with the initial vim.lsp.buf.incoming_calls()
though, but I think that may be because errors are swallowed in the regular lsp handlers somewhere.
Sorry about the confusion, it looks like it's an languageserver that is misbehaving. Thanks for your plugin and for pointing me in the right direction!
@ndreas no problem. also, i'm not opposed to putting in fixes for bad-acting language servers, with some degree of discretion. I kinda do figure, there's going to be some patch work in these plugins to deal with the myriad of language servers available. If you can't find a fix, lmk, we can still consider something like this.
Actually, it's a thing missing in Neovim's code: https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp.lua#L35 This is a map for all the capabilities, and if there is no mapping, it's assumed to be supported: https://github.com/neovim/neovim/blob/master/runtime/lua/vim/lsp.lua#L969
The calls for callHierarchy/incomingCalls
and callHierarchy/outgoingCalls
are missing, so it returns true
.
I fixed it temporarily by adding this to my config:
vim.lsp._request_name_to_capability["callHierarchy/incomingCalls"] = "call_hierarchy"
vim.lsp._request_name_to_capability["callHierarchy/outgoingCalls"] = "call_hierarchy"
And I will make a PR for Neovim. This kind of thing should not be the responsibility of your plugin.
Wow, nice find! Thanks.
This plugin is awesome, and it really helped me with finding traces of calls through a complex code base. Thank you!
I noticed something though, I run multiple language servers usually, one for the language and one for separate formatters and linters, and whenever I want to expand the calltree, I get an error from those servers that do not support the incoming/outgoing calls. This PR just checks if the error on expansion is the
MethodNotSupported
and silently ignores it. Any other errors are logged.