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

Setting fmt command to 'gopls' causes a message on save #2847

Closed
antoineco opened this issue Apr 22, 2020 · 2 comments · Fixed by #2848
Closed

Setting fmt command to 'gopls' causes a message on save #2847

antoineco opened this issue Apr 22, 2020 · 2 comments · Fixed by #2848

Comments

@antoineco
Copy link
Contributor

antoineco commented Apr 22, 2020

What did you do?

  1. Set let g:go_fmt_command = 'gopls' in my vimrc file.
  2. Created a new file with vim main.go.
  3. Saved the file with :w.

What did you expect to happen?

No message, no need to press Enter to continue editing the file.

What happened instead?

The following message is printed:

vim-go: [imports] SUCCESS
"main.go" [New] 7L, 67C written
Press ENTER or type command to continue

I have to press Enter to make the message disappear, which is not the behavior I observe with the gofmt formatter.

Configuration:

vim-go version:

master @ d6f4680

vimrc you used to reproduce:

let g:go_fmt_command = 'gopls'
let g:go_imports_mode = 'gopls'
let g:go_rename_command = 'gopls'

Vim version:

VIM - Vi IMproved 8.1 (2018 May 18, compiled Mar 19 2020 13:12:18)
Included patches: 1-875, 878, 884, 948, 1046, 1365-1368, 1382, 1401

Go version:

go version go1.14 linux/amd64

Go environment

go env Output:
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/acotten/.cache/go-build"
GOENV="/home/acotten/.config/go/env"
GOEXE=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/acotten/go"
GOPRIVATE=""
GOPROXY="https://proxy.golang.org,direct"
GOROOT="/usr/local/go"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/go/pkg/tool/linux_amd64"
GCCGO="gccgo"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD=""
CGO_CFLAGS="-g -O2"
CGO_CPPFLAGS=""
CGO_CXXFLAGS="-g -O2"
CGO_FFLAGS="-g -O2"
CGO_LDFLAGS="-g -O2"
PKG_CONFIG="pkg-config"
GOGCCFLAGS="-fPIC -m64 -pthread -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build156702237=/tmp/go-build -gno-record-gcc-switches"

gopls version

gopls version Output:
golang.org/x/tools/gopls 0.4.0
    golang.org/x/tools/gopls@v0.4.0 h1:G4+YP9kaV4dJb79J5MobyApxX493Qa6VoiTceUmxqik=

Already reported in #2800 (comment) but the issue was not addressed.
ref #2729

@bhcleek
Copy link
Collaborator

bhcleek commented Apr 22, 2020

I'll get this fixed.

You can work around this easily (especially if you're using the statusbar integration already) by adding let g:go_echo_command_info=0 to you vimrc.

bhcleek added a commit to bhcleek/vim-go that referenced this issue Apr 22, 2020
Do not show status for formatting and imports when using gopls to
perform those operations in order to be congruent with the lack of
status messsages when using gofmt and goimports.

Fixes fatih#2847
@antoineco
Copy link
Contributor Author

I didn't use the status bar integration until now but I certainly will! Thanks for the tip 👍

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

Successfully merging a pull request may close this issue.

2 participants