Skip to content

Commit

Permalink
fix: completions for using directive deps when test scope
Browse files Browse the repository at this point in the history
  • Loading branch information
kasiaMarek committed Aug 22, 2024
1 parent 9ba2829 commit a644424
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ object CoursierComplete {
(editStart, editEnd)
}

val reg: Regex = """//>\s*using\s+(lib|plugin|dep)s?\s+"?(.*)""".r
val reg: Regex = """//>\s*using\s+(?:test\.)?(lib|plugin|dep)s?\s+"?(.*)""".r
def isScalaCliDep(line: String): Option[String] = {
line match {
case reg(_, deps) =>
Expand Down
16 changes: 16 additions & 0 deletions tests/slow/src/test/scala/tests/scalacli/ScalaCliSuite.scala
Original file line number Diff line number Diff line change
Expand Up @@ -765,4 +765,20 @@ class ScalaCliSuite extends BaseScalaCliSuite(V.scala3) {
)
} yield ()
}

test("completions-for-test-scope") {
for {
_ <- scalaCliInitialize(useBsp = true)(
s"""/MyTests.sc
|//> using scala $scalaVersion
|//> using test.dep com.lihaoyi::utest::0.7.10
|""".stripMargin
)
completion <- server.completion(
"MyTests.sc",
"//> using test.dep com.lihao@@yi::utest",
)
_ = assertNoDiff(completion, "com.lihaoyi")
} yield ()
}
}

0 comments on commit a644424

Please sign in to comment.