Skip to content
This repository was archived by the owner on Oct 7, 2020. It is now read-only.

Haddock source file names may use either dot or dash as separator #1723

Merged
merged 1 commit into from
Apr 8, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src/Haskell/Ide/Engine/Plugin/Haddock.hs
Original file line number Diff line number Diff line change
Expand Up @@ -63,14 +63,15 @@ lookupSrcHtmlForModule =

lookupHtmlForModule :: (FilePath -> FilePath -> FilePath) -> DynFlags -> Module -> IO (Maybe FilePath)
lookupHtmlForModule mkDocPath df m = do
let mfp = go <$> (listToMaybe =<< lookupHtmls df ui)
exists <- maybe (pure False) doesFileExist mfp
return $ if exists then mfp else Nothing
let mfs = go <$> (listToMaybe =<< lookupHtmls df ui)
htmls <- filterM doesFileExist (concat . maybeToList $ mfs)
return $ listToMaybe htmls
where
go pkgDocDir = mkDocPath pkgDocDir mn
-- The file might use "." or "-" as separator
go pkgDocDir = [mkDocPath pkgDocDir mn | mn <- [mndot,mndash]]
ui = moduleUnitId m
mn = map (\x -> if x == '.' then '-' else x) mns
mns = moduleNameString $ moduleName m
mndash = map (\x -> if x == '.' then '-' else x) mndot
mndot = moduleNameString $ moduleName m

nameCacheFromGhcMonad :: GhcMonad m => NameCacheAccessor m
nameCacheFromGhcMonad = ( read_from_session , write_to_session )
Expand Down