Skip to content
This repository has been archived by the owner on Apr 25, 2020. It is now read-only.

Commit

Permalink
Show local URL if available; otherwise hackage.haskell.org.
Browse files Browse the repository at this point in the history
  • Loading branch information
carlohamalainen authored and DanielG committed Aug 27, 2016
1 parent 60dfa8a commit 90667e6
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Language/Haskell/GhcMod/ImportedFrom.hs
Original file line number Diff line number Diff line change
Expand Up @@ -731,14 +731,17 @@ guessHaddockUrl modSum targetFile targetModule symbol lineNr colNr ghcPkg readPr

gmLog GmDebug "guessHaddockUrl" $ strDoc $ "haddock: " ++ show haddock

let f = haddock </> (moduleNameToHtmlFile lastMatchModule)

let mySymbol' = case mySymbol of
MySymbolSysQualified s -> s
MySymbolUserQualified s -> s

return $ mySymbol' ++ " " ++ lastMatchModule ++ " file://" ++ f
++ " " ++ toHackageUrl f lastMatchPackageName lastMatchModule
let f = haddock </> (moduleNameToHtmlFile lastMatchModule)

e <- liftIO $ doesFileExist f

return $
if e then mySymbol' ++ " " ++ lastMatchModule ++ " file://" ++ f
else mySymbol' ++ " " ++ lastMatchModule ++ " " ++ toHackageUrl f lastMatchPackageName lastMatchModule

where
-- Convert a module name string, e.g. @Data.List@ to @Data-List.html@.
Expand Down Expand Up @@ -805,4 +808,5 @@ importedFrom file lineNr colNr (Expression symbol) = do
modSum <- fileModSummaryWithMapping (cradleCurrentDir crdl </> file)
let modstr = moduleNameString $ ms_mod_name modSum :: String

guessHaddockUrl modSum file modstr symbol lineNr colNr ghcPkg readProc pkgDbStack
x <- guessHaddockUrl modSum file modstr symbol lineNr colNr ghcPkg readProc pkgDbStack
return $ x ++ "\n"

0 comments on commit 90667e6

Please sign in to comment.