@@ -30,14 +30,14 @@ private[sbt] trait LanguageServerProtocol extends CommandChannel {
30
30
import sbt .internal .langserver .codec .JsonProtocol ._
31
31
import internalJsonProtocol ._
32
32
33
+ def json =
34
+ request.params.getOrElse(
35
+ throw LangServerError (ErrorCodes .InvalidParams ,
36
+ s " param is expected on ' ${request.method}' method. " ))
33
37
log.debug(s " onRequestMessage: $request" )
34
38
request.method match {
35
39
case " initialize" =>
36
40
if (authOptions(ServerAuthentication .Token )) {
37
- val json =
38
- request.params.getOrElse(
39
- throw LangServerError (ErrorCodes .InvalidParams ,
40
- " param is expected on 'initialize' method." ))
41
41
val param = Converter .fromJson[InitializeParams ](json).get
42
42
val optionJson = param.initializationOptions.getOrElse(
43
43
throw LangServerError (ErrorCodes .InvalidParams ,
@@ -51,6 +51,9 @@ private[sbt] trait LanguageServerProtocol extends CommandChannel {
51
51
langRespond(InitializeResult (serverCapabilities), Option (request.id))
52
52
case " textDocument/didSave" =>
53
53
append(Exec (" compile" , Some (request.id), Some (CommandSource (name))))
54
+ case " sbt/exec" =>
55
+ val param = Converter .fromJson[SbtExecParams ](json).get
56
+ append(Exec (param.commandLine, Some (request.id), Some (CommandSource (name))))
54
57
case _ => ()
55
58
}
56
59
}
0 commit comments