@@ -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
@@ -619,11 +632,17 @@ isetPrompt p = do i <- getIState
619632 case idris_outputmode i of
620633 IdeSlave n -> runIO . putStrLn $ convSExp "set-prompt" p n
621634
622−ihWarn :: Handle -> FC -> String -> Idris ()
635+ihWarn :: Handle -> FC -> Doc OutputAnnotation -> Idris ()
623636ihWarn h fc err = do i <- getIState
637+ err' <- iRender . fmap (fancifyAnnots i) $ err
624638 case idris_outputmode i of
625− RawOutput -> runIO $ hPutStrLn h (show fc ++ ":" ++ err)
626− IdeSlave n -> runIO $ hPutStrLn h $ convSExp "warning" (fc_fname fc, fc_line fc, fc_column fc, err) n
639+ RawOutput ->
640+ runIO $
641+ hPutStrLn h (show fc ++ ":" ++ displayDecorated (consoleDecorate i) err')
642+ IdeSlave n ->
643+ do let (str, spans) = displaySpans err'
644+ runIO . hPutStrLn h $
645+ convSExp "warning" (fc_fname fc, fc_line fc, fc_column fc, str, spans) n
627646
628647setLogLevel :: Int -> Idris ()
629648setLogLevel l = do i <- getIState