@@ -579,6 +579,19 @@ fancifyAnnots _ annot = annot
579579type1Doc :: Doc OutputAnnotation
580580type1Doc = (annotate AnnConstType $ text "Type 1")
581581
582+-- | Show an error with semantic highlighting
583+ihRenderError :: Handle -> Doc OutputAnnotation -> Idris ()
584+ihRenderError h e = do ist <- getIState
585+ case idris_outputmode ist of
586+ RawOutput -> consoleDisplayAnnotated h e
587+ IdeSlave n -> do
588+ (str, spans) <- fmap displaySpans .
589+ iRender .
590+ fmap (fancifyAnnots ist) $
591+ e
592+ let good = [SymbolAtom "error", toSExp str, toSExp spans]
593+ runIO . hPutStrLn h $ convSExp "return" good n
594+
582595ihPrintError :: Handle -> String -> Idris ()
583596ihPrintError h s = do i <- getIState
584597 case idris_outputmode i of