mirror of https://github.com/sbt/sbt.git
[BSP] Remove useless log after request failure
This commit is contained in:
parent
f58c8c349a
commit
852498e992
|
|
@ -22,18 +22,17 @@ import java.util.concurrent.atomic.{ AtomicBoolean, AtomicReference }
|
|||
|
||||
import sbt.BasicCommandStrings.{ Shutdown, TerminateAction }
|
||||
import sbt.internal.langserver.{ CancelRequestParams, ErrorCodes, LogMessageParams, MessageType }
|
||||
import sbt.internal.langserver.{ CancelRequestParams, ErrorCodes }
|
||||
import sbt.internal.protocol.{
|
||||
JsonRpcNotificationMessage,
|
||||
JsonRpcRequestMessage,
|
||||
JsonRpcResponseError,
|
||||
JsonRpcResponseMessage
|
||||
}
|
||||
|
||||
import sbt.internal.ui.{ UITask, UserThread }
|
||||
import sbt.internal.util.{ Prompt, ReadJsonFromInputStream, Terminal, Util }
|
||||
import sbt.internal.util.Terminal.TerminalImpl
|
||||
import sbt.internal.util.complete.{ Parser, Parsers }
|
||||
import sbt.protocol._
|
||||
import sbt.util.Logger
|
||||
|
||||
import scala.annotation.{ nowarn, tailrec }
|
||||
|
|
@ -41,13 +40,14 @@ import scala.collection.mutable
|
|||
import scala.concurrent.duration._
|
||||
import scala.util.Try
|
||||
import scala.util.control.NonFatal
|
||||
import Serialization.{ attach, cancelReadSystemIn, readSystemIn }
|
||||
import sbt.protocol._
|
||||
import sbt.protocol.Serialization.{ attach, cancelReadSystemIn, readSystemIn, promptChannel }
|
||||
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
|
||||
import sjsonnew._
|
||||
import sjsonnew.support.scalajson.unsafe.{ CompactPrinter, Converter }
|
||||
|
||||
import BasicJsonProtocol._
|
||||
import Serialization.{ attach, promptChannel }
|
||||
import sbt.internal.util.ProgressState
|
||||
|
||||
final class NetworkChannel(
|
||||
|
|
@ -259,7 +259,11 @@ final class NetworkChannel(
|
|||
case Some(request) =>
|
||||
pendingRequests -= request.id
|
||||
jsonRpcRespondError(request.id, err)
|
||||
case _ => logMessage("error", s"Error ${err.code}: ${err.message}")
|
||||
case _ =>
|
||||
import sbt.internal.protocol.codec.JsonRPCProtocol._
|
||||
val msg =
|
||||
s"unmatched json error for requestId $execId: ${CompactPrinter(Converter.toJsonUnsafe(err))}"
|
||||
log.debug(msg)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -402,7 +406,6 @@ final class NetworkChannel(
|
|||
|
||||
protected def onSettingQuery(execId: Option[String], req: SettingQuery) = {
|
||||
if (initialized) {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
StandardMain.exchange.withState { s =>
|
||||
val structure = Project.extract(s).structure
|
||||
sbt.internal.server.SettingQuery.handleSettingQueryEither(req, structure) match {
|
||||
|
|
@ -420,7 +423,6 @@ final class NetworkChannel(
|
|||
if (initialized) {
|
||||
try {
|
||||
StandardMain.exchange.withState { sstate =>
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
def completionItems(s: State) = {
|
||||
Parser
|
||||
.completions(s.combinedParser, cp.query, cp.level.getOrElse(9))
|
||||
|
|
@ -515,7 +517,6 @@ final class NetworkChannel(
|
|||
StandardMain.exchange.currentExec.exists(_.source.exists(_.channelName == name)))) {
|
||||
runningEngine.cancelAndShutdown()
|
||||
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
respondResult(
|
||||
ExecStatusEvent(
|
||||
"Task cancelled",
|
||||
|
|
@ -806,7 +807,6 @@ final class NetworkChannel(
|
|||
): Option[T] = {
|
||||
if (closed.get) None
|
||||
else {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val queue = VirtualTerminal.sendTerminalCapabilitiesQuery(name, jsonRpcRequest, query)
|
||||
Some(result(queue.take))
|
||||
}
|
||||
|
|
@ -833,7 +833,6 @@ final class NetworkChannel(
|
|||
override private[sbt] def getAttributes: Map[String, String] =
|
||||
if (closed.get) Map.empty
|
||||
else {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val queue = VirtualTerminal.sendTerminalAttributesQuery(
|
||||
name,
|
||||
jsonRpcRequest
|
||||
|
|
@ -851,7 +850,6 @@ final class NetworkChannel(
|
|||
}
|
||||
override private[sbt] def setAttributes(attributes: Map[String, String]): Unit =
|
||||
if (!closed.get) {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val attrs = TerminalSetAttributesCommand(
|
||||
iflag = attributes.getOrElse("iflag", ""),
|
||||
oflag = attributes.getOrElse("oflag", ""),
|
||||
|
|
@ -865,7 +863,6 @@ final class NetworkChannel(
|
|||
}
|
||||
override private[sbt] def getSizeImpl: (Int, Int) =
|
||||
if (!closed.get) {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val queue = VirtualTerminal.getTerminalSize(name, jsonRpcRequest)
|
||||
val res = try queue.take
|
||||
catch { case _: InterruptedException => TerminalGetSizeResponse(1, 1) }
|
||||
|
|
@ -873,7 +870,6 @@ final class NetworkChannel(
|
|||
} else (1, 1)
|
||||
override def setSize(width: Int, height: Int): Unit =
|
||||
if (!closed.get) {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val size = TerminalSetSizeCommand(width, height)
|
||||
val queue = VirtualTerminal.setTerminalSize(name, jsonRpcRequest, size)
|
||||
try queue.take
|
||||
|
|
@ -881,7 +877,6 @@ final class NetworkChannel(
|
|||
}
|
||||
private[this] def setRawMode(toggle: Boolean): Unit = {
|
||||
if (!closed.get || false) {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val raw = TerminalSetRawModeCommand(toggle)
|
||||
val queue = VirtualTerminal.setTerminalRawMode(name, jsonRpcRequest, raw)
|
||||
try queue.take
|
||||
|
|
@ -892,7 +887,6 @@ final class NetworkChannel(
|
|||
override private[sbt] def exitRawMode(): Unit = setRawMode(false)
|
||||
override def setEchoEnabled(toggle: Boolean): Unit =
|
||||
if (!closed.get) {
|
||||
import sbt.protocol.codec.JsonProtocol._
|
||||
val echo = TerminalSetEchoCommand(toggle)
|
||||
val queue = VirtualTerminal.setTerminalEcho(name, jsonRpcRequest, echo)
|
||||
try queue.take
|
||||
|
|
|
|||
Loading…
Reference in New Issue