Skip to content

Commit

Permalink
Only load mapped files from the current component
Browse files Browse the repository at this point in the history
  • Loading branch information
wz1000 authored and alanz committed Jun 20, 2018
1 parent 214fe1b commit 66fc098
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
2 changes: 1 addition & 1 deletion GhcMod/Exe/Debug.hs
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ componentInfo ts = do
mdlcs = moduleComponents mcs `zipMap` Set.toList sefnmn
candidates = findCandidates $ map snd mdlcs
cn = pickComponent candidates
(opts,_) <- targetGhcOptions crdl sefnmn
opts <- fst <$> targetGhcOptions crdl sefnmn

return $ unlines $
[ "Matching Components:\n" ++ renderGm (nest 4 $
Expand Down
2 changes: 1 addition & 1 deletion core/GhcMod/Target.hs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,7 @@ runGmlTWith' efnmns' mdf mUpdateHooks wrapper action = do
cfns <- mapM getCanonicalFileNameSafe ccfns
let serfnmn = Set.fromList $ map Right mns ++ map Left cfns
(opts, mappedStrs) <- targetGhcOptions crdl serfnmn

let opts' = opts ++ ["-O0", "-fno-warn-missing-home-modules"] ++ optGhcUserOptions

gmVomit
Expand All @@ -213,7 +214,6 @@ runGmlTWith' efnmns' mdf mUpdateHooks wrapper action = do
initSession opts' $
setHscNothing >>> setLogger >>> mdf

mappedStrs <- getMMappedFilePaths
let targetStrs = mappedStrs ++ map moduleNameString mns ++ cfns

gmVomit
Expand Down
2 changes: 1 addition & 1 deletion core/GhcMod/Utils.hs
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ withMappedFile file action = getCanonicalFileNameSafe file >>= lookupMMappedFile
runWithFile (Just to) = action $ fmPath to
runWithFile _ = action file

getCanonicalFileNameSafe :: (IOish m, GmEnv m) => FilePath -> m FilePath
getCanonicalFileNameSafe :: (IOish m) => FilePath -> m FilePath
getCanonicalFileNameSafe fn = do
let fn' = normalise fn
pl <- liftIO $ rights <$> (mapM ((try :: IO FilePath -> IO (Either SomeException FilePath)) . canonicalizePath . joinPath) $ reverse $ inits $ splitPath' fn')
Expand Down

0 comments on commit 66fc098

Please sign in to comment.