internal/lsp/cache: disable analysis on dependencies (temporarily)

Right now, we request analyses for files in ParseExported mode, which
doesn't actually produce any meaningful facts. Disable it until we
resolve golang/go#35089, since right now, all this is doing is wasting
memory and CPU.

Change-Id: I6ffb7bdf6c915159b55753b51289cef4bd937603
Reviewed-on: https://go-review.googlesource.com/c/tools/+/208270
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 2019-11-21 20:17:28 -05:00
parent 035a8167be
commit 2189885de9
1 changed files with 19 additions and 13 deletions

View File

@ -104,20 +104,26 @@ func (s *snapshot) actionHandle(ctx context.Context, id packageID, mode source.P
}
deps = append(deps, reqActionHandle)
}
// An analysis that consumes/produces facts
// must run on the package's dependencies too.
if len(a.FactTypes) > 0 {
importIDs := make([]string, 0, len(cph.m.deps))
for _, importID := range cph.m.deps {
importIDs = append(importIDs, string(importID))
}
sort.Strings(importIDs) // for determinism
for _, importID := range importIDs {
depActionHandle, err := s.actionHandle(ctx, packageID(importID), source.ParseExported, a)
if err != nil {
return nil, err
// TODO(golang/go#35089): Re-enable this when we doesn't use ParseExported
// mode for dependencies. In the meantime, disable analysis for dependencies,
// since we don't get anything useful out of it.
if false {
// An analysis that consumes/produces facts
// must run on the package's dependencies too.
if len(a.FactTypes) > 0 {
importIDs := make([]string, 0, len(cph.m.deps))
for _, importID := range cph.m.deps {
importIDs = append(importIDs, string(importID))
}
sort.Strings(importIDs) // for determinism
for _, importID := range importIDs {
depActionHandle, err := s.actionHandle(ctx, packageID(importID), source.ParseExported, a)
if err != nil {
return nil, err
}
deps = append(deps, depActionHandle)
}
deps = append(deps, depActionHandle)
}
}