diff --git a/src/main/scala/afenton/bazel/bsp/BazelBspApp.scala b/src/main/scala/afenton/bazel/bsp/BazelBspApp.scala index 10dc392..1788677 100644 --- a/src/main/scala/afenton/bazel/bsp/BazelBspApp.scala +++ b/src/main/scala/afenton/bazel/bsp/BazelBspApp.scala @@ -102,9 +102,9 @@ object BazelBspApp val program = for errQ <- Queue.bounded[IO, String](100) outQ <- Queue.bounded[IO, Message](100) - logger = new QueueLogger(errQ, verbose) - client = new MyBspClient(outQ, logger) - stateRef <- Ref.of[IO, ServerState](ServerState.default) + logger = Logger.toQueue(errQ, verbose) + client = BspClient.toQueue(outQ, logger) + stateRef <- Ref.of[IO, BazelBspServer.ServerState](BazelBspServer.defaultState) server = new BazelBspServer( client, logger, diff --git a/src/main/scala/afenton/bazel/bsp/BazelBspServer.scala b/src/main/scala/afenton/bazel/bsp/BazelBspServer.scala index 5cbac7c..6da6b78 100644 --- a/src/main/scala/afenton/bazel/bsp/BazelBspServer.scala +++ b/src/main/scala/afenton/bazel/bsp/BazelBspServer.scala @@ -4,37 +4,26 @@ import afenton.bazel.bsp.jrpc.JRpcClient import afenton.bazel.bsp.jrpc.Message import afenton.bazel.bsp.jrpc.Notification import afenton.bazel.bsp.protocol.* -import afenton.bazel.bsp.runner.BazelRunner import afenton.bazel.bsp.runner.BazelLabel +import afenton.bazel.bsp.runner.BazelRunner import cats.effect.IO import cats.effect.kernel.Ref import cats.effect.std.Queue import cats.syntax.all._ import io.bazel.rules_scala.diagnostics.diagnostics.FileDiagnostics +import io.circe.Decoder +import io.circe.DecodingFailure +import io.circe.Json import io.circe.syntax._ import java.net.URI import java.nio.file.Path import java.nio.file.Paths -import io.circe.Json -import io.circe.Decoder -import io.circe.DecodingFailure - -case class ServerState( - targetSourceMap: TargetSourceMap, - currentErrors: List[FileDiagnostics], - workspaceRoot: Option[Path], - bazelRunner: Option[BazelRunner], - targets: List[BuildTarget] -) - -object ServerState: - def default: ServerState = ServerState(TargetSourceMap.empty, Nil, None, None, Nil) class BazelBspServer( client: BspClient, logger: Logger, - stateRef: Ref[IO, ServerState] + stateRef: Ref[IO, BazelBspServer.ServerState] ) extends BspServer(client): private val version = "0.1" @@ -78,7 +67,7 @@ class BazelBspServer( state.bazelRunner.get, ws.targets.map(_.id) ) - _ <- stateRef.update(s => s.copy(targetSourceMap = TargetSourceMap(ts))) + _ <- stateRef.update(s => s.copy(targetSourceMap = BazelBspServer.TargetSourceMap(ts))) yield () def buildTargetInverseSources( @@ -320,55 +309,43 @@ class BazelBspServer( end BazelBspServer -class MyBspClient(stdOutQ: Queue[IO, Message], logger: Logger) - extends BspClient - with JRpcClient: - - def sendNotification(n: Notification): IO[Unit] = - for - _ <- logger.info(n.method) - _ <- stdOutQ.offer(n) - yield () - - def publishDiagnostics(params: PublishDiagnosticsParams): IO[Unit] = - sendNotification("build/publishDiagnostics", params) - - def buildTaskStart(params: TaskStartParams): IO[Unit] = - sendNotification("build/taskStart", params) - - def buildTaskProgress(params: TaskProgressParams): IO[Unit] = - sendNotification("build/taskProgress", params) - - def buildTaskFinished(params: TaskFinishParams): IO[Unit] = - sendNotification("build/taskFinish", params) - - def buildShowMessage(params: ShowMessageParams): IO[Unit] = - sendNotification("build/showMessage", params) - -case class TargetSourceMap( - val _targetSources: Map[BuildTargetIdentifier, List[ - TextDocumentIdentifier - ]] -): - - private def invertMap[K, V](map: Map[K, List[V]]): Map[V, List[K]] = - map.toList - .flatMap((bt, ls) => ls.map(l => (l, bt))) - .groupMap(_._1)(_._2) - - private val sourceTargets - : Map[TextDocumentIdentifier, List[BuildTargetIdentifier]] = - invertMap(_targetSources) - - def sourcesForTarget( - bt: BuildTargetIdentifier - ): List[TextDocumentIdentifier] = - _targetSources.get(bt).getOrElse(Nil) - - def targetsForSource( - td: TextDocumentIdentifier - ): List[BuildTargetIdentifier] = - sourceTargets.get(td).getOrElse(Nil) - -object TargetSourceMap: - def empty: TargetSourceMap = TargetSourceMap(Map.empty) +object BazelBspServer: + + case class ServerState( + targetSourceMap: BazelBspServer.TargetSourceMap, + currentErrors: List[FileDiagnostics], + workspaceRoot: Option[Path], + bazelRunner: Option[BazelRunner], + targets: List[BuildTarget] + ) + + def defaultState: ServerState = + ServerState(BazelBspServer.TargetSourceMap.empty, Nil, None, None, Nil) + + protected case class TargetSourceMap( + val _targetSources: Map[BuildTargetIdentifier, List[ + TextDocumentIdentifier + ]] + ): + + private def invertMap[K, V](map: Map[K, List[V]]): Map[V, List[K]] = + map.toList + .flatMap((bt, ls) => ls.map(l => (l, bt))) + .groupMap(_._1)(_._2) + + private val sourceTargets + : Map[TextDocumentIdentifier, List[BuildTargetIdentifier]] = + invertMap(_targetSources) + + def sourcesForTarget( + bt: BuildTargetIdentifier + ): List[TextDocumentIdentifier] = + _targetSources.get(bt).getOrElse(Nil) + + def targetsForSource( + td: TextDocumentIdentifier + ): List[BuildTargetIdentifier] = + sourceTargets.get(td).getOrElse(Nil) + + object TargetSourceMap: + def empty: TargetSourceMap = TargetSourceMap(Map.empty) diff --git a/src/main/scala/afenton/bazel/bsp/FilesIO.scala b/src/main/scala/afenton/bazel/bsp/FilesIO.scala index 795f9fc..516aaf5 100644 --- a/src/main/scala/afenton/bazel/bsp/FilesIO.scala +++ b/src/main/scala/afenton/bazel/bsp/FilesIO.scala @@ -1,16 +1,17 @@ package afenton.bazel.bsp import cats.effect.IO -import java.nio.file.Path -import java.nio.file.Files -import scala.util.Try -import scala.jdk.CollectionConverters.* -import io.circe.Decoder -import java.nio.file.PathMatcher -import java.nio.file.FileVisitOption import fs2.Stream -import java.nio.file.FileSystems +import io.circe.Decoder + import java.nio.file.FileSystem +import java.nio.file.FileSystems +import java.nio.file.FileVisitOption +import java.nio.file.Files +import java.nio.file.Path +import java.nio.file.PathMatcher +import scala.jdk.CollectionConverters.* +import scala.util.Try object FilesIO: diff --git a/src/main/scala/afenton/bazel/bsp/Logger.scala b/src/main/scala/afenton/bazel/bsp/Logger.scala index 53ddd08..cc764df 100644 --- a/src/main/scala/afenton/bazel/bsp/Logger.scala +++ b/src/main/scala/afenton/bazel/bsp/Logger.scala @@ -1,9 +1,10 @@ package afenton.bazel.bsp -import scala.io.AnsiColor import cats.effect.IO import cats.effect.std.Queue +import scala.io.AnsiColor + trait Logger: def trace(msg: String*): IO[Unit] def info(msg: String*): IO[Unit] @@ -19,26 +20,29 @@ object Logger: def error(msgs: String*): IO[Unit] = trace(msgs*) } -class QueueLogger(stdErrQ: Queue[IO, String], verbose: Boolean) extends Logger: - private def format(level: Logger.Level, msgs: Seq[String]) = - def fmt(level: String, color: String, msgs: Seq[String]) = - val withVisibleLineEndings = - msgs.map(_.replace("\r\n", "[CRLF]\n")).mkString("\n") + def toQueue(errQ: Queue[IO, String], verbose: Boolean): Logger = + QueueLogger(errQ, verbose) + + private class QueueLogger(errQ: Queue[IO, String], verbose: Boolean) extends Logger: + private def format(level: Logger.Level, msgs: Seq[String]) = + def fmt(level: String, color: String, msgs: Seq[String]) = + val withVisibleLineEndings = + msgs.map(_.replace("\r\n", "[CRLF]\n")).mkString("\n") - s"[${color}${level}${AnsiColor.RESET}] ${color}${withVisibleLineEndings}${AnsiColor.RESET}" + s"[${color}${level}${AnsiColor.RESET}] ${color}${withVisibleLineEndings}${AnsiColor.RESET}" - level match { - case Logger.Level.Trace => fmt("trace", AnsiColor.CYAN, msgs) - case Logger.Level.Info => fmt("info", AnsiColor.GREEN, msgs) - case Logger.Level.Error => fmt("error", AnsiColor.RED, msgs) - } + level match { + case Logger.Level.Trace => fmt("trace", AnsiColor.CYAN, msgs) + case Logger.Level.Info => fmt("info", AnsiColor.GREEN, msgs) + case Logger.Level.Error => fmt("error", AnsiColor.RED, msgs) + } - def trace(msgs: String*): IO[Unit] = - if verbose then stdErrQ.offer(format(Logger.Level.Trace, msgs)) - else IO.unit + def trace(msgs: String*): IO[Unit] = + if verbose then errQ.offer(format(Logger.Level.Trace, msgs)) + else IO.unit - def info(msgs: String*): IO[Unit] = - stdErrQ.offer(format(Logger.Level.Info, msgs)) + def info(msgs: String*): IO[Unit] = + errQ.offer(format(Logger.Level.Info, msgs)) - def error(msgs: String*): IO[Unit] = - stdErrQ.offer(format(Logger.Level.Error, msgs)) + def error(msgs: String*): IO[Unit] = + errQ.offer(format(Logger.Level.Error, msgs)) diff --git a/src/main/scala/afenton/bazel/bsp/jrpc/JRpc.scala b/src/main/scala/afenton/bazel/bsp/jrpc/JRpc.scala index 1e68efd..1a63a4e 100644 --- a/src/main/scala/afenton/bazel/bsp/jrpc/JRpc.scala +++ b/src/main/scala/afenton/bazel/bsp/jrpc/JRpc.scala @@ -1,5 +1,8 @@ package afenton.bazel.bsp.jrpc +import afenton.bazel.bsp.Logger +import afenton.bazel.bsp.jrpc.PartialJson.JObject +import afenton.bazel.bsp.protocol.BspClient import cats.data.NonEmptyList import cats.effect.IO import cats.parse.Rfc5234 @@ -10,12 +13,10 @@ import fs2.Pipe import fs2.Pull import fs2.Stream import io.circe._ +import io.circe.generic.semiauto.* import io.circe.syntax.* -import afenton.bazel.bsp.jrpc.PartialJson.JObject -import afenton.bazel.bsp.Logger + import scala.reflect.TypeTest -import io.circe.generic.semiauto.* -import afenton.bazel.bsp.protocol.BspClient sealed trait Message: def jsonrpc: "2.0" diff --git a/src/main/scala/afenton/bazel/bsp/jrpc/PartialJson.scala b/src/main/scala/afenton/bazel/bsp/jrpc/PartialJson.scala index 14bf806..e30cd83 100644 --- a/src/main/scala/afenton/bazel/bsp/jrpc/PartialJson.scala +++ b/src/main/scala/afenton/bazel/bsp/jrpc/PartialJson.scala @@ -1,6 +1,7 @@ package afenton.bazel.bsp.jrpc -import cats.parse.{Parser => P, Parser0 => P0} +import cats.parse.{Parser => P} +import cats.parse.{Parser0 => P0} sealed trait PartialJson: def asString: String diff --git a/src/main/scala/afenton/bazel/bsp/protocol/BspClient.scala b/src/main/scala/afenton/bazel/bsp/protocol/BspClient.scala index 9b5df69..478367c 100644 --- a/src/main/scala/afenton/bazel/bsp/protocol/BspClient.scala +++ b/src/main/scala/afenton/bazel/bsp/protocol/BspClient.scala @@ -1,6 +1,11 @@ package afenton.bazel.bsp.protocol +import afenton.bazel.bsp.Logger +import afenton.bazel.bsp.jrpc.JRpcClient +import afenton.bazel.bsp.jrpc.Message +import afenton.bazel.bsp.jrpc.Notification import cats.effect.IO +import cats.effect.std.Queue trait BspClient: def publishDiagnostics(params: PublishDiagnosticsParams): IO[Unit] @@ -8,3 +13,33 @@ trait BspClient: def buildTaskProgress(params: TaskProgressParams): IO[Unit] def buildTaskFinished(params: TaskFinishParams): IO[Unit] def buildShowMessage(params: ShowMessageParams): IO[Unit] + +object BspClient: + + def toQueue(outQ: Queue[IO, Message], logger: Logger): BspClient = + BspClientImpl(outQ, logger) + + private class BspClientImpl(outQ: Queue[IO, Message], logger: Logger) + extends BspClient + with JRpcClient: + + def sendNotification(n: Notification): IO[Unit] = + for + _ <- logger.info(n.method) + _ <- outQ.offer(n) + yield () + + def publishDiagnostics(params: PublishDiagnosticsParams): IO[Unit] = + sendNotification("build/publishDiagnostics", params) + + def buildTaskStart(params: TaskStartParams): IO[Unit] = + sendNotification("build/taskStart", params) + + def buildTaskProgress(params: TaskProgressParams): IO[Unit] = + sendNotification("build/taskProgress", params) + + def buildTaskFinished(params: TaskFinishParams): IO[Unit] = + sendNotification("build/taskFinish", params) + + def buildShowMessage(params: ShowMessageParams): IO[Unit] = + sendNotification("build/showMessage", params) \ No newline at end of file diff --git a/src/main/scala/afenton/bazel/bsp/protocol/BspServer.scala b/src/main/scala/afenton/bazel/bsp/protocol/BspServer.scala index 6ca1cdd..0386343 100644 --- a/src/main/scala/afenton/bazel/bsp/protocol/BspServer.scala +++ b/src/main/scala/afenton/bazel/bsp/protocol/BspServer.scala @@ -1,7 +1,8 @@ package afenton.bazel.bsp.protocol -import cats.effect.IO import afenton.bazel.bsp.jrpc.RpcFunction +import cats.effect.IO + import java.net.URI trait BspServer(client: BspClient): diff --git a/src/main/scala/afenton/bazel/bsp/protocol/Models.scala b/src/main/scala/afenton/bazel/bsp/protocol/Models.scala index 3975c74..b0adac1 100644 --- a/src/main/scala/afenton/bazel/bsp/protocol/Models.scala +++ b/src/main/scala/afenton/bazel/bsp/protocol/Models.scala @@ -4,6 +4,7 @@ import afenton.bazel.bsp.jrpc.Notification import afenton.bazel.bsp.jrpc.RpcFunction import afenton.bazel.bsp.jrpc.decodeIntOrString import afenton.bazel.bsp.jrpc.encodeIntOrString +import afenton.bazel.bsp.runner.BazelLabel import cats.effect.IO import io.bazel.rules_scala.diagnostics.diagnostics.FileDiagnostics as ScalacDiagnostic import io.bazel.rules_scala.diagnostics.diagnostics.Position as ScalacPosition @@ -16,7 +17,6 @@ import io.circe.syntax._ import java.net.URI import java.nio.file.Path import java.nio.file.Paths -import afenton.bazel.bsp.runner.BazelLabel object UriFactory: def fileUri(path: Path): URI = diff --git a/src/main/scala/afenton/bazel/bsp/runner/BazelLabel.scala b/src/main/scala/afenton/bazel/bsp/runner/BazelLabel.scala index a0085ec..09a89a1 100644 --- a/src/main/scala/afenton/bazel/bsp/runner/BazelLabel.scala +++ b/src/main/scala/afenton/bazel/bsp/runner/BazelLabel.scala @@ -1,17 +1,18 @@ package afenton.bazel.bsp.runner -import java.nio.file.Path -import cats.parse.Parser as P -import cats.parse.Parser0 as P0 -import cats.parse.Rfc5234 -import java.nio.file.Paths import afenton.bazel.bsp.protocol.BuildTargetIdentifier +import afenton.bazel.bsp.runner.BPath.BCons +import afenton.bazel.bsp.runner.BPath.BNil +import afenton.bazel.bsp.runner.BPath.Wildcard import cats.effect.kernel.syntax.resource import cats.instances.tailRec +import cats.parse.Rfc5234 +import cats.parse.Parser as P +import cats.parse.Parser0 as P0 + +import java.nio.file.Path +import java.nio.file.Paths import scala.annotation.tailrec -import afenton.bazel.bsp.runner.BPath.Wildcard -import afenton.bazel.bsp.runner.BPath.BCons -import afenton.bazel.bsp.runner.BPath.BNil sealed trait BazelTarget: def asString: String = this match diff --git a/src/main/scala/afenton/bazel/bsp/runner/BazelRunner.scala b/src/main/scala/afenton/bazel/bsp/runner/BazelRunner.scala index d8d6a46..a96366c 100644 --- a/src/main/scala/afenton/bazel/bsp/runner/BazelRunner.scala +++ b/src/main/scala/afenton/bazel/bsp/runner/BazelRunner.scala @@ -1,5 +1,8 @@ package afenton.bazel.bsp.runner +import afenton.bazel.bsp.FilesIO +import afenton.bazel.bsp.Logger +import afenton.bazel.bsp.protocol.BspServer import afenton.bazel.bsp.protocol.BuildTargetIdentifier import afenton.bazel.bsp.protocol.TextDocumentIdentifier import afenton.bazel.bsp.protocol.UriFactory @@ -21,15 +24,12 @@ import java.nio.file.Path import java.nio.file.Paths import java.util.concurrent.TimeUnit import scala.concurrent.duration.Duration +import scala.concurrent.duration.FiniteDuration import scala.jdk.CollectionConverters._ import scala.util.Failure import scala.util.Success import scala.util.Success.apply import scala.util.Try -import afenton.bazel.bsp.FilesIO -import afenton.bazel.bsp.Logger -import scala.concurrent.duration.FiniteDuration -import afenton.bazel.bsp.protocol.BspServer case class BazelSources(sources: List[String], buildFiles: List[String]) object BazelSources: diff --git a/src/main/scala/afenton/bazel/bsp/runner/SubProcess.scala b/src/main/scala/afenton/bazel/bsp/runner/SubProcess.scala index f783969..22fb845 100644 --- a/src/main/scala/afenton/bazel/bsp/runner/SubProcess.scala +++ b/src/main/scala/afenton/bazel/bsp/runner/SubProcess.scala @@ -1,12 +1,12 @@ package afenton.bazel.bsp.runner import cats.effect.IO +import cats.effect.kernel.Resource import fs2.Stream import java.nio.file.Files import java.nio.file.Path import scala.concurrent.duration.FiniteDuration -import cats.effect.kernel.Resource sealed trait SetEnv object SetEnv { diff --git a/src/main/scala/afenton/bazel/bsp/runner/package.scala b/src/main/scala/afenton/bazel/bsp/runner/package.scala deleted file mode 100644 index f256c69..0000000 --- a/src/main/scala/afenton/bazel/bsp/runner/package.scala +++ /dev/null @@ -1,147 +0,0 @@ -/* - * Scala (https://www.scala-lang.org) - * - * Copyright EPFL and Lightbend, Inc. - * - * Licensed under Apache License 2.0 - * (http://www.apache.org/licenses/LICENSE-2.0). - * - * See the NOTICE file distributed with this work for - * additional information regarding copyright ownership. - */ - -import scala.annotation.migration - -/** - * Core Scala types. They are always available without an explicit import. - * @contentDiagram hideNodes "scala.Serializable" - */ -package object scala { - type Cloneable = java.lang.Cloneable - type Serializable = java.io.Serializable - - type Throwable = java.lang.Throwable - type Exception = java.lang.Exception - type Error = java.lang.Error - - type RuntimeException = java.lang.RuntimeException - type NullPointerException = java.lang.NullPointerException - type ClassCastException = java.lang.ClassCastException - type IndexOutOfBoundsException = java.lang.IndexOutOfBoundsException - type ArrayIndexOutOfBoundsException = java.lang.ArrayIndexOutOfBoundsException - type StringIndexOutOfBoundsException = java.lang.StringIndexOutOfBoundsException - type UnsupportedOperationException = java.lang.UnsupportedOperationException - type IllegalArgumentException = java.lang.IllegalArgumentException - type NoSuchElementException = java.util.NoSuchElementException - type NumberFormatException = java.lang.NumberFormatException - type AbstractMethodError = java.lang.AbstractMethodError - type InterruptedException = java.lang.InterruptedException - - // A dummy used by the specialization annotation. - val AnyRef = new Specializable { - override def toString = "object AnyRef" - } - - @deprecated("Use IterableOnce instead of TraversableOnce", "2.13.0") - type TraversableOnce[+A] = scala.collection.IterableOnce[A] - - type IterableOnce[+A] = scala.collection.IterableOnce[A] - - @deprecated("Use Iterable instead of Traversable", "2.13.0") - type Traversable[+A] = scala.collection.Iterable[A] - @deprecated("Use Iterable instead of Traversable", "2.13.0") - val Traversable = scala.collection.Iterable - - type Iterable[+A] = scala.collection.Iterable[A] - val Iterable = scala.collection.Iterable - - @migration("scala.Seq is now scala.collection.immutable.Seq instead of scala.collection.Seq", "2.13.0") - type Seq[+A] = scala.collection.immutable.Seq[A] - val Seq = scala.collection.immutable.Seq - - @migration("scala.IndexedSeq is now scala.collection.immutable.IndexedSeq instead of scala.collection.IndexedSeq", "2.13.0") - type IndexedSeq[+A] = scala.collection.immutable.IndexedSeq[A] - val IndexedSeq = scala.collection.immutable.IndexedSeq - - type Iterator[+A] = scala.collection.Iterator[A] - val Iterator = scala.collection.Iterator - - @deprecated("Use scala.collection.BufferedIterator instead of scala.BufferedIterator", "2.13.0") - type BufferedIterator[+A] = scala.collection.BufferedIterator[A] - - type List[+A] = scala.collection.immutable.List[A] - val List = scala.collection.immutable.List - - val Nil = scala.collection.immutable.Nil - - type ::[+A] = scala.collection.immutable.::[A] - val :: = scala.collection.immutable.:: - - val +: = scala.collection.+: - val :+ = scala.collection.:+ - - @deprecated("Use LazyList instead of Stream", "2.13.0") - type Stream[+A] = scala.collection.immutable.Stream[A] - @deprecated("Use LazyList instead of Stream", "2.13.0") - val Stream = scala.collection.immutable.Stream - - type LazyList[+A] = scala.collection.immutable.LazyList[A] - val LazyList = scala.collection.immutable.LazyList - // This should be an alias to LazyList.#:: but we need to support Stream, too - //val #:: = scala.collection.immutable.LazyList.#:: - object #:: { - def unapply[A](s: LazyList[A]): Option[(A, LazyList[A])] = - if (s.nonEmpty) Some((s.head, s.tail)) else None - @deprecated("Prefer LazyList instead", since = "2.13.0") - def unapply[A](s: Stream[A]): Option[(A, Stream[A])] = - if (s.nonEmpty) Some((s.head, s.tail)) else None - } - - type Vector[+A] = scala.collection.immutable.Vector[A] - val Vector = scala.collection.immutable.Vector - - type StringBuilder = scala.collection.mutable.StringBuilder - val StringBuilder = scala.collection.mutable.StringBuilder - - type Range = scala.collection.immutable.Range - val Range = scala.collection.immutable.Range - - // Numeric types which were moved into scala.math.* - - type BigDecimal = scala.math.BigDecimal - val BigDecimal = scala.math.BigDecimal - - type BigInt = scala.math.BigInt - val BigInt = scala.math.BigInt - - type Equiv[T] = scala.math.Equiv[T] - val Equiv = scala.math.Equiv - - type Fractional[T] = scala.math.Fractional[T] - val Fractional = scala.math.Fractional - - type Integral[T] = scala.math.Integral[T] - val Integral = scala.math.Integral - - type Numeric[T] = scala.math.Numeric[T] - val Numeric = scala.math.Numeric - - type Ordered[T] = scala.math.Ordered[T] - val Ordered = scala.math.Ordered - - type Ordering[T] = scala.math.Ordering[T] - val Ordering = scala.math.Ordering - - type PartialOrdering[T] = scala.math.PartialOrdering[T] - type PartiallyOrdered[T] = scala.math.PartiallyOrdered[T] - - type Either[+A, +B] = scala.util.Either[A, B] - val Either = scala.util.Either - - type Left[+A, +B] = scala.util.Left[A, B] - val Left = scala.util.Left - - type Right[+A, +B] = scala.util.Right[A, B] - val Right = scala.util.Right - -} diff --git a/src/test/scala/afenton/bazel/bsp/BspHelpers.scala b/src/test/scala/afenton/bazel/bsp/BspHelpers.scala index a3e7a64..055f3db 100644 --- a/src/test/scala/afenton/bazel/bsp/BspHelpers.scala +++ b/src/test/scala/afenton/bazel/bsp/BspHelpers.scala @@ -5,8 +5,10 @@ import afenton.bazel.bsp.protocol.BuildServerCapabilities import afenton.bazel.bsp.protocol.BuildTargetIdentifier import afenton.bazel.bsp.protocol.CompileProvider import afenton.bazel.bsp.protocol.Diagnostic +import afenton.bazel.bsp.protocol.DiagnosticSeverity import afenton.bazel.bsp.protocol.InitializeBuildResult import afenton.bazel.bsp.protocol.PublishDiagnosticsParams +import afenton.bazel.bsp.protocol.Range import afenton.bazel.bsp.protocol.StatusCode import afenton.bazel.bsp.protocol.TaskFinishParams import afenton.bazel.bsp.protocol.TaskStartParams @@ -19,8 +21,6 @@ import java.nio.file.Path import java.nio.file.Paths import scala.concurrent.duration._ import scala.reflect.Typeable -import afenton.bazel.bsp.protocol.DiagnosticSeverity -import afenton.bazel.bsp.protocol.Range trait BspHelpers { self: munit.FunSuite => diff --git a/src/test/scala/afenton/bazel/bsp/End2EndTest.scala b/src/test/scala/afenton/bazel/bsp/End2EndTest.scala index e954227..b7d36c5 100644 --- a/src/test/scala/afenton/bazel/bsp/End2EndTest.scala +++ b/src/test/scala/afenton/bazel/bsp/End2EndTest.scala @@ -12,6 +12,7 @@ import afenton.bazel.bsp.protocol.Range import afenton.bazel.bsp.protocol.StatusCode import afenton.bazel.bsp.protocol.TaskFinishParams import afenton.bazel.bsp.protocol.TaskStartParams +import afenton.bazel.bsp.runner.BazelRunner import io.circe.Decoder import io.circe.Json import io.circe.syntax.* @@ -20,7 +21,6 @@ import java.nio.file.Path import java.nio.file.Paths import scala.concurrent.duration._ import scala.reflect.Typeable -import afenton.bazel.bsp.runner.BazelRunner class End2EndTest extends munit.CatsEffectSuite with BspHelpers { diff --git a/src/test/scala/afenton/bazel/bsp/LspTestProcess.scala b/src/test/scala/afenton/bazel/bsp/LspTestProcess.scala index 8e619af..15d4afe 100644 --- a/src/test/scala/afenton/bazel/bsp/LspTestProcess.scala +++ b/src/test/scala/afenton/bazel/bsp/LspTestProcess.scala @@ -247,7 +247,7 @@ case class LspTestProcess(workspaceRoot: Path): None, None ) - ).marker("AFTER COMPILE IN LSP") + ) resp <- dResp.get yield resp