@@ -397,6 +397,31 @@ ihPrintResult h s = do i <- getIState
397 let good = SexpList [SymbolAtom "ok", toSExp s] in
397 let good = SexpList [SymbolAtom "ok", toSExp s] in
398 runIO $ hPutStrLn h $ convSExp "return" good n
398 runIO $ hPutStrLn h $ convSExp "return" good n
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 .
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
412+fancifyAnnots :: IState -> OutputAnnotation -> OutputAnnotation
413+fancifyAnnots ist annot@(AnnName n _ _) =
414+ do let ctxt = tt_ctxt ist
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
422+type1Doc :: Doc OutputAnnotation
423+type1Doc = (annotate AnnConstType $ text "Type 1")
400ihPrintError :: Handle -> String -> Idris ()
425ihPrintError :: Handle -> String -> Idris ()
401ihPrintError h s = do i <- getIState
426ihPrintError h s = do i <- getIState
402 case idris_outputmode i of
427 case idris_outputmode i of
@@ -429,7 +454,8 @@ iputGoal :: SimpleDoc OutputAnnotation -> Idris ()
429iputGoal g = do i <- getIState
454iputGoal g = do i <- getIState
430 case idris_outputmode i of
455 case idris_outputmode i of
431 RawOutput -> runIO $ putStrLn (displayDecorated (consoleDecorate i) g)
456 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
434isetPrompt :: String -> Idris ()
460isetPrompt :: String -> Idris ()
435isetPrompt p = do i <- getIState
461isetPrompt p = do i <- getIState