Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

More tweaks to simplify BSP logic #2521

Merged
merged 1 commit into from
May 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions bsp/src/mill/bsp/BspContext.scala
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ class BspContext(streams: SystemStreams, bspLogStream: Option[PrintStream], home
BspContext.bspServerHandle =
try {
startBspServer(
initialEvaluator = None,
streams = streams,
logStream = bspLogStream,
canReload = true
Expand All @@ -39,7 +38,6 @@ class BspContext(streams: SystemStreams, bspLogStream: Option[PrintStream], home
streams.err.println("BSP server started")

def startBspServer(
initialEvaluator: Option[Evaluator],
streams: SystemStreams,
logStream: Option[PrintStream],
canReload: Boolean
Expand All @@ -62,7 +60,6 @@ class BspContext(streams: SystemStreams, bspLogStream: Option[PrintStream], home
BspWorker(os.pwd, home, log).flatMap { worker =>
os.makeDir.all(home / Constants.bspDir)
worker.startBspServer(
initialEvaluator,
streams,
logStream.getOrElse(streams.err),
home / Constants.bspDir,
Expand Down
1 change: 0 additions & 1 deletion bsp/src/mill/bsp/BspWorker.scala
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ import java.net.URL
@internal
trait BspWorker {
def startBspServer(
initialEvaluator: Option[Evaluator],
streams: SystemStreams,
logStream: PrintStream,
logDir: os.Path,
Expand Down
3 changes: 0 additions & 3 deletions bsp/worker/src/mill/bsp/worker/BspWorkerImpl.scala
Original file line number Diff line number Diff line change
Expand Up @@ -15,17 +15,14 @@ import scala.concurrent.{Await, CancellationException, Promise}
private class BspWorkerImpl() extends BspWorker {

override def startBspServer(
initialEvaluator: Option[Evaluator],
streams: SystemStreams,
logStream: PrintStream,
logDir: os.Path,
canReload: Boolean
): Either[String, BspServerHandle] = {
val evaluator = initialEvaluator.map(_.withFailFast(false))

val millServer =
new MillBuildServer(
initialEvaluator = evaluator,
bspVersion = Constants.bspProtocolVersion,
serverVersion = MillBuildInfo.millVersion,
serverName = Constants.serverName,
Expand Down
3 changes: 1 addition & 2 deletions bsp/worker/src/mill/bsp/worker/MillBuildServer.scala
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ import scala.util.{Failure, Success, Try}
import Utils.sanitizeUri
import mill.bsp.BspServerResult
private class MillBuildServer(
initialEvaluator: Option[Evaluator],
bspVersion: String,
serverVersion: String,
serverName: String,
Expand All @@ -97,7 +96,7 @@ private class MillBuildServer(
private[this] var statePromise: Promise[State] = Promise[State]()
var evaluatorOpt: Option[Evaluator] = None
def evaluator = evaluatorOpt.get
updateEvaluator(initialEvaluator)

def updateEvaluator(evaluator: Option[Evaluator]): Unit = {
debug(s"Updating Evaluator: $evaluator")
if (statePromise.isCompleted) statePromise = Promise[State]() // replace the promise
Expand Down