Skip to content

Commit

Permalink
Fix DefinitionCrossLspSuite
Browse files Browse the repository at this point in the history
Previously, we were not waiting for the compilation to finish which was causing the semanticdb not to be available. Now we properly use the for comprehension.

Fixes scalameta#3688
  • Loading branch information
tgodzik committed Mar 10, 2022
1 parent 105f350 commit 1061179
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,7 @@ class DefinitionCrossLspSuite
}
}

// TODO MIGRATE I can't reproduce this locally. In CI this fails every time,
// but I it always passes locally
// https://github.com/scalameta/metals/issues/3688
test("underscore".ignore) {
test("underscore") {
cleanDatabase()
for {
_ <- initialize(
Expand All @@ -59,8 +56,9 @@ class DefinitionCrossLspSuite
|}
|""".stripMargin
)
_ = server.didOpen("a/src/main/scala/a/Main.scala")
_ = server.didOpen("a/src/main/scala/a/Test.scala")
_ <- server.didOpen("a/src/main/scala/a/Main.scala")
_ <- server.didOpen("a/src/main/scala/a/Test.scala")
_ = assertNoDiagnostics()
_ = server.assertReferenceDefinitionBijection()
} yield ()
}
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/src/main/scala/tests/TestingServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -371,8 +371,8 @@ final class TestingServer(
loc: munit.Location
): Unit = {
val compare = workspaceReferences()
assert(compare.definition.nonEmpty)
assert(compare.references.nonEmpty)
assert(compare.definition.nonEmpty, "Definitions should not be empty")
assert(compare.references.nonEmpty, "References should not be empty")
Assertions.assertNoDiff(
compare.referencesFormat,
compare.definitionFormat
Expand Down

0 comments on commit 1061179

Please sign in to comment.