Skip to content

Commit e3bb6a7

Browse files
Complete Scala dependencies too after --dep
1 parent 67f31b8 commit e3bb6a7

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

modules/cli/src/main/scala/scala/cli/commands/ScalaCommand.scala

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ import caseapp.core.parser.Parser
88
import caseapp.core.util.Formatter
99
import caseapp.core.{Arg, Error}
1010

11+
import scala.build.internal.Constants
1112
import scala.cli.commands.util.CommandHelpers
1213
import scala.cli.commands.util.SharedOptionsUtil._
1314
import scala.util.{Properties, Try}
@@ -62,9 +63,16 @@ abstract class ScalaCommand[T](implicit parser: Parser[T], help: Help[T])
6263
case "dependency" =>
6364
state.flatMap(sharedOptions).toList.flatMap { sharedOptions =>
6465
val cache = sharedOptions.coursierCache
66+
val sv = sharedOptions.buildOptions()
67+
.scalaParams
68+
.toOption
69+
.flatten
70+
.map(_.scalaVersion)
71+
.getOrElse(Constants.defaultScalaVersion)
6572
val (fromIndex, completions) = cache.logger.use {
6673
coursier.complete.Complete(cache)
6774
.withInput(prefix)
75+
.withScalaVersion(sv)
6876
.complete()
6977
.unsafeRun()(cache.ec)
7078
}

0 commit comments

Comments
 (0)