@@ -132,8 +132,13 @@ instance SExpable OutputAnnotation where
132 BoldText -> "bold"
132 BoldText -> "bold"
133 ItalicText -> "italic"
133 ItalicText -> "italic"
134 UnderlineText -> "underline"
134 UnderlineText -> "underline"
135− toSExp (AnnTerm tm) = toSExp [(SymbolAtom "tt-term", StringAtom encoded)]
135+ toSExp (AnnTerm tm) = toSExp [(SymbolAtom "tt-term", StringAtom (encodeTerm tm))]
137+encodeTerm :: Term -> String
136− where encoded = (UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode) tm
138+encodeTerm = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode
140+decodeTerm :: String -> Term
141+decodeTerm = Binary.decode . Lazy.fromStrict . Base64.decodeLenient . UTF8.fromString
138instance SExpable FC where
143instance SExpable FC where
139 toSExp (FC f (sl, sc) (el, ec)) =
144 toSExp (FC f (sl, sc) (el, ec)) =
@@ -191,6 +196,9 @@ data IdeSlaveCommand = REPLCompletions String
191 | Metavariables Int -- ^^ the Int is the column count for pretty-printing
196 | Metavariables Int -- ^^ the Int is the column count for pretty-printing
192 | WhoCalls String
197 | WhoCalls String
193 | CallsWho String
198 | CallsWho String
199+ | TermNormalise Term
200+ | TermShowImplicits Term
201+ | TermNoImplicits Term
195sexpToCommand :: SExp -> Maybe IdeSlaveCommand
203sexpToCommand :: SExp -> Maybe IdeSlaveCommand
196sexpToCommand (SexpList (x:[])) = sexpToCommand x
204sexpToCommand (SexpList (x:[])) = sexpToCommand x
@@ -227,6 +235,9 @@ sexpToCommand (SexpList [SymbolAtom "set-option", SymbolAtom s, BoolAtom b])
227sexpToCommand (SexpList [SymbolAtom "metavariables", IntegerAtom cols]) = Just (Metavariables (fromIntegral cols))
235sexpToCommand (SexpList [SymbolAtom "metavariables", IntegerAtom cols]) = Just (Metavariables (fromIntegral cols))
228sexpToCommand (SexpList [SymbolAtom "who-calls", StringAtom name]) = Just (WhoCalls name)
236sexpToCommand (SexpList [SymbolAtom "who-calls", StringAtom name]) = Just (WhoCalls name)
229sexpToCommand (SexpList [SymbolAtom "calls-who", StringAtom name]) = Just (CallsWho name)
237sexpToCommand (SexpList [SymbolAtom "calls-who", StringAtom name]) = Just (CallsWho name)
238+sexpToCommand (SexpList [SymbolAtom "normalise-term", StringAtom encoded]) = Just (TermNormalise (decodeTerm encoded))
239+sexpToCommand (SexpList [SymbolAtom "show-term-implicits", StringAtom encoded]) = Just (TermShowImplicits (decodeTerm encoded))
240+sexpToCommand (SexpList [SymbolAtom "hide-term-implicits", StringAtom encoded]) = Just (TermNoImplicits (decodeTerm encoded))
230sexpToCommand _ = Nothing
241sexpToCommand _ = Nothing
232parseMessage :: String -> Either Err (SExp, Integer)
243parseMessage :: String -> Either Err (SExp, Integer)