-
Notifications
You must be signed in to change notification settings - Fork 18.6k
Description
What version of Go are you using (go version)?
$ go version go version go1.14.7 linux/amd64 $ gopls version gopls, built in GOPATH mode master
Does this issue reproduce with the latest release?
Yes (I built gopls from HEAD today)
What operating system and processor architecture are you using (go env)?
go env Output
$ go env GO111MODULE="" GOARCH="amd64" GOBIN="" GOCACHE="/home/user/.cache/go-build" GOENV="/home/user/.config/go/env" GOEXE="" GOFLAGS="" GOHOSTARCH="amd64" GOHOSTOS="linux" GOINSECURE="" GONOPROXY="" GONOSUMDB="" GOOS="linux" GOPATH="/home/user/go" GOPRIVATE="" GOPROXY="https://proxy.golang.org,direct" GOROOT="/usr/lib/go-1.14" GOSUMDB="sum.golang.org" GOTMPDIR="" GOTOOLDIR="/usr/lib/go-1.14/pkg/tool/linux_amd64" GCCGO="gccgo" AR="ar" CC="gcc" CXX="g++" CGO_ENABLED="1" GOMOD="/home/user/lsp-debug/go.mod" 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-build502378375=/tmp/go-build -gno-record-gcc-switches"
What did you do?
I'm trying to migrate from using the company-go emacs package (which uses gocode) to the new gopls support in the lsp-mode package. For the most part, lsp-mode with gopls seems strictly better. I'm having trouble getting placeholders to appear during function auto completion, though. This feature seems to be supported through the lsp-go-use-placeholders option, which is on by default, but doesn't seem to do anything.
What did you expect to see?
Here's an example of what placeholders look like using company-go and selecting a function auto complete item from the menu:
What did you see instead?
The gopls-backed menu has the argument list displayed properly:
However, after selecting an item, no function arguments are displayed:
I'm having a hard time figuring out if this is a problem with gopls, lsp-mode, or company. The fact that the arguments show up in the completion menu makes me think that gopls is successfully returning them (and the gopls log seems to support this). And company works correctly with the older company-go/gocode combo, so maybe lsm-mode simply isn't parsing the arguments returned by gopls correctly?
I'm using lsp-mode from melpa (20210207.705), gopls built from HEAD (today), and emacs in Ubuntu 20.10 (1:26.3+1-1ubuntu2). The screenshots above were generated while using this minimal .emacs configuration:
(require 'package)
(package-initialize)
(require 'company)
(setq lsp-go-gopls-server-args '("-logfile" "gopls.log" "-rpc.trace"))
(require 'lsp-mode)
(add-hook 'go-mode-hook #'lsp-deferred)
(add-hook 'go-mode-hook #'company-mode)
Here is a log from a session using lsp-mode and gopls: gopls.log


