Skip to content
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

let g:go_auto_type_info = 1 causes buffer slowdown and garbage characters #1496

Closed
SophisticaSean opened this issue Oct 5, 2017 · 11 comments
Assignees

Comments

@SophisticaSean
Copy link

Behavior

When go_auto_type_info is enabled, vim will hang for a bit while figuring out the types automatically. This causes control commands to be shoved into the buffer.

Steps to reproduce:

  1. Get vim-go up and running.
  2. Open a .go file with a decent amount of code in it.
  3. Cursor over any variable and start moving your cursor around with movement keys.
    You may have to let it sit for 800ms by default for auto_type_info to try and update.
  4. You'll see movement keys inserted into the buffer when vim tries to figure out what the time of the var you were looking at was.

Disabling go_auto_type_info fixes this issue.

Configuration

  • .vimrc:
execute pathogen#infect()
syntax on
let g:go_auto_type_info = 1 
set updatetime=10
  • vim version: VIM - Vi IMproved 8.0 (2016 Sep 12, compiled Oct 4 2017 09:34:57) MacOS X (unix) version Included patches: 1-1171 Compiled by Homebrew
  • vim-go version: latest as of Oct 3rd (git hash: 96995056cbe744119ebd53e31068e713fa08db61)
  • go version: go version go1.9 darwin/amd64
@arp242
Copy link
Contributor

arp242 commented Oct 5, 2017

Well, with an updatetime of 10 you'll calling an external command quite often, so it's not unexpected that this is slow ;-)

It could be improved with async probably.

@SophisticaSean
Copy link
Author

SophisticaSean commented Oct 5, 2017 via email

@bhcleek
Copy link
Collaborator

bhcleek commented Oct 5, 2017

@SophisticaSean I've seen similar things for a while, and have been trying to track down the exact cause. You can help me track down the root cause by letting me know:

  1. Have you tried using guru instead of gocode by setting g:go_info_mode = 'guru'? Do you see the same behavior?
  2. When using gocode, is it possible that you have go files loaded into multiple instance of vim?
  3. When using gocode, does it make any difference if you wait for the first request to complete? (i.e. do you see any difference in responsiveness when gocode is warmed up?)

@SophisticaSean
Copy link
Author

SophisticaSean commented Oct 6, 2017 via email

@bhcleek
Copy link
Collaborator

bhcleek commented Oct 6, 2017

You might try getting guru working for you. On my machine I still see some delays, but not long periods where vim is unresponsive when I use guru instead of gocode for the info mode when let g:auto_type_info = 1.

robbiev added a commit to robbiev/dotfiles that referenced this issue Oct 21, 2017
@bhcleek
Copy link
Collaborator

bhcleek commented Mar 23, 2018

With a series of recent merges (#1713, #1697, #1671), I no longer see garbage characters. @SophisticaSean Can you give the latest master a try and see if the problem is resolved for you, too?

@bhcleek bhcleek self-assigned this Mar 23, 2018
@cherrot
Copy link

cherrot commented Mar 23, 2018

@bhcleek It is fixed for me. Thank you!

@cherrot
Copy link

cherrot commented Mar 23, 2018

UPDATE: It seems that the issue still remains (on my OSX with vim 8.0 and linux with vim 7.4), but not so often as previous. I can just ignore it when it appears once or twice.

I have set:

let g:go_auto_type_info = 1
let g:go_auto_sameids = 1

and left g:go_updatetime in its default (which is 800 I believe), FYI

cherrot added a commit to cherrot/vimrc that referenced this issue Mar 23, 2018
@bhcleek
Copy link
Collaborator

bhcleek commented Mar 23, 2018

There's not much we can do about it occuring vim 7.4, though it should be less of a problem than it was before on vim 7.4.

And it may still occur when your GOPATH is large and you open a file in a package that hasn't had any of its files opened in the vim session yet.

Having said that, are you still seeing it on vim 8.0 more often than when a file for a package is opened the first time in a vim session? Are you using gocode or guru for g:go_info_mode?

@cherrot
Copy link

cherrot commented Mar 26, 2018

@bhcleek Yes. On my vim 8.0, I'm seeing it only when a file for a package is opened the first time in the vim session.
And when it occurs, the garbage characters blink for 1 second and then disappears. So it is not a big problem for me now.

I'm using gocode for g:go_info_mode, which is the default.

@bhcleek
Copy link
Collaborator

bhcleek commented Mar 27, 2018

Thank you for confirming @cherrot. I don't see a good solution yet for solving that particular use case. I'll keep my eye on it, though, and will try to resolve it if I can.

@bhcleek bhcleek closed this as completed Nov 21, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants