-
-
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
vim freezes for a couple of seconds when saving go files #144
Comments
Hm that might due let g:go_fmt_command = "gofmt" If it's still slow can you test it with bare |
Thanks for answering so quickly. So, if I run both
If I run |
That one, plus it's doing double execution because otherwise Vim just destroys the history (doing a undo puts your cursor to the top of the file). The whole logic is here: https://github.com/fatih/vim-go/blob/master/ftplugin/go/fmt.vim#L75 Have a look maybe you can catch something that i couldn't see. There are also some comments. |
Alright, I'll try to take a look tonight and get back to you. |
I'm seeing this issue also. Top shows vim process chewing 100% CPU while the pause is happening. |
Is there a way I could get a demo file for testing? It seems I can't reproduce because of my machine. |
I'm having the same issue. It seems to be running GoBuild after saving the file. |
That's impossible. There is no single case where vim-go does it. Do you guys use https://github.com/scrooloose/syntastic ? |
Ah, yes. Thats the culprit, sorry about that. |
@mhfs and @porjo do you also use https://github.com/scrooloose/syntastic ? |
@fatih I'm no longer able to reproduce this issue. I had been using syntastic prior to vim-go but I'm fairly sure I wasn't using them together. I've since re-installed my OS so it's impossible to say...sorry, I can't be more help. |
I use syntastic, usually I set to passive with :SynasticToggleMode unless I want it do its thing. |
I'm going to close it but waiting for @mhfs. Let's clarify things here. |
@fatih I don't use syntastic. Also, I can see the delay by doing Unfortunately I didn't have the chance to explore the code yet. |
Also, the file content doesn't matter. A simple hello world takes a couple of seconds. package main
import (
"fmt"
)
func main() {
fmt.Println("hello")
} |
There must be definitely a problem on your system. Otherwise I would received a lot of complaints. vim-go is used already by thousands of people. |
I'm getting this issue occasionally now. I'm not using syntastic and it doesn't happen in every file. I'll do some research and let you know. |
Looks like maybe this is related to having undefined variables. I was in the process of renaming a variable (which was a struct), while I hadn't finished saving took about 2s. After the variables had finished being renamed the save took under 0.5s. My thinking on this is that goimport sees the I can't see how this is vim-go's fault but still the pause is annoying. |
That's why I've changed the default from |
I'm seeing this as well. Profiling around a
Syntastic shells out to GoFmt. I was scratching my head about why vim-go was seemingly ignoring my:
Nope, it wasn't. In my case I simply short-circuited the It appears to shell out to |
I was just having a play around with liteIDE and noticed that there is a setting for gofmt timeout. By default it is set to 0.5s. I wonder if implementing a timeout would be a good solution? If goimport takes longer than 0.5s then there probably was an error. |
In case it helps someone, this is what I'm seeing profiling a
|
Hi, |
Also seeing slowness on save due to syntastic.
@phuna You can profile using the following:
Then quit vim to write out the |
@bawigga This slowness problem has gone few weeks ago after I updated all plugins. I'll keep the link for later check if problem occurs again. Thank you for pointing it out. |
I, too, was encountering a substantial delay. Was able to resolve my issue by setting the vim shell to bash; I use fish otherwise. |
For my case 'vim slowdown' was in a form of constant recompilation of binary when working with compilable (main) package. This was caused by scrooloose/syntastic - disabling it helped. |
Shout out to @ernestas-poskus .. Vim-go does not play well with syntastic. |
You are right, found the issue myself, Syntastic was recompiling Go project every time on save. Redefining let g:syntastic_go_checkers = ['golint', 'govet', 'errcheck'] |
@ernestas-poskus 👍 for |
Thanks @ernestas-poskus! |
I've reproduced this issue. For anyone looking for the problem - It's probably syntastic (This was the problem for me) Edit: |
I am running into the same issue. I have a clean installation of nvim together with vim-go. There is anything in my config file besides I can see that most time spent is in promise.vim
And promise is used twice from lsp.vim:
There is another call like this. I am not sure what is it waiting for though. lsp is executed by gofmt (lsp#Format and lsp#Imports) |
I see the same behavior in both vim and nvim. |
I figured out this one, I ran Got the necessary stuff to get private repository going, did |
Running into the same issue describes above: count total (s) self (s)
` I have tried doing a |
@carpet-stain I'm facing the same issue also with the promise.vim file. Did you manage to resolve this issue eventually? If so how? |
Hey there, first of all thanks for all the work on vim-go.
I started using it a few days ago and something weird that's happening is that every time I save a file vim freezes for a couple of seconds and then gets back to normal business.
Is this something other people experience or is it something with my setup? If the later, would you be able to help me debug where the slowness is?
I'd really appreciate any help.
Thanks!
The text was updated successfully, but these errors were encountered: