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

x/tools/gopls: Autocompletion sometimes jumps to wrong location. #58960

Closed
luotianqi777 opened this issue Mar 10, 2023 · 4 comments
Closed

x/tools/gopls: Autocompletion sometimes jumps to wrong location. #58960

luotianqi777 opened this issue Mar 10, 2023 · 4 comments
Labels
gopls/corruption Issues related to file corruption in gopls gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Milestone

Comments

@luotianqi777
Copy link

luotianqi777 commented Mar 10, 2023

Translated from Google:

gopls version

v0.11.0

go env

set GO111MODULE=on
set GOARCH=amd64
set GOBIN=D:\Program Files\Go\bin
set GOCACHE=C:\Users\Administrator\AppData\Local\go-build
set GOENV=C:\Users\Administrator\AppData\Roaming\go\env
set GOEXE=.exe
set GOEXPERIMENT=
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GOINSECURE=
set GOMODCACHE=E:\Project\GO\pkg\mod
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=E:\Project\GO
set GOPRIVATE=
set GOPROXY=https://goproxy.cn,direct
set GOROOT=D:\Program Files\Go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=D:\Program Files\Go\pkg\tool\windows_amd64
set GOVCS=
set GOVERSION=go1.20.2
set GCCGO=gccgo
set GOAMD64=v1
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=E:\Project\GO\Demo\go.mod
set GOWORK=
set CGO_CFLAGS=-O2 -g
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-O2 -g
set CGO_FFLAGS=-O2 -g
set CGO_LDFLAGS=-O2 -g
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -Wl,--no-gc-sections -fmessage-length=0 -fdebug-prefix-map=C:\Users\ADMINI~1\AppData\Local\Temp\go-build732281470=/tmp/go-build -gno-record-gcc-switches

What did you do?

Automatically import packages.
This works fine in general.

What did you expect to see?

No unexpected problems.

What did you see instead?

Autocompletion sometimes jumps to wrong location.
Here is an example in vscode:

cmp-error-log

Editor and settings

editor: VSCode-win32-x64-1.76.1

Golang related config in my vscode:

"[go]": {
"editor.defaultFormatter": "golang.go",
"editor.formatOnSave": false,
},
"go.useLanguageServer": true,
"go.languageServerFlags": [
"-rpc.trace",
"-logfile",
"serve",
"--debug=localhost:6060",
],

Logs

This is the log:

log.txt

@gopherbot gopherbot added Tools This label describes issues relating to any tools in the x/tools repository. gopls Issues related to the Go language server, gopls. labels Mar 10, 2023
@gopherbot gopherbot added this to the Unreleased milestone Mar 10, 2023
@luotianqi777 luotianqi777 changed the title x/tools/gopls: x/tools/gopls: Autocompletion sometimes jumps to wrong location. Mar 10, 2023
@suzmue suzmue added gopls/corruption Issues related to file corruption in gopls NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. labels Mar 10, 2023
@suzmue suzmue modified the milestones: Unreleased, gopls/later Mar 10, 2023
@findleyr findleyr modified the milestones: gopls/later, gopls/v0.12.0 Mar 16, 2023
@adonovan
Copy link
Member

Thanks for the bug report. Could you briefly explain in words what is happening in the video? It's very fast and keeps looping, making it hard to guess what exactly the problem is.

@luotianqi777
Copy link
Author

luotianqi777 commented Mar 23, 2023

Sorry for not providing a demo with valid information.
In some special cases, when using content defined in other packages, auto-completion will jump to other places.
I recorded a slower video and added some annotations.

cmp-error

@adonovan
Copy link
Member

@luotianqi777 Did you mean to close this issue?

@luotianqi777
Copy link
Author

@luotianqi777 Did you mean to close this issue?

Yes, I don't think this is a bug that will cause the program wrong.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
gopls/corruption Issues related to file corruption in gopls gopls Issues related to the Go language server, gopls. NeedsInvestigation Someone must examine and confirm this is a valid issue and not a duplicate of an existing one. Tools This label describes issues relating to any tools in the x/tools repository.
Projects
None yet
Development

No branches or pull requests

5 participants