@@ -397,6 +397,31 @@ ihPrintResult h s = do i <- getIState
397397 let good = SexpList [SymbolAtom "ok", toSExp s] in
398398 runIO $ hPutStrLn h $ convSExp "return" good n
399399
400+ihPrintTermWithType :: Handle -> Doc OutputAnnotation -> Doc OutputAnnotation -> Idris ()
401+ihPrintTermWithType h tm ty = do ist <- getIState
402+ let output = tm <+> colon <+> ty
403+ case idris_outputmode ist of
404+ RawOutput -> runIO .
405+ hPutStrLn h .
406+ displayDecorated (consoleDecorate ist) .
407+ renderCompact $ output
408+ IdeSlave n -> let (str, spans) = displaySpans (fmap (fancifyAnnots ist) (renderCompact output))
409+ good = [SymbolAtom "ok", toSExp str, toSExp spans]
410+ in runIO . hPutStrLn h $ convSExp "return" good n
411+
412+fancifyAnnots :: IState -> OutputAnnotation -> OutputAnnotation
413+fancifyAnnots ist annot@(AnnName n _ _) =
414+ do let ctxt = tt_ctxt ist
415+ case () of
416+ _ | isDConName n ctxt -> AnnName n (Just DataOutput) Nothing
417+ _ | isFnName n ctxt -> AnnName n (Just FunOutput) Nothing
418+ _ | isTConName n ctxt -> AnnName n (Just TypeOutput) Nothing
419+ _ | otherwise -> annot
420+fancifyAnnots _ annot = annot
421+
422+type1Doc :: Doc OutputAnnotation
423+type1Doc = (annotate AnnConstType $ text "Type 1")
424+
400425ihPrintError :: Handle -> String -> Idris ()
401426ihPrintError h s = do i <- getIState
402427 case idris_outputmode i of
@@ -429,7 +454,8 @@ iputGoal :: SimpleDoc OutputAnnotation -> Idris ()
429454iputGoal g = do i <- getIState
430455 case idris_outputmode i of
431456 RawOutput -> runIO $ putStrLn (displayDecorated (consoleDecorate i) g)
432− IdeSlave n -> runIO . putStrLn $ convSExp "write-goal" (displayS g "") n
457+ IdeSlave n -> runIO . putStrLn $
458+ convSExp "write-goal" (displayS (fmap (fancifyAnnots i) g) "") n
433459
434460isetPrompt :: String -> Idris ()
435461isetPrompt p = do i <- getIState