-
Notifications
You must be signed in to change notification settings - Fork 337
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
bugfix: Allow run in Mill BSP and remove non working test lenses
Previously, we would show test code lense for Mill BSP, which did not work and not show run lenses which could work with newer Mill versions. Now, we only show run code lense, which can change id debug is supported by mill or we implement an alternative way of running tests.
- Loading branch information
Showing
11 changed files
with
234 additions
and
105 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
69 changes: 69 additions & 0 deletions
69
tests/slow/src/test/scala/tests/mill/MillServerCodeLensSuite.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
package tests.mill | ||
|
||
import scala.concurrent.duration.Duration | ||
|
||
import scala.meta.internal.metals.ServerCommands | ||
import scala.meta.internal.metals.{BuildInfo => V} | ||
|
||
import tests.BaseCodeLensLspSuite | ||
import tests.MillBuildLayout | ||
import tests.MillServerInitializer | ||
|
||
class MillServerCodeLensSuite | ||
extends BaseCodeLensLspSuite("mill-server-lenses", MillServerInitializer) { | ||
|
||
override def munitTimeout: Duration = Duration("4min") | ||
|
||
test("run-mill-lens", maxRetry = 3) { | ||
cleanWorkspace() | ||
writeLayout( | ||
MillBuildLayout( | ||
"""|/MillMinimal/src/Main.scala | ||
|package foo | ||
| | ||
|object Main { | ||
| def main(args: Array[String]): Unit = { | ||
| println("Hello java!") | ||
| } | ||
|} | ||
|/MillMinimal/test/src/Foo.scala | ||
|// no test lense as debug is not supported | ||
|class Foo extends munit.FunSuite {} | ||
|""".stripMargin, | ||
V.scala213, | ||
V.millVersion, | ||
includeMunit = true, | ||
) | ||
) | ||
|
||
for { | ||
_ <- server.initialize() | ||
_ <- server.initialized() | ||
_ <- server.executeCommand(ServerCommands.GenerateBspConfig) | ||
_ <- server.didOpen("MillMinimal/src/Main.scala") | ||
_ <- server.didSave("MillMinimal/src/Main.scala")(identity) | ||
_ = assertNoDiagnostics() | ||
_ <- assertCodeLenses( | ||
"MillMinimal/src/Main.scala", | ||
"""|package foo | ||
| | ||
|<<run>> | ||
|object Main { | ||
| def main(args: Array[String]): Unit = { | ||
| println("Hello java!") | ||
| } | ||
|}""".stripMargin, | ||
) | ||
_ <- assertCodeLenses( | ||
"MillMinimal/test/src/Foo.scala", | ||
"""|// no test lense as debug is not supported | ||
|class Foo extends munit.FunSuite {} | ||
|""".stripMargin, | ||
) | ||
lenses <- server.codeLenses("MillMinimal/src/Main.scala") | ||
_ = assert(lenses.size > 0, "No lenses were generated!") | ||
command = lenses.head.getCommand() | ||
_ = assertEquals(runFromCommand(command), Some("Hello java!")) | ||
} yield () | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.