1
0
mirror of https://github.com/golang/go synced 2024-10-01 13:18:33 -06:00
go/internal/lsp/cache
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
..
analysis.go internal/lsp/cache: recover from panics in analyses 2019-11-01 20:02:57 +00:00
builtin.go internal/lsp: address staticcheck warnings 2019-10-04 02:16:23 +00:00
cache.go internal/lsp: use options hooks to install diff driver 2019-10-11 16:38:31 +00:00
check.go internal/lsp: enable go-diff by default 2019-11-01 15:53:06 +00:00
error_test.go internal/lsp: refactor error handling code in type-checking 2019-10-21 18:57:46 +00:00
errors.go internal/lsp: revert to old method of computing error ranges 2019-11-01 16:09:22 +00:00
external.go internal/lsp: address staticcheck warnings 2019-10-04 02:16:23 +00:00
file.go internal/lsp: modify approach to watching changed files 2019-10-22 21:33:45 +00:00
gofile.go internal/lsp: type check packages in parallel 2019-10-29 04:13:27 +00:00
load.go internal/lsp: fix race condition in metadata handling 2019-11-04 20:35:57 +00:00
parse.go internal/lsp: stop caching diagnostics on the package 2019-10-24 22:03:59 +00:00
pkg.go internal/lsp: remove the pkg.view field, in preparation for CL 204079 2019-10-29 23:14:01 +00:00
session.go internal/lsp: do not format the file on import organization 2019-11-04 17:18:53 +00:00
snapshot.go internal/lsp: use available type info for unimported completions 2019-11-04 21:31:10 +00:00
view.go internal/lsp/cache: only refresh imports cache every 30 seconds 2019-11-04 21:31:29 +00:00
watcher.go internal/lsp: modify approach to watching changed files 2019-10-22 21:33:45 +00:00