Format LSP methods

This commit is contained in:
Dale Wijnand 2018-03-09 12:02:45 +00:00
parent de690f4e41
commit 268b5111ab
No known key found for this signature in database
GPG Key ID: 4F256E3D151DF5EF
1 changed files with 11 additions and 7 deletions

View File

@ -143,9 +143,11 @@ private[sbt] trait LanguageServerProtocol extends CommandChannel { self =>
}
/** Respond back to Language Server's client. */
private[sbt] def jsonRpcRespondError(execId: Option[String],
code: Long,
message: String): Unit = {
private[sbt] def jsonRpcRespondError(
execId: Option[String],
code: Long,
message: String,
): Unit = {
val e = JsonRpcResponseError(code, message, None)
val m = JsonRpcResponseMessage("2.0", execId, None, Option(e))
val bytes = Serialization.serializeResponseMessage(m)
@ -153,10 +155,12 @@ private[sbt] trait LanguageServerProtocol extends CommandChannel { self =>
}
/** Respond back to Language Server's client. */
private[sbt] def jsonRpcRespondError[A: JsonFormat](execId: Option[String],
code: Long,
message: String,
data: A): Unit = {
private[sbt] def jsonRpcRespondError[A: JsonFormat](
execId: Option[String],
code: Long,
message: String,
data: A,
): Unit = {
val e = JsonRpcResponseError(code, message, Option(Converter.toJson[A](data).get))
val m = JsonRpcResponseMessage("2.0", execId, None, Option(e))
val bytes = Serialization.serializeResponseMessage(m)