diff --git a/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala b/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala index 4bac58f3c17..4fcbf20ac25 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/MetalsLspService.scala @@ -1029,6 +1029,7 @@ class MetalsLspService( } } else { buildServerPromise.future.flatMap { _ => + scribe.info("Build server promise finished") def load(): Future[Unit] = { val compileAndLoad = Future.sequence( diff --git a/tests/slow/src/test/scala/tests/mill/MillServerCodeLensSuite.scala b/tests/slow/src/test/scala/tests/mill/MillServerCodeLensSuite.scala index 8003f47fbb3..18f60b0a6f1 100644 --- a/tests/slow/src/test/scala/tests/mill/MillServerCodeLensSuite.scala +++ b/tests/slow/src/test/scala/tests/mill/MillServerCodeLensSuite.scala @@ -1,7 +1,11 @@ package tests.mill +import java.util.concurrent.TimeUnit + import scala.concurrent.duration.Duration +import scala.meta.internal.metals.MetalsEnrichments._ +import tests.MetalsTestEnrichments._ import scala.meta.internal.metals.ServerCommands import scala.meta.internal.metals.{BuildInfo => V} @@ -14,8 +18,15 @@ class MillServerCodeLensSuite override def munitTimeout: Duration = Duration("4min") + override def afterEach(context: AfterEach): Unit = { + super.afterEach(context) + scribe.info(workspace.resolve(".metals/bsp.trace.json").text) + } test("run-mill-lens", maxRetry = 3) { + cleanWorkspace() + val bsp = workspace.resolve(".metals/bsp.trace.json") + bsp.touch() writeLayout( MillBuildLayout( """|/MillMinimal/src/Main.scala @@ -40,6 +51,8 @@ class MillServerCodeLensSuite _ <- server.initialize() _ <- server.initialized() _ <- server.executeCommand(ServerCommands.GenerateBspConfig) + _ <- server.server.indexingPromise.future + .withTimeout(2, TimeUnit.MINUTES) _ <- server.didOpen("MillMinimal/src/Main.scala") _ <- server.didSave("MillMinimal/src/Main.scala")(identity) _ = assertNoDiagnostics()