diff --git a/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala b/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala index ad1397bfd93..ce9399b1ed9 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/debug/DebugProtocol.scala @@ -12,7 +12,6 @@ import com.google.gson.JsonElement import org.eclipse.lsp4j.debug.CompletionsArguments import org.eclipse.lsp4j.debug.DisconnectArguments import org.eclipse.lsp4j.debug.InitializeRequestArguments -import org.eclipse.lsp4j.debug.LaunchRequestArguments import org.eclipse.lsp4j.debug.OutputEventArguments import org.eclipse.lsp4j.debug.SetBreakpointsArguments import org.eclipse.lsp4j.debug.SetBreakpointsResponse @@ -137,11 +136,16 @@ object DebugProtocol { object LaunchRequest { def unapply(request: DebugRequestMessage): Option[DebugMode] = { if (request.getMethod != "launch") None - else - parse[LaunchRequestArguments](request.getParams).toOption.map { - case args if args.getNoDebug => DebugMode.Disabled - case _ => DebugMode.Enabled - } + else { + parse[java.util.Map[String, Object]](request.getParams).toOption + .map { map => + map.asScala.get("noDebug") match { + case Some(value: java.lang.Boolean) if value => DebugMode.Disabled + case Some(value: java.lang.Boolean) if !value => DebugMode.Enabled + case _ => DebugMode.Enabled + } + } + } } } diff --git a/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala b/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala index 2a40cefda0f..e58c531b4c7 100644 --- a/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala +++ b/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala @@ -12,6 +12,7 @@ import scala.meta.internal.metals.ServerCommands import scala.meta.internal.metals.debug.TestDebugger import scala.meta.internal.metals.scalacli.ScalaCli import scala.meta.internal.metals.{BuildInfo => V} +import scala.meta.internal.mtags.CoursierComplete import org.eclipse.{lsp4j => l} import tests.FileLayout @@ -472,14 +473,21 @@ class ScalaCliSuite extends BaseScalaCliSuite(V.scala3) { } yield () } + val coursierComplete = new CoursierComplete(scalaVersion) + val newestToolkit: String = coursierComplete + .complete("org.scala-lang::toolkit:") + .headOption + .map(_.split(":").last) + .getOrElse("default") + test("properly-reindex") { cleanWorkspace() server.client.importBuild = Messages.ImportBuild.yes for { _ <- scalaCliInitialize(useBsp = true)( s"""|/Main.scala - |//> using scala 2.13.11 - |// > using toolkit default + |//> using scala ${scalaVersion} + |// > using toolkit ${newestToolkit} | |object Main { | println(os.pwd) @@ -491,7 +499,7 @@ class ScalaCliSuite extends BaseScalaCliSuite(V.scala3) { _ <- server.didOpen("Main.scala") _ = assertEquals( server.client.workspaceDiagnostics, - """|Main.scala:5:13: error: not found: value os + """|Main.scala:5:13: error: Not found: os | println(os.pwd) | ^^ |""".stripMargin,