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 2b6dac1
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 14 deletions.
12 changes: 6 additions & 6 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -380,12 +380,12 @@ val mtagsSettings = List(
),
libraryDependencies ++= List("org.lz4" % "lz4-java" % "1.8.0"),
libraryDependencies ++= {
if (isCI) Nil
// NOTE(olafur) pprint is indispensable for me while developing, I can't
// use println anymore for debugging because pprint.log is 100 times better.
else {
List("com.lihaoyi" %% "pprint" % V.pprint)
}
// if (isCI) Nil
// // NOTE(olafur) pprint is indispensable for me while developing, I can't
// // use println anymore for debugging because pprint.log is 100 times better.
// else {
List("com.lihaoyi" %% "pprint" % V.pprint)
// }
},
buildInfoPackage := "scala.meta.internal.mtags",
buildInfoKeys := Seq[BuildInfoKey](
Expand Down
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 2b6dac1

Please sign in to comment.