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: file changes not reflected in results #35526

Closed
shawnlee913 opened this issue Nov 12, 2019 · 7 comments
Closed

x/tools/gopls: file changes not reflected in results #35526

shawnlee913 opened this issue Nov 12, 2019 · 7 comments
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Milestone

Comments

@shawnlee913
Copy link

What version of Go are you using (go version)?

$ go version
go version go1.13.4 windows/amd64

Does this issue reproduce with the latest release?

Yes

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
set GO111MODULE=
set GOARCH=amd64
set GOBIN=
set GOCACHE=C:\Users\ravenlli\AppData\Local\go-build
set GOENV=C:\Users\ravenlli\AppData\Roaming\go\env
set GOEXE=.exe
set GOFLAGS=
set GOHOSTARCH=amd64
set GOHOSTOS=windows
set GONOPROXY=
set GONOSUMDB=
set GOOS=windows
set GOPATH=C:\Users\ravenlli\go
set GOPRIVATE=
set GOPROXY=https://proxy.golang.org,direct
set GOROOT=c:\go
set GOSUMDB=sum.golang.org
set GOTMPDIR=
set GOTOOLDIR=c:\go\pkg\tool\windows_amd64
set GCCGO=gccgo
set AR=ar
set CC=gcc
set CXX=g++
set CGO_ENABLED=1
set GOMOD=
set CGO_CFLAGS=-g -O2
set CGO_CPPFLAGS=
set CGO_CXXFLAGS=-g -O2
set CGO_FFLAGS=-g -O2
set CGO_LDFLAGS=-g -O2
set PKG_CONFIG=pkg-config
set GOGCCFLAGS=-m64 -mthreads -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=C:\Users\ravenlli\AppData\Local\Temp\go-build991420482=/tmp/go-build -gno-record-gcc-switches

What did you do?

I was using vscode-go together with gopls and other go tools (all installed automatically), when I made some changes to the file inside the vscode editor, such as adding or deleting some lines, linting or auto-completion couldn't work correctly. I had to reload the window to get things right.
image
In the above example, when my mouse cursor stops above "splitDhash", it came out the description of "blockMasks" just because I inserted an empty line at line 122.

What did you expect to see?

Changes inside the vscode editor should be tracked.

What did you see instead?

Changes inside the vscode editor are not tracked.

@shawnlee913 shawnlee913 changed the title vscode-go: Changes inside the vscode editor are not tracked x/tools/gopls: Changes inside the vscode editor are not tracked Nov 12, 2019
@gopherbot gopherbot added this to the Unreleased milestone Nov 12, 2019
@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 Nov 12, 2019
@gopherbot
Copy link

Thank you for filing a gopls issue! Please take a look at the Troubleshooting guide, and make sure that you have provided all of the relevant information here.

@stamblerre
Copy link
Contributor

stamblerre commented Nov 12, 2019

Has this happened to you more than once or was it just in this instance? If it happens often, can you share a gopls log from when this happens (see how to capture logs here)? What version of gopls are you using (gopls version)?

@shawnlee913
Copy link
Author

shawnlee913 commented Nov 13, 2019

It happens often(nearly every time), and not only to me.

$ gopls.exe version
golang.org/x/tools/gopls 0.2.0
    golang.org/x/tools/gopls@v0.2.0 h1:ddCHfScTYOG6auAcEKXCFN5iSeKSAnYcPv+7zVJBd+U=

some gopls log regarding the example func splitDhash:
Output


[Trace - 14:41:46.622 PM] Sending request 'textDocument/hover - (13)'.
Params: {"textDocument":{"uri":"file:///d%3A/code/goneat_video_content_sim_dhash_svr/src/streamsim/sim_handler.go"},"position":{"line":122,"character":10}}


[Trace - 14:41:46.665 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/13 14:41:46 38.0038ms for GOROOT=c:\\go GOPATH=D:\\code\\goneat_video_content_sim_dhash_svr;C:\\Users\\ravenlli\\go GO111MODULE= PWD=d:\\code\\goneat_video_content_sim_dhash_svr go \"env\" \"GOMOD\", stderr: \u003c\u003c\u003e\u003e stdout: \u003c\u003c\n\u003e\u003e\n"}


[Info  - 下午2:41:46] 2019/11/13 14:41:46 38.0038ms for GOROOT=c:\go GOPATH=D:\code\goneat_video_content_sim_dhash_svr;C:\Users\ravenlli\go GO111MODULE= PWD=d:\code\goneat_video_content_sim_dhash_svr go "env" "GOMOD", stderr: <<>> stdout: <<
>>

[Trace - 14:41:46.707 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/13 14:41:46 80.219ms for GOROOT=c:\\go GOPATH=D:\\code\\goneat_video_content_sim_dhash_svr;C:\\Users\\ravenlli\\go GO111MODULE= PWD=d:\\code\\goneat_video_content_sim_dhash_svr go \"list\" \"-m\" \"-json\" \"all\", stderr: \u003c\u003cgo list -m: not using modules\n\u003e\u003e stdout: \u003c\u003c\u003e\u003e\n"}


[Info  - 下午2:41:46] 2019/11/13 14:41:46 80.219ms for GOROOT=c:\go GOPATH=D:\code\goneat_video_content_sim_dhash_svr;C:\Users\ravenlli\go GO111MODULE= PWD=d:\code\goneat_video_content_sim_dhash_svr go "list" "-m" "-json" "all", stderr: <<go list -m: not using modules
>> stdout: <<>>

[Trace - 14:41:46.754 PM] Received notification 'window/logMessage'.
Params: {"type":3,"message":"2019/11/13 14:41:46 44.8674ms for GOROOT=c:\\go GOPATH=D:\\code\\goneat_video_content_sim_dhash_svr;C:\\Users\\ravenlli\\go GO111MODULE= PWD=d:\\code\\goneat_video_content_sim_dhash_svr go \"env\" \"GOPATH\", stderr: \u003c\u003c\u003e\u003e stdout: \u003c\u003cD:\\code\\goneat_video_content_sim_dhash_svr;C:\\Users\\ravenlli\\go\n\u003e\u003e\n"}


[Info  - 下午2:41:46] 2019/11/13 14:41:46 44.8674ms for GOROOT=c:\go GOPATH=D:\code\goneat_video_content_sim_dhash_svr;C:\Users\ravenlli\go GO111MODULE= PWD=d:\code\goneat_video_content_sim_dhash_svr go "env" "GOPATH", stderr: <<>> stdout: <<D:\code\goneat_video_content_sim_dhash_svr;C:\Users\ravenlli\go

@stamblerre
Copy link
Contributor

Can you please share the full gopls log, even if it's very long? The excerpts here are not relevant to the issue you're seeing.

@stamblerre stamblerre added the WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided. label Nov 14, 2019
@stamblerre stamblerre changed the title x/tools/gopls: Changes inside the vscode editor are not tracked x/tools/gopls: file changes not reflected in results Nov 14, 2019
@shawnlee913
Copy link
Author

Here is the full gopls log.
issue35526.log

@stamblerre
Copy link
Contributor

stamblerre commented Nov 15, 2019

Based on your logs, it looks like gopls hasn't fully initialized by the time the change to the file comes in. We've recently made some changes to handle this - can you try installing gopls at master and reporting if you still see the same issues? To install at master, git clone https://go.googlesource.com/tools, cd into the tools/gopls directory, and run go install. If you still see the same issue at master, please attach the full logs.

This might also be related to #35584.

@stamblerre stamblerre modified the milestones: Unreleased, gopls unplanned, gopls v1.0 Dec 4, 2019
@stamblerre
Copy link
Contributor

Closing this issue as it's now almost 2 months old. @leerayven: Please open a new issue if you are still encountering problems.

@stamblerre stamblerre modified the milestones: gopls/v1.0.0, gopls/v0.4.0 Jul 22, 2020
@golang golang locked and limited conversation to collaborators Jul 22, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
FrozenDueToAge gopls Issues related to the Go language server, gopls. Tools This label describes issues relating to any tools in the x/tools repository. WaitingForInfo Issue is not actionable because of missing required information, which needs to be provided.
Projects
None yet
Development

No branches or pull requests

3 participants