-
Notifications
You must be signed in to change notification settings - Fork 18.5k
Open
Labels
ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/completionIssues related to auto-completion in gopls.Issues related to auto-completion in gopls.
Milestone
Description
gopls version
v0.14.2
go env
GO111MODULE=""
GOARCH="amd64"
GOBIN=""
GOCACHE="/home/ubuntu/.cache/go-build"
GOENV="/home/ubuntu/.config/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="linux"
GOINSECURE=""
GOMODCACHE="/home/ubuntu/go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="linux"
GOPATH="/home/ubuntu/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"
GOVCS=""
GOVERSION="go1.19"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="gcc"
CXX="g++"
CGO_ENABLED="1"
GOMOD="/home/ubuntu/work/go_example/go.mod"
GOWORK=""
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 -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=/tmp/go-build4259290323=/tmp/go-build -gno-record-gcc-switches"What did you do?
For reproduction, I made a simple project by:
- Creating a new directory
- Running
go mod init go_examplein it. - Creating a file
hello.gowith following contents:
package main
import "fmt"
func main() {
resourceName := "XYZ"
fmt.Printf("Resource name: %v\n")
}To reproduce, I started typing the name of the variable as the second argument to fmt.Printf, i.e.:
fmt.Printf("Resource name: %v\n", r)
# new characters ^^^which produces a reasonable list of completions:

But then I type a second letter i.e.:
fmt.Printf("Resource name: %v\n", re)
# new characters ^and the order of completions becomes less useful:

What did you see happen?
Once I started typing more than one letter of the variable name, import names started being favoured over the local variable name, which keeps happening up until I type "resource":


What did you expect to see?
I expected resourceName local variable to be shown as the first completion over the imports.
Editor and settings
Sublime Text with LSP-gopls extension (v1.14.2) using default settings.
Logs
Metadata
Metadata
Assignees
Labels
ToolsThis label describes issues relating to any tools in the x/tools repository.This label describes issues relating to any tools in the x/tools repository.goplsIssues related to the Go language server, gopls.Issues related to the Go language server, gopls.gopls/completionIssues related to auto-completion in gopls.Issues related to auto-completion in gopls.