on master help sign in
clarify failing searches
5f0dbd7JP Smith
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
@@ -1232,10 +1232,11 @@ process fn (Apropos pkgs a) =
1232 delabTy ist n,
1232 delabTy ist n,
1233 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
1233 fmap (overview . fst) (lookupCtxtExact n (idris_docstrings ist)))
1234 | n <- sort names, isUN n ]
1234 | n <- sort names, isUN n ]
1235+ if (not (null mods)) || (not (null aproposInfo))
1235− iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1236+ then iRenderResult $ vsep (map (\(m, d) -> text "Module" <+> text m <$>
1236− ppD ist d <> line) mods) <$>
1237+ ppD ist d <> line) mods) <$>
1237− vsep (map (prettyDocumentedIst ist) aproposInfo)
1238+ vsep (map (prettyDocumentedIst ist) aproposInfo)
1238− putIState orig
1239+ else iRenderError $ text "No results found"
1239 where isUN (UN _) = True
1240 where isUN (UN _) = True
1240 isUN (NS n _) = isUN n
1241 isUN (NS n _) = isUN n
1241 isUN _ = False
1242 isUN _ = False
src/Idris/TypeSearch.hs+7−3
@@ -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)
@@ -55,9 +55,13 @@ searchByType pkgs pterm = do
55 displayScore theScore <> char ' ' <> prettyDocumentedIst i docInfo
55 displayScore theScore <> char ' ' <> prettyDocumentedIst i docInfo
56 | (n, theScore) <- names']
56 | (n, theScore) <- names']
57 case idris_outputmode i of
57 case idris_outputmode i of
58+ RawOutput _ -> do if (not (null docs))
58− RawOutput _ -> do mapM_ iRenderOutput docs
59+ then mapM_ iRenderOutput docs
60+ else iRenderError $ text "No results found"
59 iPrintResult ""
61 iPrintResult ""
62+ IdeMode _ _ -> if (not (null docs))
60− IdeMode _ _ -> iRenderResult (vsep docs)
63+ then iRenderResult (vsep docs)
64+ else iRenderError $ text "No results found"
61 putIState i -- don't actually make any changes
65 putIState i -- don't actually make any changes
62 where
66 where
63 numLimit = 50
67 numLimit = 50