@@ -60,12 +60,12 @@ instance ExtensionClass HoogleDb where
6060-- | Initialise the Hoogle Database.
6161-- Search for the Hoogle Database and set it in the global config if found.
6262-- Looks first into custom hoogle database locations, then in the default location.
63- -- Note, that the FilePath must be an absolute path, otherwise Hoogle can not
63+ -- Note, that the FilePath must be an absolute path, otherwise Hoogle can not
6464-- find the database.
65- --
65+ --
6666-- If no hoogle database has been found, Nothing is returned
6767-- and we will have no access to the hoogle database.
68- -- However, it is still safe to use the hoogle API,
68+ -- However, it is still safe to use the hoogle API,
6969-- e.g. either error or default values are returned.
7070initializeHoogleDb :: IdeGhcM (Maybe FilePath )
7171initializeHoogleDb = do
@@ -100,9 +100,9 @@ infoCmd' expr = do
100100-- If documentation can be found for it, the result will be rendered
101101-- in markdown for the lsp-client. If multiple results have been found,
102102-- only the first result will be shown.
103- --
104- -- If no result can be found for the identifier, a hoogle error is returned
105- -- that can be shown to the client by converting it
103+ --
104+ -- If no result can be found for the identifier, a hoogle error is returned
105+ -- that can be shown to the client by converting it
106106-- to an IdeError with 'hoogleErrorToIdeError'.
107107infoCmdFancyRender :: T. Text -> IdeM (Either HoogleError T. Text )
108108infoCmdFancyRender expr = do
@@ -116,7 +116,8 @@ infoCmdFancyRender expr = do
116116-- | Render the target in valid markdown.
117117-- Transform haddock documentation into markdown.
118118renderTarget :: Target -> T. Text
119- renderTarget t = T. intercalate " \n\n " $
119+ -- renderTarget t = T.intercalate "\n\n" $
120+ renderTarget t = T. intercalate " \n " $
120121 [" ```haskell\n " <> unHTML (T. pack $ targetItem t) <> " ```" ]
121122 ++ [T. pack $ unwords mdl | not $ null mdl]
122123 ++ [renderDocs $ targetDocs t]
@@ -154,8 +155,8 @@ searchPackages :: T.Text -> IdeM [T.Text]
154155searchPackages = fmap (nub . take 5 ) . searchTargets (fmap (T. pack . fst ) . targetPackage)
155156
156157-- | Search for Targets that fit to the given Text and satisfy the given predicate.
157- -- Limits the amount of matches to at most ten.
158- -- Applies the predicate to the first ten matches. May also return zero matches,
158+ -- Limits the amount of matches to at most ten.
159+ -- Applies the predicate to the first ten matches. May also return zero matches,
159160-- although there are matches, if none of the first ten matches
160161-- satisfies the predicate.
161162--
@@ -192,7 +193,7 @@ lookupCmd' n term = do
192193
193194------------------------------------------------------------------------
194195
195- -- | Run a query for Hoogle on the given Hoogle database.
196+ -- | Run a query for Hoogle on the given Hoogle database.
196197-- If no Database is given, no search is executed.
197198-- If the Database cannot be found at the given location, an IOException will be thrown.
198199-- Note, that the database file must be an absolute path.
@@ -201,15 +202,15 @@ lookupCmd' n term = do
201202-- Found targets can be consumed with the given callback function.
202203-- You can limit the amount of results, by taking only the first ten results.
203204-- Example call:
204- --
205- -- @
206- -- runHoogleQuery
207- -- (Just "/home/user/.hoogle/default-haskell-5.0.17.hoo")
208- -- (Data.Text.pack "take :: Int -> [a] -> [a]")
205+ --
206+ -- @
207+ -- runHoogleQuery
208+ -- (Just "/home/user/.hoogle/default-haskell-5.0.17.hoo")
209+ -- (Data.Text.pack "take :: Int -> [a] -> [a]")
209210-- (Right . Prelude.take 10)
210211-- @
211212-- This limits the results to ten and looks for a function `take` that has the given signature.
212- --
213+ --
213214-- HoogleError's can be translated to IdeErrors with @hoogleErrorToIdeError@
214215-- and shown to the client.
215216runHoogleQuery :: Maybe FilePath -> T. Text -> ([Target ] -> Either HoogleError a ) -> IO (Either HoogleError a )
@@ -219,7 +220,7 @@ runHoogleQuery (Just db) quer f = do
219220 return (f res)
220221
221222
222- -- | Run a query for Hoogle on the given Hoogle database.
223+ -- | Run a query for Hoogle on the given Hoogle database.
223224-- If the database can not be found, an IOException is thrown.
224225-- The target may be of the form: `take`, `take :: Int -> [a] -> [a]`
225226searchHoogle :: FilePath -> T. Text -> IO [Target ]
0 commit comments