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

UI is blocked whilst gopls is being initialized #2414

Closed
aignas opened this issue Jul 21, 2019 · 7 comments
Closed

UI is blocked whilst gopls is being initialized #2414

aignas opened this issue Jul 21, 2019 · 7 comments

Comments

@aignas
Copy link

aignas commented Jul 21, 2019

Currently vim-go is blocking the UI whilst gopls is loading. Although I understand that gopls is essential for this plugin to function well, I think that the user should not have to wait for the server to start before they can start editing. This was not happening before gopls support and I think that this is a regression from the previous user experience.

Would it be possible to disable gopls with a configuration switch or make it non blocking? I know that there is already #2250, but I thought that creating a new issue better in this case we have a performance degradation.

What did you do? (required: The issue will be closed when not provided)

Open a a go file in a large repository.

What did you expect to happen?

I can edit the file immediately.

What happened instead?

gopls is being loaded for about a second and the UI is unresponsive.

Configuration (MUST fill this out):

Default vim-go configuration.

vim-go version:

Latest master.

vimrc you used to reproduce (use a minimal vimrc with other plugins disabled; do not link to a 2,000 line vimrc):

set nocompatible
scriptencoding utf-8

let s:data_dir = $HOME . '/.local/share/nvim'
call plug#begin(s:data_dir . '/plugged')
Plug 'fatih/vim-go'
call plug#end()

Vim version (first three lines from :version):

$ nvim --version
NVIM v0.4.0-dev
Build type: Release
LuaJIT 2.0.5
Compilation: /usr/local/Homebrew/Library/Homebrew/shims/mac/super/clang -U_FORTIFY_SOURCE -D_FORTIFY_SOURCE=1 -DNDEBUG -DMIN_LOG_LEVEL=3 -Wall -Wextra -pedantic -Wno-unused-parameter -Wstrict-prototypes -std=gnu99 -Wshado
w -Wconversion -Wmissing-prototypes -Wimplicit-fallthrough -Wvla -fstack-protector-strong -fdiagnostics-color=auto -DINCLUDE_GENERATED_DECLARATIONS -D_GNU_SOURCE -DNVIM_MSGPACK_HAS_FLOAT32 -DNVIM_UNIBI_HAS_VAR_FROM -I/tmp
/neovim-20190712-1828-h164ff/build/config -I/tmp/neovim-20190712-1828-h164ff/src -I/usr/local/include -I/tmp/neovim-20190712-1828-h164ff/deps-build/include -I/usr/local/opt/gettext/include -I/Library/Developer/CommandLine
Tools/SDKs/MacOSX10.14.sdk/usr/include -I/tmp/neovim-20190712-1828-h164ff/build/src/nvim/auto -I/tmp/neovim-20190712-1828-h164ff/build/include
Compiled by aignas@aignas-C02WT100HV2T

Features: +acl +iconv +tui
See ":help feature-compile"

   system vimrc file: "$VIM/sysinit.vim"
  fall-back for $VIM: "/usr/local/Cellar/neovim/HEAD-6eab3b9/share/nvim"

Run :checkhealth for more info

Go version (go version):

go version go1.12.6 darwin/amd64
@bhcleek
Copy link
Collaborator

bhcleek commented Jul 21, 2019

I use vim-go in a large repository daily without blocking behavior when opening a Go file. To the best of my knowledge, the delay caused by using gopls in a large repo has been resolved since https://github.com/fatih/vim-go/pull/2371/files. It's curious that you're still seeing a delay 🤔

@bhcleek bhcleek closed this as completed Jul 25, 2019
@motiejus
Copy link

I can confirm this: it takes 1-2 seconds to initialize gopls with latest vim-go.

The initialization blocks the UI thread, which makes this painful every time I open a *.go file.

@bhcleek bhcleek reopened this Jul 25, 2019
@bhcleek
Copy link
Collaborator

bhcleek commented Jul 25, 2019

I can confirm this: it takes 1-2 seconds to initialize gopls with latest vim-go.

@motiejus are you using the latest commit on master or are you using the latest release of vim-go?

@motiejus
Copy link

I can confirm this: it takes 1-2 seconds to initialize gopls with latest vim-go.

@motiejus are you using the latest commit on master or are you using the latest release of vim-go?

I dove a little deeper. Turns out, in my environment, go is pointing to a shell script which does some environment checks, which, with new vim-go (or perhaps with gopls) gets triggered, which did not happen before.

I will dig into this more internally, but I am taking back my comment.

@bhcleek
Copy link
Collaborator

bhcleek commented Jul 25, 2019

Thanks for confirming. I'm going to close this again, but please feel free to open a new issue if your analysis leads you to think this is a problem with vim-go again.

@bhcleek bhcleek closed this as completed Jul 25, 2019
@jockech
Copy link

jockech commented Nov 25, 2019

It happens for me if I use vim to open a file under a large repo when I enter .. Then it will stuck forever saying initialized gopls

@WhisperingChaos
Copy link

@XavierCheng1996

I encountered the same behavior you described: "stuck forever saying initialized gopls". My installation of vim-go is configured to run in a docker container. Linux find couldn't locate gopls in it. Installing gopls to the container using these instructions resolved the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants