@@ -132,8 +132,13 @@ instance SExpable OutputAnnotation where
132132 BoldText -> "bold"
133133 ItalicText -> "italic"
134134 UnderlineText -> "underline"
135− toSExp (AnnTerm tm) = toSExp [(SymbolAtom "tt-term", StringAtom encoded)]
136− where encoded = (UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode) tm
135+ toSExp (AnnTerm tm) = toSExp [(SymbolAtom "tt-term", StringAtom (encodeTerm tm))]
136+
137+encodeTerm :: Term -> String
138+encodeTerm = UTF8.toString . Base64.encode . Lazy.toStrict . Binary.encode
139+
140+decodeTerm :: String -> Term
141+decodeTerm = Binary.decode . Lazy.fromStrict . Base64.decodeLenient . UTF8.fromString
137142
138143instance SExpable FC where
139144 toSExp (FC f (sl, sc) (el, ec)) =
@@ -191,6 +196,9 @@ data IdeSlaveCommand = REPLCompletions String
191196 | Metavariables Int -- ^^ the Int is the column count for pretty-printing
192197 | WhoCalls String
193198 | CallsWho String
199+ | TermNormalise Term
200+ | TermShowImplicits Term
201+ | TermNoImplicits Term
194202
195203sexpToCommand :: SExp -> Maybe IdeSlaveCommand
196204sexpToCommand (SexpList (x:[])) = sexpToCommand x
@@ -227,6 +235,9 @@ sexpToCommand (SexpList [SymbolAtom "set-option", SymbolAtom s, BoolAtom b])
227235sexpToCommand (SexpList [SymbolAtom "metavariables", IntegerAtom cols]) = Just (Metavariables (fromIntegral cols))
228236sexpToCommand (SexpList [SymbolAtom "who-calls", StringAtom name]) = Just (WhoCalls name)
229237sexpToCommand (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))
230241sexpToCommand _ = Nothing
231242
232243parseMessage :: String -> Either Err (SExp, Integer)