-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Slow autocomplete performance #2049
Comments
In general, the first time autocompletion is invoked for identifiers from a package may be slow, but after that it should be faster. There are some things you can do.
|
Thanks for the fast reply, I‘ll try that tomorrow in the morning. One thing from my mind: Both invocations took the same amount of time. Seems like there is something wrong with my setup. Have you any idea, what could cause this? Cheers |
I thought vim-go would use guru instead of gocode. |
It can use either for getting info, but for autocompletions it uses gocode. edit: fixed typo |
#2050 may help; can you give it a try? |
Kai Henry linked to a video that shows some of the gocode problems: https://s.natalian.org/2018-11-08/gocode.mp4 For anyone that's experiencing this problem, there's a few things to note. First, vim-go now uses github.com/mdempsky/gocode instead of github.com/nsf/gocode. mdempsky's version does not autobuild packages for you, so source code has to be parsed, which results in longer request times. Whether vim-go tells gocode to parse source code can be configured with Second, the time it takes gocode to get the identifiers for a package the first time seems to be quite slow. But subsequent attempts at getting identifiers from that same package should be significantly faster. Finally, it's important to know that if no autocompletions are attempted for some period of time (the last time I checked I think it was about 30 minutes), gocode's server component will exit and the next autocompletion attempt will start the server again and have to endure the longer wait times while gocode fills its cache again. |
Disabling |
You can drop to 1.18, this uses the NSF implementation which still works as expected. You can also disable |
The only option you have that's supported by vim-go is to install the packages that you want to autocomplete and then put github.com/nsf/gocode is not supported by vim-go; the author has very clearly said that he does not want to maintain it for the community. If you go that route, please do not file any issues about autocompletion problems here. |
Just to make it clear if I understand correctly: with How this is supposed to work? I've a project with dozens of packages, I've several files opened in vim (in different tabs), these files are usually from different packages… now I edit one file in one vim tab, like add new exported type, then switch to another tab to file in another package and try to autocomplete that new type… how and when I should run |
This is part of the problem with the new gocode: it doesn't autobuild packages, so if you add a new identifier and don't want are using We're kind of stuck between reliability and performance. If you want better performance, then there are some manual steps that you need to perform to get reliable autocompletion results with the current state of github.com/mdempsky/gocode. |
Maybe it is makes sense for vim-go to automatically run |
@powerman This has been discussed extensively before. See #2018 (comment). If that's something you want to do, you can easily configure an autocmd in your vimrc to do it. |
This is something similar to my approach. I don't install on save necessarily, but after each GoBuild, which is a leader mapping. |
Thanks for your help, updating gocode didn't help, as expected, but disabling g:go_gocode_propose_source did it! Ok, so this will be a workaround for now and I'll have a look at mdempsky/gocode#46, if I can help. Thank you so much, I'll close this for now. |
So, after reading through all issues regarding slow/non-working auto-complete our options today are:
I think, I'm sticking with (1) and: |
How it has ended? |
vscode :D |
It's impossible to betray vim, but suffering from gocode is something bad. |
Arrived at this thread years later - I'm still repeatedly waiting 10+ seconds for vim-go to load packages after starting vim. The solution I eventually arrived at was to not actually exit vim, but to close buffers within vim instead. In case it helps others, my current workflow to avoid the repeated initial load time is:
|
@houglum Chances are your issue is different, so it's worth creating a new issue and provide more details including your vim config. Also, it's always a good idea to try disabling all other plugins and see is that helps - maybe it's because of some plugins conflict. And you may also want to |
What did you do? (required. The issue will be closed when not provided.)
I've created a small vimrc with vim-go,
opened a Go file "github.com/tarent/loginsrv/login/handler.go"
Jumped to line 38 (first line of func NewHandler)
Inserted config.
And hit for autocompletion.
What did you expect to happen?
The omnicompletion pop up to open fast.
What happened instead?
Waited several seconds (round about 7s) for the pop-up menu to show up. (Even after a second time, when I expected a sort of cache to be built)
Configuration (MUST fill this out):
vim-go version: Current version installed with plug.
vimrc
you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc)::version
):go version
):go version go1.11.2 darwin/amd64
go env
):Which options do I have to speed this up? Did I miss some documentation?
Thanks in advance
The text was updated successfully, but these errors were encountered: