1
0
mirror of https://github.com/golang/go synced 2024-11-18 19:54:44 -07:00
go/internal/lsp/cache
Heschi Kreinick eb46839a96 internal/imports: return non-stdlib candidates from GetAllCandidates
Scan most sources, including GOPATH, the module cache, the main module,
and replace targets as appropriate. Use the cached stdlib instead of
scanning GOROOT.

We heavily cache the contents of the module cache, so performance is
decent. But we have to look at all the modules not in the module cache
too to get the right versions of modules (see
(*ModuleResolver).canonicalize), which currently isn't cached at all,
even just for a single run. That ends up being pretty expensive.

The implementation changes are relatively small; add package name
loading to scan(), cache that result, and allow callers to control what
directories are scanned so that it can skip GOROOT.

I also cleared out most of the stdlib from the unimported completion
test and added a simple external completion to it for safety's sake.

Change-Id: Id50fd4703b1126be35a000fe90719e19c3ab84bf
Reviewed-on: https://go-review.googlesource.com/c/tools/+/199178
Run-TryBot: Heschi Kreinick <heschi@google.com>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
2019-10-21 20:45:15 +00:00
..
analysis.go internal/lsp: add a test to make sure we handle bad imports 2019-10-17 20:52:05 +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: refactor error handling code in type-checking 2019-10-21 18:57:46 +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: refactor error handling code in type-checking 2019-10-21 18:57:46 +00:00
external.go internal/lsp: address staticcheck warnings 2019-10-04 02:16:23 +00:00
file.go internal/lsp: rework snapshots and cache FileHandles per-snapshot 2019-10-01 16:26:22 +00:00
gofile.go internal/lsp: return an error from {Narrowest,Widest}CheckPackageHandle 2019-10-11 16:51:06 +00:00
load.go internal/lsp: check if the go/packages context has been canceled 2019-10-16 22:21:47 +00:00
parse.go internal/lsp: fix bad *ast.ArrayTypes for completion 2019-10-17 20:53:01 +00:00
pkg.go internal/lsp: refactor error handling code in type-checking 2019-10-21 18:57:46 +00:00
session.go internal/lsp: add analyses to the snapshot 2019-10-15 15:04:14 +00:00
snapshot.go internal/lsp: use the analyzer's pointer instead of name 2019-10-15 21:12:01 +00:00
view.go internal/imports: return non-stdlib candidates from GetAllCandidates 2019-10-21 20:45:15 +00:00
watcher.go internal/lsp: fix deadlocks loading lots of files at once 2019-07-03 17:22:52 +00:00