@@ -14,7 +14,7 @@ import Idris.Parser
14import Idris.Primitives
14import Idris.Primitives
15import Idris.Coverage
15import Idris.Coverage
16import Idris.UnusedArgs
16import Idris.UnusedArgs
17−import Idris.Docs
17+import Idris.Docs hiding (Doc)
18import Idris.Help
18import Idris.Help
19import Idris.Completion
19import Idris.Completion
20import qualified Idris.IdeSlave as IdeSlave
20import qualified Idris.IdeSlave as IdeSlave
@@ -30,6 +30,7 @@ import Version_idris (gitHash)
30import Util.System
30import Util.System
31import Util.DynamicLinker
31import Util.DynamicLinker
32import Util.Net (listenOnLocalhost)
32import Util.Net (listenOnLocalhost)
33+import Util.Pretty hiding ((</>))
34import Idris.Core.Evaluate
35import Idris.Core.Evaluate
35import Idris.Core.Execute (execute)
36import Idris.Core.Execute (execute)
@@ -470,32 +471,35 @@ process h fn (Check (PRef _ n))
470 = do ctxt <- getContext
471 = do ctxt <- getContext
471 ist <- getIState
472 ist <- getIState
472 imp <- impShow
473 imp <- impShow
474 case lookupNames n ctxt of
474 case lookupNames n ctxt of
475 ts@(t:_) ->
475 ts@(t:_) ->
476 case lookup t (idris_metavars ist) of
476 case lookup t (idris_metavars ist) of
477+ Just (_, i, _) -> ihRenderResult h . fmap (fancifyAnnots ist) $
477− Just (_, i, _) -> ihPrintResult h (showMetavarInfo c imp ist n i)
478+ showMetavarInfo imp ist n i
478 Nothing -> ihPrintFunTypes h n (map (\n -> (n, delabTy ist n)) ts)
479 Nothing -> ihPrintFunTypes h n (map (\n -> (n, delabTy ist n)) ts)
479 [] -> ihPrintError h $ "No such variable " ++ show n
480 [] -> ihPrintError h $ "No such variable " ++ show n
481− showMetavarInfo c imp ist n i
482+ showMetavarInfo imp ist n i
482 = case lookupTy n (tt_ctxt ist) of
483 = case lookupTy n (tt_ctxt ist) of
483− (ty:_) -> putTy c imp ist i (delab ist ty)
484+ (ty:_) -> putTy imp ist i [] (delab ist ty)
485+ putTy :: Bool -> IState -> Int -> [(Name, Bool)] -> PTerm -> Doc OutputAnnotation
484− putTy c imp ist 0 sc = putGoal c imp ist sc
486+ putTy imp ist 0 bnd sc = putGoal imp ist bnd sc
485− putTy c imp ist i (PPi _ n t sc)
487+ putTy imp ist i bnd (PPi _ n t sc)
486− = let current = " " ++
488+ = let current = text " " <>
487 (case n of
489 (case n of
488− MN _ _ -> "_"
490+ MN _ _ -> text "_"
489− UN nm | ('_':'_':_) <- str nm -> "_"
491+ UN nm | ('_':'_':_) <- str nm -> text "_"
490− _ -> showName (Just ist) [] False c n) ++
492+ _ -> bindingOf n False) <+>
491− " : " ++ showTm ist t ++ "\n"
493+ colon <+> align (tPretty bnd ist t) <> line
493− current ++ putTy c imp ist (i-1) sc
495+ current <> putTy imp ist (i-1) ((n,False):bnd) sc
494− putTy c imp ist _ sc = putGoal c imp ist sc
496+ putTy imp ist _ bnd sc = putGoal imp ist ((n,False):bnd) sc
495− putGoal c imp ist g
497+ putGoal imp ist bnd g
496− = "--------------------------------------\n" ++
498+ = text "--------------------------------------" <$>
497− showName (Just ist) [] False c n ++ " : " ++
499+ annotate (AnnName n Nothing Nothing) (text $ show n) <+> colon <+>
498− showTm ist g
500+ align (tPretty bnd ist g)
502+ tPretty bnd ist t = pprintPTerm (opt_showimp (idris_options ist)) bnd t
501process h fn (Check t)
505process h fn (Check t)