-
Notifications
You must be signed in to change notification settings - Fork 18k
x/tools/gopls: complete third-party unimported too slow #55873
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
Comments
|
|
i alse have this problem, and I solved it temporarily by restarting lsp |
@jinzhongjia it doesn't work for me -,- |
now , i try golangci-lint,and it works very well |
@jinzhongjia thx for your answer, is your edit is neovim/vim? I have tried it just now, I found that it has it's own language server named |
you need install when u have installed them ,you just add |
and now , i am back to gopls |
I can't stand without hover_doc |
Hi! Can you start gopls with the |
My theory of the problem is as follows: typing in an import path invalidates package metadata (because the import graph may have changed), which has a ripple effect of invalidation. Completion must wait for the This may have been a regression caused by work on invalidation. |
@3Xpl0it3r there is something I don't understand in your logs: why earlier requests are completing rather than being canceled. I can't see enough information to understand why. Would you be willing to build and use a gopls branch that has additional logging, so that we can gather more information? |
here is the trace information |
ofcourse, which branch should I use? ➜ ~ gopls version
golang.org/x/tools/gopls v0.9.5
golang.org/x/tools/gopls@v0.9.5 h1:F3TO5th6TUg40FHrpxZfMkMlVaaTmByeEvylgVHGH2A=
➜ ~ |
it there any option in configure can skip this ? |
@3Xpl0it3r this is the issue: as you are typing, your LSP client is asking for things like documentHighlight on each keypress. For gopls, this involves computing type information, which can take time. But on subsequent keypresses your client does not cancel the requests from older versions, so gopls does not proceed to processing the next keypress until it is done with the earlier documentHighlight request. Most other LSP clients cancel requests relating to older file versions, when a new version arrives. I suspect that your client should do the same. |
Here's a relevant section of the LSP spec:
Per my reading, this is saying that if the client doesn't explicitly cancel a request, we should continue to process it with the older content. In light of this, I think this is a client bug: the client should cancel the older requests if they are no longer needed. |
go env
GO111MODULE="auto"
GOARCH="amd64"
GOBIN=""
GOCACHE="/Users/l0calh0st/Library/Caches/go-build"
GOENV="/Users/l0calh0st/Library/Application Support/go/env"
GOEXE=""
GOEXPERIMENT=""
GOFLAGS=""
GOHOSTARCH="amd64"
GOHOSTOS="darwin"
GOINSECURE=""
GOMODCACHE="/Users/l0calh0st/Git/Go/pkg/mod"
GONOPROXY=""
GONOSUMDB=""
GOOS="darwin"
GOPATH="/Users/l0calh0st/Git/Go"
GOPRIVATE=""
GOPROXY="https://goproxy.cn"
GOROOT="/usr/local/Cellar/go/1.18.4/libexec"
GOSUMDB="sum.golang.org"
GOTMPDIR=""
GOTOOLDIR="/usr/local/Cellar/go/1.18.4/libexec/pkg/tool/darwin_amd64"
GOVCS=""
GOVERSION="go1.18.4"
GCCGO="gccgo"
GOAMD64="v1"
AR="ar"
CC="clang"
CXX="clang++"
CGO_ENABLED="1"
GOMOD=""
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 -arch x86_64 -m64 -pthread -fno-caret-diagnostics -Qunused-arguments -fmessage-length=0 -fdebug-prefix-map=/var/folders/x7/vm1w670d4_5fn5b8vrn3mrv40000gn/T/go-build3773192071=/tmp/go-build -gno-record-gcc-switches -fno-common"
What did you do?
When i use gopls complete third-party unimport, it's too slow, may be wait 3-5s

Editor and settings
NVIM v0.7.2
Build type: Release
LuaJIT 2.1.0-beta3
编译者 brew@BigSur
Features: +acl +iconv +tui
See ":help feature-compile"
Run :checkhealth for more info
Logs
[ERROR][2022-09-26 19:07:46] ...lsp/handlers.lua:455 "2022/09/26 19:07:46 no signature help: no signature help within a string literal\n\tposition={18 16}\n"
[ERROR][2022-09-26 19:07:50] ...lsp/handlers.lua:455 "2022/09/26 19:07:50 github.com/3Xpl0it3r/minio-operator/pkg/controller/minio: no dep handle for github.com/3: no metadata for github.com/3\n\tsnapshot=16\n"
[ERROR][2022-09-26 19:07:50] ...lsp/handlers.lua:455 "2022/09/26 19:07:50 github.com/3Xpl0it3r/minio-operator/pkg/controller/minio: no dep handle for github.com/3: no metadata for github.com/3\n\tsnapshot=16\n"
[ERROR][2022-09-26 19:07:50] ...lsp/handlers.lua:455 "2022/09/26 19:07:50 no signature help: no signature help within a string literal\n\tposition={18 17}\n"
[ERROR][2022-09-26 19:07:52] ...lsp/handlers.lua:455 "2022/09/26 19:07:52 github.com/3Xpl0it3r/minio-operator/pkg/controller/minio: no dep handle for github.com/3X: no metadata for github.com/3X\n\tsnapshot=17\n"
[ERROR][2022-09-26 19:07:52] ...lsp/handlers.lua:455 "2022/09/26 19:07:52 github.com/3Xpl0it3r/minio-operator/pkg/controller/minio: no dep handle for github.com/3X: no metadata for github.com/3X\n\tsnapshot=17\n"
[ERROR][2022-09-26 19:07:52] ...lsp/handlers.lua:455 "2022/09/26 19:07:52 no signature help: no signature help within a string literal\n\tposition={18 18}\n"
[ERROR][2022-09-26 19:07:53] ...lsp/handlers.lua:455 "2022/09/26 19:07:53 github.com/3Xpl0it3r/minio-operator/pkg/controller/minio: no dep handle for github.com/3Xpl0it3r/: no metadata for github.com/3Xpl0it3r/\n\tsnapshot=19\n"
[ERROR][2022-09-26 19:07:53] ...lsp/handlers.lua:455 "2022/09/26 19:07:53 no signature help: no signature help within a string literal\n\tposition={18 26}\n"
[START][2022-09-26 19:21:04] LSP logging initiated
The text was updated successfully, but these errors were encountered: