Closed take closed 4 years ago
You actually don't need to call hover (in fact that would not work), as the documentation for each item comes from the language server itself in the completion response. You should be able to show that documentation as you scroll through the list by adding this to your config: set completeopt += preview
.
Note that that will show the documentation in the preview window, if you want to show it somewhere else then you will probably have to config your completion plugin (ncm2, deoplete, or whatever you use) to do so (if it's possible to do so).
@martskins
Aha thanks! Looks like I don't get the preview info although I have preview
inside completeopt
. Should I create a issue on the autocomplete plugin repo? :eyes:
Or do you know anyways to debug this problem? :bow:
I'd probably set the log level to INFO
and check the logs first to see if the completion items that you are getting include the documentation
key. Or just try the same config you are using with some other language server (maybe for another language too) and see if that works that way.
Some things that might be useful:
Set the logging level: let g:LanguageClient_loggingLevel = 'INFO'
Set log file path: let g:LanguageClient_loggingFile = '/some/path/lcn.log'
@martskins
thanks! I tried it out and seems like there weren't any documentation
key although :call LanguageClient#textDocument_hover()
does work .... 🤔
log: https://gist.github.com/take/54fb4bf9a30c336bb63ffcdf12102bc1
Does this mean that the language server does return the document when I specify it via :call LanguageClient#textDocument_hover()
, but doesn't when I'm autocompleting it...? 🤔
I tried both javascript-typescript-langserver
and typescript-language-server
and got the same results hmmmm 🤔
Looking at javascript-typescript-langserver
's code, it seems like it doesn't return the documentation for the returned items in the textDocument/completion
call, it instead returns the documentation in the completionItem/resolve
call. I'm not sure which events are available in order to identify that you changed selection in your completion options, but if the completion plugin you are using provides some sort of callback for that then you could probably write a function to fire that completionItem/resolve
request and open the documentation somewhere.
Maybe someone has a better idea of how to tackle this though, so don't take this as a it can't be done
:smile:
Looking at javascript-typescript-langserver's code, it seems like it doesn't return the documentation for the returned items in the textDocument/completion call, it instead returns the documentation in the completionItem/resolve call.
ooooooo i seeee..... and looks like javascript-typescript-langserver is returning it in resolve
due to performance issue... 🤔
I googled completionItem/resolve
and found out this issue is a duplicate of #875 :) I'll close this for now, thanks for the help 🙋 @martskins
@take Opened #1043 to try and kicks things off about implementing this in our side, as it seems it may require that extra completionItem/resolve
call in some cases/servers.
@martskins ooooo thanks! I'll try it out :D
Hi thanks for the awesome library :)
IDK if this is the right place to ask, is it possible to call
LanguageClient#textDocument_hover()
when selecting inside the autocomplete? :eyes:e.g. in the image below, I want the document to be shown automatically as I go around the completion