-
Notifications
You must be signed in to change notification settings - Fork 656
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Display GoDoc when autocompleting in Vim #83
Comments
This feature request appeared many times. Shortly: no. The reasons why I don't want to add documentation display in gocode is that gocode doesn't parse the source code (that's where documentation is). It uses compiled libraries directly which contain only type information. However, gocode can be used to extract type information about the thing under the cursor and perhaps then some other service could be used to find the related documentation. No one did it so far and I'm not interested in that at all. If someone wishes to do this, I will cooperate. |
@nsf I was looking into this a bit, and I think all I would have to do is have gocode return the package and type the symbol that is autocompleted to. Unfortunately, I was looking at the source, and it seemed like it would be somewhat difficult to extract this context out of how things are stored since most of the mappings are from package name -> *, and I need to make from the symbol to the package name. The other thing I was thinking is if gocode were able to return the position and source file it found the symbol in originally, it would be pretty easy to add ctags-like functionality to the plugin. If you could provide some guidance how one could go about modifying gocode to propagate more of the context of the symbols it is auto-completing for, it would be a huge help. Also let me know if you don't feel this functionality is appropriate for gocode and belongs in a different sort of module. |
Yeah, I tried a couple of things today too and it didn't work, I'll try few more things tomorrow and will post a detailed report on that. I think gocode has all you need to get the full library path and the printable type out of it, but it's not as simple as I was expecting. |
So, I've just committed this thing: 64791d9 As commit says:
Perhaps it's not exactly what you want (it returns the type of the expression before the dot '.'), but it's a starting point. Good luck with that, as you can see what I did is just about 130 lines of code. |
@nsf Thanks! I think that will be a good starting point. |
That's awesome. I think I'll find this useful too. Thanks @nsf! |
I dont like this feature neither, at least not by default. I hate plugins which opens windows when I don't want it :-) |
Can we close this feature. I really hate when a new window opens and I can't close it. It's annoying. Any settings for disabling it? |
@Farslan This feature wasn't implemented. If you're using vim, perhaps |
@nsf thanks for the tip, I didn't know that vim caused this problem :) |
@nsf - picking up where you left off on 64791d9 (and the 'hidden' The behaviour you implemented was different to what I expected given the name "cursortype". Taking this very basic example: package main
import (
"fmt"
)
func main() {
my_string := fmt.Sprintf("This is a test %d", 5)
fmt.Println(my_string)
} With the cursor over With the cursor over the first i.e. the implementation would be something like this - very very rough cut... but you get the idea. Have I misunderstood what was intended for If so, would you be happy to accept a PR which implements the behaviour (code tidied up or course) It not, would you be happy to accept a PR which fixes the behaviour? |
Whatever works for you guys. If it doesn't break anything else. |
Awesome. I will create a PR to implement this more along the lines of what the name suggests. |
Just a feature request:
When using omnicomplete for languages like python, vim can display the documentation for the function.
This would be awesome if gocode did it with godoc.
Here's an example of what the python autocomplete it looks like in vim:
The text was updated successfully, but these errors were encountered: