Skip to content

x/tools/gopls: usePlaceholders=false disables variable name suggestions when using the var! suffix completion  #69626

@urandom

Description

@urandom

gopls version

golang.org/x/tools/gopls v0.16.1

go env

GO111MODULE=''
GOARCH='amd64'
GOBIN=''
GOCACHE='/home/urandom/.cache/go-build'
GOENV='/home/urandom/.config/go/env'
GOEXE=''
GOEXPERIMENT=''
GOFLAGS=''
GOHOSTARCH='amd64'
GOHOSTOS='linux'
GOINSECURE=''
GOMODCACHE='/home/urandom/go/pkg/mod'
GONOPROXY=''
GONOSUMDB=''
GOOS='linux'
GOPATH='/home/urandom/go'
GOPRIVATE=''
GOPROXY='https://proxy.golang.org,direct'
GOROOT='/usr/lib/go'
GOSUMDB='sum.golang.org'
GOTMPDIR=''
GOTOOLCHAIN='auto'
GOTOOLDIR='/usr/lib/go/pkg/tool/linux_amd64'
GOVCS=''
GOVERSION='go1.23.1'
GODEBUG=''
GOTELEMETRY='local'
GOTELEMETRYDIR='/home/urandom/.config/go/telemetry'
GCCGO='gccgo'
GOAMD64='v1'
AR='ar'
CC='gcc'
CXX='g++'
CGO_ENABLED='1'
GOMOD='/dev/null'
GOWORK=''
CGO_CFLAGS='-O2 -g'
CGO_CPPFLAGS=''
CGO_CXXFLAGS='-O2 -g'
CGO_FFLAGS='-O2 -g'
CGO_LDFLAGS='-O2 -g'
PKG_CONFIG='pkg-config'
GOGCCFLAGS='-fPIC -m64 -pthread -Wl,--no-gc-sections -fmessage-length=0 -ffile-prefix-map=/tmp/go-build4155953414=/tmp/go-build -gno-record-gcc-switches'

What did you do?

I've disabled the usePlaceholders option, since having it enabled inserts invalid syntax, causing more work.

Then I attempted to complete a .var! suffix completion on a function call, in order to have the variables defined.

What did you see happen?

, := theFunctionThatWasCompleted()

What did you expect to see?

someVar, err := theFunctionThatWasCompleted()

Editor and settings

Zed:

  "lsp": {
    "gopls": {
      "initialization_options": {
        "usePlaceholders": false
      }
    }
  },

Logs

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    ToolsThis label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.gopls/completionIssues related to auto-completion in gopls.

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions