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

internal/lsp/cache: don't skip x_tests

We were marking normal tests as workspace packages, but pruning x_tests.
Don't do that.

Fixes golang/go#39578.

Change-Id: Ia8eceea38e63ac17e40f50d6837de9c7a668469b
Reviewed-on: https://go-review.googlesource.com/c/tools/+/237943
Run-TryBot: Heschi Kreinick <heschi@google.com>
Reviewed-by: zikaeroh <zikaeroh@gmail.com>
Reviewed-by: Rebecca Stambler <rstambler@golang.org>
This commit is contained in:
Heschi Kreinick 2020-06-15 14:51:03 -04:00
parent 1725ffee6d
commit a2fa627c4b
3 changed files with 7 additions and 6 deletions

View File

@ -222,13 +222,13 @@ func (s *snapshot) setMetadata(ctx context.Context, pkgPath packagePath, pkg *pa
continue
}
switch m.forTest {
case "":
switch {
case m.forTest == "":
// A normal package.
s.workspacePackages[m.id] = pkgPath
case m.pkgPath:
// The test variant of some workspace package. To load it, we need to
// load the non-test variant with -test.
case m.forTest == m.pkgPath, m.forTest+"_test" == m.pkgPath:
// The test variant of some workspace package or its x_test.
// To load it, we need to load the non-test variant with -test.
s.workspacePackages[m.id] = m.forTest
default:
// A test variant of some intermediate package. We don't care about it.

View File

@ -5,4 +5,5 @@ import (
)
func TestA2(t *testing.T) { //@TestA2,godef(TestA2, TestA2)
Nonexistant() //@diag("Nonexistant", "compiler", "undeclared name: Nonexistant", "error")
}

View File

@ -7,7 +7,7 @@ DeepCompletionsCount = 5
FuzzyCompletionsCount = 8
RankedCompletionsCount = 120
CaseSensitiveCompletionsCount = 4
DiagnosticsCount = 43
DiagnosticsCount = 44
FoldingRangesCount = 2
FormatCount = 6
ImportCount = 8