diff --git a/metals/src/main/scala/scala/meta/internal/bsp/BspServers.scala b/metals/src/main/scala/scala/meta/internal/bsp/BspServers.scala index 284a5923e29..f6c24faf6c8 100644 --- a/metals/src/main/scala/scala/meta/internal/bsp/BspServers.scala +++ b/metals/src/main/scala/scala/meta/internal/bsp/BspServers.scala @@ -119,7 +119,7 @@ final class BspServers( args, projectDirectory, redirectErrorOutput = false, - variables, + variables + ("SCALA_CLI_POWER" -> "true"), processOut = None, processErr = Some(l => scribe.info("BSP server: " + l)), discardInput = false, diff --git a/metals/src/main/scala/scala/meta/internal/metals/scalacli/ScalaCli.scala b/metals/src/main/scala/scala/meta/internal/metals/scalacli/ScalaCli.scala index 164c36f6508..7117e1c58b3 100644 --- a/metals/src/main/scala/scala/meta/internal/metals/scalacli/ScalaCli.scala +++ b/metals/src/main/scala/scala/meta/internal/metals/scalacli/ScalaCli.scala @@ -243,7 +243,7 @@ object ScalaCli { command.toList, workspace, redirectErrorOutput = false, - env = Map(), + env = Map("SCALA_CLI_POWER" -> "true"), processOut = None, processErr = Some(line => scribe.info("Scala CLI: " + line)), discardInput = false, diff --git a/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala b/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala index ce477c7ec25..f5b02a550cb 100644 --- a/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala +++ b/tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala @@ -782,4 +782,19 @@ class ScalaCliSuite extends BaseScalaCliSuite("3.3.3") { _ = assertNoDiff(completion, "com.lihaoyi") } yield () } + + test("power-option") { + cleanWorkspace() + for { + _ <- scalaCliInitialize(useBsp = true)( + s"""|/MyTests.scala + |//> using scala ${scalaVersion} + |//> using packaging.dockerFrom openjdk:17 + | + |def main() = println("Hello world!") + |""".stripMargin + ) + _ <- server.didOpen("MyTests.scala") + } yield assertNoDiagnostics() + } }