1
0
mirror of https://github.com/golang/go synced 2024-11-18 18:04:46 -07:00

internal/lsp: avoid unnecessary type checking

Previously we would type check all package handles as we fetched them.
This meant if you only cared about a file's primary package you would
still have to wait for all its packages to be type checked. For
example, when completing in foo.go, you would wait for [foo.go] and
[foo.go, foo_test.go] to be checked (the latter being the test
variant).

Now we don't type check packages as we put together the package
handles.

Change-Id: Ibca0c6b34cf4f0a07bcdeb62959d60158f4ccf17
Reviewed-on: https://go-review.googlesource.com/c/tools/+/195417
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Muir Manders 2019-09-13 19:56:02 -07:00 committed by Rebecca Stambler
parent 3512ebf574
commit b31ee645dd

View File

@ -38,10 +38,6 @@ func (view *view) loadParseTypecheck(ctx context.Context, f *goFile, fh source.F
log.Error(ctx, "loadParseTypeCheck: failed to get CheckPackageHandle", err, telemetry.Package.Of(m.id))
continue
}
if _, err := cph.check(ctx); err != nil {
log.Error(ctx, "loadParseTypeCheck: failed to check package", err, telemetry.Package.Of(m.id))
continue
}
// Cache this package on the file object, since all dependencies are cached in the Import function.
if err := imp.cachePackage(ctx, cph); err != nil {
log.Error(ctx, "loadParseTypeCheck: failed to cache package", err, telemetry.Package.Of(m.id))