on master help sign in
Merge pull request #2104 from japesinator/nothing-found
1e719ceDavid Christiansen
CONTRIBUTORS+1
@@ -32,6 +32,7 @@ Adam Sandberg Eriksson
32Seo Sanghyeon
32Seo Sanghyeon
33Benjamin Saunders
33Benjamin Saunders
34Alexander Shabalin
34Alexander Shabalin
35+JP Smith
35startling
36startling
36Chetan T
37Chetan T
37Matúš Tejiščák
38Matúš Tejiščák
src/Idris/REPL.hs+5−4
@@ -1229,10 +1229,11 @@ process fn (Apropos pkgs a) =
1229 delabTy ist n,
1229 delabTy ist n,
1230 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
1230 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
1231 | n <- sort names, isUN n ]
1231 | n <- sort names, isUN n ]
1232+ if (not (null mods)) || (not (null aproposInfo))
1232− iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1233+ then iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1233− ppD ist d <> line) mods) <$>
1234+ ppD ist d <> line) mods) <$>
1234− vsep (map (prettyDocumentedIst ist) aproposInfo)
1235+ vsep (map (prettyDocumentedIst ist) aproposInfo)
1235− putIState orig
1236+ else iRenderError $ text "No results found"
1236 where isUN (UN _) = True
1237 where isUN (UN _) = True
1237 isUN (NS n _) = isUN n
1238 isUN (NS n _) = isUN n
1238 isUN _ = False
1239 isUN _ = False
src/Idris/TypeSearch.hs+7−5
@@ -30,7 +30,7 @@ import Idris.Core.Unify (match_unify)
30import Idris.Delaborate (delabTy)
30import Idris.Delaborate (delabTy)
31import Idris.Docstrings (noDocs, overview)
31import Idris.Docstrings (noDocs, overview)
32import Idris.Elab.Type (elabType)
32import Idris.Elab.Type (elabType)
33−import Idris.Output (iputStrLn, iRenderOutput, iPrintResult, iRenderResult, prettyDocumentedIst)
33+import Idris.Output (iputStrLn, iRenderOutput, iPrintResult, iRenderError, iRenderResult, prettyDocumentedIst)
34import Idris.IBC
34import Idris.IBC
35
35
36import Prelude hiding (pred)
36import Prelude hiding (pred)
@@ -54,10 +54,12 @@ searchByType pkgs pterm = do
54 [ let docInfo = (n, delabTy i n, fmap (overview . fst) (lookupCtxtExact n (idris_docstrings i))) in
54 [ let docInfo = (n, delabTy i n, fmap (overview . fst) (lookupCtxtExact n (idris_docstrings i))) in
55 displayScore theScore <> char ' ' <> prettyDocumentedIst i docInfo
55 displayScore theScore <> char ' ' <> prettyDocumentedIst i docInfo
56 | (n, theScore) <- names']
56 | (n, theScore) <- names']
57+ if (not (null docs))
57− case idris_outputmode i of
58+ then case idris_outputmode i of
58− RawOutput _ -> do mapM_ iRenderOutput docs
59+ RawOutput _ -> do mapM_ iRenderOutput docs
59− iPrintResult ""
60+ iPrintResult ""
60− IdeMode _ _ -> iRenderResult (vsep docs)
61+ IdeMode _ _ -> iRenderResult (vsep docs)
62+ else iRenderError $ text "No results found"
61 putIState i -- don't actually make any changes
63 putIState i -- don't actually make any changes
62 where
64 where
63 numLimit = 50
65 numLimit = 50