Skip to content

Commit 4a19ffb

Browse files
committed
gopls/internal/regtest: await file changes in TestUseGoplsMod
Make sure metadata is reloaded after each file changed. Change-Id: If3900f6fc2f99ff4eaf81b82d39e01e9f5dcb68e Reviewed-on: https://go-review.googlesource.com/c/tools/+/280695 Trust: Rebecca Stambler <[email protected]> Run-TryBot: Rebecca Stambler <[email protected]> gopls-CI: kokoro <[email protected]> Reviewed-by: Robert Findley <[email protected]> TryBot-Result: Go Bot <[email protected]>
1 parent ef3185b commit 4a19ffb

File tree

1 file changed

+3
-0
lines changed

1 file changed

+3
-0
lines changed

gopls/internal/regtest/workspace_test.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -443,6 +443,7 @@ replace a.com => $SANDBOX_WORKDIR/moda/a
443443
// loaded. Validate this by jumping to a definition in b.com and ensuring
444444
// that we go to the module cache.
445445
env.OpenFile("moda/a/a.go")
446+
env.Await(CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 1))
446447

447448
// To verify which modules are loaded, we'll jump to the definition of
448449
// b.Hello.
@@ -476,6 +477,7 @@ replace b.com => %s/modb
476477
// Check that go.mod diagnostics picked up the newly active mod file.
477478
// The local version of modb has an extra dependency we need to download.
478479
env.OpenFile("modb/go.mod")
480+
env.Await(CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 2))
479481
var d protocol.PublishDiagnosticsParams
480482
env.Await(
481483
OnceMet(
@@ -493,6 +495,7 @@ replace b.com => %s/modb
493495
// Now, let's modify the gopls.mod *overlay* (not on disk), and verify that
494496
// this change is only picked up once it is saved.
495497
env.OpenFile("gopls.mod")
498+
env.Await(CompletedWork(lsp.DiagnosticWorkTitle(lsp.FromDidOpen), 3))
496499
env.SetBufferContent("gopls.mod", fmt.Sprintf(`module gopls-workspace
497500
498501
require (

0 commit comments

Comments
 (0)