internal/lsp/cache: construct package handles as part of IWL

Package handles should be cached on the snapshot as part of the initial
workspace load, otherwise this cached data will be repeatedly lost and
reconstructed during tests and regular execution.

Fixes golang/go#36556

Change-Id: If7676685db17519c998b857a812467c7f3cc6003
Reviewed-on: https://go-review.googlesource.com/c/tools/+/214799
Run-TryBot: Rebecca Stambler <rstambler@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
Reviewed-by: Heschi Kreinick <heschi@google.com>
This commit is contained in:
Rebecca Stambler 2020-01-14 18:25:22 -05:00
parent 3ded1b734d
commit 497c7f156c
1 changed files with 3 additions and 0 deletions

View File

@ -480,6 +480,9 @@ func (v *view) initialize(ctx context.Context, s *snapshot) {
// the non-test variant with -test. Track the import path of the non-test variant.
for _, m := range meta {
s.setWorkspacePackage(m.id, m.pkgPath)
if _, err := s.packageHandle(ctx, m.id); err != nil {
return err
}
}
return nil
})