@@ -14,7 +14,7 @@ import Idris.Parser
1414import Idris.Primitives
1515import Idris.Coverage
1616import Idris.UnusedArgs
17−import Idris.Docs
17+import Idris.Docs hiding (Doc)
1818import Idris.Help
1919import Idris.Completion
2020import qualified Idris.IdeSlave as IdeSlave
@@ -30,6 +30,7 @@ import Version_idris (gitHash)
3030import Util.System
3131import Util.DynamicLinker
3232import Util.Net (listenOnLocalhost)
33+import Util.Pretty hiding ((</>))
3334
3435import Idris.Core.Evaluate
3536import Idris.Core.Execute (execute)
@@ -470,32 +471,35 @@ process h fn (Check (PRef _ n))
470471 = do ctxt <- getContext
471472 ist <- getIState
472473 imp <- impShow
473− c <- colourise
474474 case lookupNames n ctxt of
475475 ts@(t:_) ->
476476 case lookup t (idris_metavars ist) of
477− Just (_, i, _) -> ihPrintResult h (showMetavarInfo c imp ist n i)
477+ Just (_, i, _) -> ihRenderResult h . fmap (fancifyAnnots ist) $
478+ showMetavarInfo imp ist n i
478479 Nothing -> ihPrintFunTypes h n (map (\n -> (n, delabTy ist n)) ts)
479480 [] -> ihPrintError h $ "No such variable " ++ show n
480481 where
481− showMetavarInfo c imp ist n i
482+ showMetavarInfo imp ist n i
482483 = case lookupTy n (tt_ctxt ist) of
483− (ty:_) -> putTy c imp ist i (delab ist ty)
484− putTy c imp ist 0 sc = putGoal c imp ist sc
485− putTy c imp ist i (PPi _ n t sc)
486− = let current = " " ++
484+ (ty:_) -> putTy imp ist i [] (delab ist ty)
485+ putTy :: Bool -> IState -> Int -> [(Name, Bool)] -> PTerm -> Doc OutputAnnotation
486+ putTy imp ist 0 bnd sc = putGoal imp ist bnd sc
487+ putTy imp ist i bnd (PPi _ n t sc)
488+ = let current = text " " <>
487489 (case n of
488− MN _ _ -> "_"
489− UN nm | ('_':'_':_) <- str nm -> "_"
490− _ -> showName (Just ist) [] False c n) ++
491− " : " ++ showTm ist t ++ "\n"
490+ MN _ _ -> text "_"
491+ UN nm | ('_':'_':_) <- str nm -> text "_"
492+ _ -> bindingOf n False) <+>
493+ colon <+> align (tPretty bnd ist t) <> line
492494 in
493− current ++ putTy c imp ist (i-1) sc
494− putTy c imp ist _ sc = putGoal c imp ist sc
495− putGoal c imp ist g
496− = "--------------------------------------\n" ++
497− showName (Just ist) [] False c n ++ " : " ++
498− showTm ist g
495+ current <> putTy imp ist (i-1) ((n,False):bnd) sc
496+ putTy imp ist _ bnd sc = putGoal imp ist ((n,False):bnd) sc
497+ putGoal imp ist bnd g
498+ = text "--------------------------------------" <$>
499+ annotate (AnnName n Nothing Nothing) (text $ show n) <+> colon <+>
500+ align (tPretty bnd ist g)
501+
502+ tPretty bnd ist t = pprintPTerm (opt_showimp (idris_options ist)) bnd t
499503
500504
501505process h fn (Check t)