-
Notifications
You must be signed in to change notification settings - Fork 330
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: add setting to choose preferred build server
- Loading branch information
1 parent
3228b3f
commit 4c59ad7
Showing
6 changed files
with
129 additions
and
15 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
71 changes: 71 additions & 0 deletions
71
tests/slow/src/test/scala/tests/PreferredBuildServer.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,71 @@ | ||
package tests | ||
|
||
import scala.meta.internal.metals.UserConfiguration | ||
import scala.meta.internal.metals.{BuildInfo => V} | ||
|
||
class PreferredBuildServer extends BaseLspSuite("preferred-build-server") { | ||
override def userConfig: UserConfiguration = | ||
super.userConfig.copy(preferredBuildServes = List("sbt")) | ||
|
||
test("start-sbt-when-preferred-no-bsp") { | ||
cleanWorkspace() | ||
|
||
val fileLayout = | ||
s"""|/project/build.properties | ||
|sbt.version=${V.sbtVersion} | ||
|/build.sbt | ||
|${SbtBuildLayout.commonSbtSettings} | ||
|ThisBuild / scalaVersion := "${V.scala213}" | ||
|val a = project.in(file("a")) | ||
|/a/src/main/scala/a/A.scala | ||
|package a | ||
|object A { | ||
| val a = 1 | ||
|} | ||
|""".stripMargin | ||
FileLayout.fromString(fileLayout, workspace) | ||
|
||
for { | ||
_ <- server.initialize() | ||
_ <- server.initialized() | ||
_ <- server.server.buildServerPromise.future | ||
_ = assertNoDiff( | ||
server.server.tables.buildServers.selectedServer().get, | ||
"sbt", | ||
) | ||
_ = assert(server.server.bspSession.exists(_.main.isSbt)) | ||
} yield () | ||
} | ||
|
||
test("start-sbt-when-preferred-with-bsp") { | ||
cleanWorkspace() | ||
|
||
val fileLayout = | ||
s"""|/project/build.properties | ||
|sbt.version=${V.sbtVersion} | ||
|/build.sbt | ||
|${SbtBuildLayout.commonSbtSettings} | ||
|ThisBuild / scalaVersion := "${V.scala213}" | ||
|val a = project.in(file("a")) | ||
|/a/src/main/scala/a/A.scala | ||
|package a | ||
|object A { | ||
| val a = 1 | ||
|} | ||
|""".stripMargin | ||
|
||
FileLayout.fromString(fileLayout, workspace) | ||
SbtServerInitializer.generateBspConfig(workspace, V.sbtVersion) | ||
|
||
for { | ||
_ <- server.initialize() | ||
_ <- server.initialized() | ||
_ <- server.server.buildServerPromise.future | ||
_ = assertNoDiff( | ||
server.server.tables.buildServers.selectedServer().get, | ||
"sbt", | ||
) | ||
_ = assert(server.server.bspSession.exists(_.main.isSbt)) | ||
} 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