Closed leighmcculloch closed 6 years ago
Thanks for your contribution! Completor uses gocode to drive the auto completion for golang and gocode itself does not support extraction docs of the completion items. Right now I don't think it has any easy and efficient way to gather docs of completion items. Using subprocess is unacceptable. The pr #206 provide a workaround and intuitive way to view the docs of an item. Please check it out.
After updating to the latest commit to view the doc you can use the function call completor#do('doc')
with the following key mapping (You must have gogetdoc installed):
" view doc
noremap <silent> <leader>c :call completor#do('doc')<CR>
" go to definition
noremap <silent> <leader>d :call completor#do('definition')<CR>
@maralla Ah that's cool. I would have thought adding that functionality to this vim plugin in that way, as a new feature triggered with a key sequence instead of as part of completion, was outside the scope of this project. Especially given that vim-go
provides this functionality already with the :GoDoc
function.
Thanks for trying to find a way to make it accessible. I'll probably stick to using the vim-go option as that what I've already been using.
❤️
What
Add support for retrieving the Go doc using the godoc command and displaying that in the docs preview window.
Why
So that the docs for an identifier, function or struct can be viewed within VIM when scrolling through the list of possible autocomplete results. As discussed in #199.
Note
csv-with-package
gocode format includes the package name as the last (fourth) column in the csv. The package name is required when doing the godoc lookup.format_cmd
function only lets me return a single command, and so I've hacked the godoc call intoparse
, but that meansparse
is given a list of 100 possible autocompletions, it's calling godoc 100 times. I'd like to do the godoc call only when an option is selected and the doc is actually being displayed, but I can't see how to do that.