1
0
mirror of https://github.com/golang/go synced 2024-10-01 03:28:32 -06:00
go/internal
Heschi Kreinick fda23558a1 internal/lsp/cache: only refresh imports cache every 30 seconds
Loading completion suggestions can be slow, especially in GOPATH mode
where basically anything can change at any time. As a compromise, cache
everything for 30 seconds. Specifically, after a completion operation
finishes, if the cache is more than 30 seconds old, refresh it
asynchronously. That keeps user-facing latency consistent, without
chewing up CPU when the editor isn't in use. It does mean that if you
walk away for an hour and come back, the first completion may be stale.

In module mode this is relatively benign. The only things the
longer caching affects are the main module and replace targets, and
relevant packages in those will generally be loaded by gopls, so they'll
have full, up-to-date type information regardless.

In GOPATH mode this may be more troublesome, since it affects
everything. In particular, go get -u of a package that isn't imported
yet won't be reflected until the cache period expires. I think that's a
rare enough case not to worry about.

Change-Id: Iaadfd0ff647cda2b1dcdead9254b5492b397e86e
Reviewed-on: https://go-review.googlesource.com/c/tools/+/205163
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-11-04 21:31:29 +00:00
..
apidiff all: fix more typos 2019-09-11 15:13:14 +00:00
fastwalk internal/fastwalk: avoid slice bounds out of range for long file names 2018-11-12 23:16:31 +00:00
gopathwalk internal/imports: cache things outside the mod cache 2019-10-21 20:45:41 +00:00
imports internal/lsp/cache: only refresh imports cache every 30 seconds 2019-11-04 21:31:29 +00:00
jsonrpc2 internal/lsp: cancel early 2019-10-22 07:49:31 +00:00
lsp internal/lsp/cache: only refresh imports cache every 30 seconds 2019-11-04 21:31:29 +00:00
memoize internal/memoize: add a go:nocheckptr annotation to (*Store).get 2019-10-24 04:42:40 +00:00
module imports: stop using go/packages for modules 2019-01-22 20:29:12 +00:00
semver go/packages: add name= query 2018-10-16 20:20:09 +00:00
span internal/span: end of file is now last line +1 2019-10-07 18:54:44 +00:00
telemetry internal/telemetry/export/ocagent: attach timestamps to metrics 2019-10-24 07:31:07 +00:00
testenv internal/lsp: fix patch tests on builders 2019-10-10 20:12:59 +00:00
tool tools/internal/tool: refactor tool.Main() for testabilty 2019-09-19 22:27:22 +00:00
txtar imports: stop using go/packages for modules 2019-01-22 20:29:12 +00:00
xcontext internal/lsp: stop making background contexts everywhere 2019-07-11 16:38:52 +00:00