Fixed nested serialization on the parser service request format. (#558)

This commit is contained in:
Michał Wawrzyniec Urbańczyk 2020-02-26 14:32:05 +01:00 committed by GitHub
parent 016602972f
commit 75127d07b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 6 deletions

View File

@ -1,6 +1,5 @@
package org.enso
import io.circe.parser.decode
import org.enso.flexer.Reader
import org.enso.parserservice.Protocol
import org.enso.parserservice.Server
@ -41,10 +40,7 @@ case class ParserService() extends Server with Protocol {
def handleRequest(request: Request): Response = {
request match {
case ParseRequest(program, idsJson) =>
val ids = Parser.idMapFromJson(idsJson).getOrElse {
throw new Exception("Could not decode IDMap from json.")
}
case ParseRequest(program, ids) =>
val ast = runParser(program, ids)
val json = serializeAst(ast)
Protocol.Success(json)

View File

@ -3,6 +3,7 @@ package org.enso.parserservice
import io.circe.parser._
import io.circe.generic.auto._
import io.circe.syntax._
import org.enso.syntax.text.Parser
/** Types implementing parser server protocol.
*
@ -10,7 +11,8 @@ import io.circe.syntax._
*/
object Protocol {
sealed trait Request
final case class ParseRequest(program: String, ids: String) extends Request
final case class ParseRequest(program: String, ids: Parser.IDMap)
extends Request
sealed trait Response
final case class Success(ast_json: String) extends Response