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

Open
leerayven opened this issue Nov 12, 2019 · 6 comments

Comments

@leerayven
Copy link

@leerayven leerayven commented Nov 12, 2019

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.

@leerayven leerayven 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

This comment has been minimized.

Copy link

@gopherbot gopherbot commented Nov 12, 2019

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

This comment has been minimized.

Copy link
Contributor

@stamblerre 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)?

@leerayven

This comment has been minimized.

Copy link
Author

@leerayven leerayven 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

This comment has been minimized.

Copy link
Contributor

@stamblerre stamblerre commented Nov 14, 2019

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 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
@leerayven

This comment has been minimized.

Copy link
Author

@leerayven leerayven commented Nov 15, 2019

Here is the full gopls log.
issue35526.log

@stamblerre

This comment has been minimized.

Copy link
Contributor

@stamblerre 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.