-
Notifications
You must be signed in to change notification settings - Fork 54
Gocode Golang Completion
Golang autocompletion plugin using gocode engine.
The gohints plugin uses the package:
However nsf is not being maintained anymore. It is advisable to use:
https://github.com/mdempsky/gocode
You need to install the gocode package.
Then open your ~/.vy/vyrc file and place the code below in the extra plugins section.
from vyapp.plugins.gohints import GolangCompletion
GolangCompletion.PATH ='/path/to/gocode'
autocall(GolangCompletion)
The attribute PATH is the gocode executable. Supposing your go projects stay in ~/.go/ then the gocode would stay in ~/.go/bin/.
After that just open some go file and press:
<Control-Key-period>
In INSERT mode for getting hints, The event above happens when you keep control key held and press the period key.
Note: In case gohints doesn't work then run the daemon in debug mode. It will display info about gohints requests.
gocode -s -debug
It may issue something like:
[tau@archlinux ~]$ gocode -s -debug
2020/07/03 19:09:54 listen unix /tmp/gocode-daemon.tau: bind: address already in use
In that case you can remove the gocode-daemon file.