Skip to content

Commit

Permalink
improvement: Add test for iskra libary and improve mtags3 workaround
Browse files Browse the repository at this point in the history
mtags3 is a workaround to make scala 3 support work without selecting version in cross-version to Scala 3
  • Loading branch information
tgodzik committed Jun 28, 2023
1 parent 6788c7f commit 9ef4859
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 1 deletion.
4 changes: 3 additions & 1 deletion build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -355,6 +355,8 @@ lazy val mtags3 = project
sharedSettings,
mtagsSettings,
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "mtags" / "src" / "main" / "scala",
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "mtags-shared" / "src" / "main" / "scala",
Compile / unmanagedSourceDirectories += (ThisBuild / baseDirectory).value / "mtags-shared" / "src" / "main" / "scala-3",
moduleName := "mtags3",
scalaVersion := V.scala3,
target := (ThisBuild / baseDirectory).value / "mtags" / "target" / "target3",
Expand All @@ -363,7 +365,7 @@ lazy val mtags3 = project
(ThisBuild / baseDirectory).value / ".scalafix3.conf"
),
)
.dependsOn(mtagsShared)
.dependsOn(interfaces)
.enablePlugins(BuildInfoPlugin)

lazy val mtags = project
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -153,4 +153,54 @@ class CompletionCrossLspSuite
} yield ()
}

test("iskra-scala3") {
cleanWorkspace()
for {
_ <- initialize(
s"""/metals.json
|{
| "a": {
| "scalaVersion": "${V.scala3}",
| "libraryDependencies": [
| "org.virtuslab::iskra:0.0.3"
| ]
| }
|}
|/a/src/main/scala/Main.scala
|
|import org.virtuslab.iskra.api.*
|import org.virtuslab.iskra.api.given
|
|given spark: SparkSession = SparkSession
| .builder()
| .master("local")
| .appName("my-spark-app")
| .getOrCreate()
|
|object demo {
|
| case class Foo(x: Int, y: Int)
|
| val df = Seq(Foo(1, 420), Foo(2, 50)).toTypedDF
| // @@
| df.select {
| val sum = ($$.x + $$.y).as("sum")
| ($$.x, $$.y, sum)
| }
|
|}
|
|""".stripMargin
)
_ <- server.didOpen("a/src/main/scala/Main.scala")
_ = assertNoDiagnostics()
_ <- assertCompletion(
"df.sel@@",
"""|select: Select[?]
|""".stripMargin,
filename = Some("a/src/main/scala/Main.scala"),
)
} yield ()
}

}

0 comments on commit 9ef4859

Please sign in to comment.