diff --git a/Language/Haskell/GhcMod/Gap.hs b/Language/Haskell/GhcMod/Gap.hs index c565d09..c1d62a5 100644 --- a/Language/Haskell/GhcMod/Gap.hs +++ b/Language/Haskell/GhcMod/Gap.hs @@ -184,9 +184,10 @@ fOptions = [option | (option,_,_) <- fFlags] ---------------------------------------------------------------- ---------------------------------------------------------------- -setCtx :: FilePath -> [ModSummary] -> Ghc ModSummary +setCtx :: FilePath -> Ghc ModSummary #if __GLASGOW_HASKELL__ >= 704 -setCtx file mss = do +setCtx file = do + mss <- getModuleGraph #if __GLASGOW_HASKELL__ >= 706 let modName = IIModule . moduleName . ms_mod #else @@ -197,7 +198,8 @@ setCtx file mss = do let [ms] = filter (\m -> ml_hs_file (ms_location m) == Just file) mss return ms #else -setCtx file mss = do +setCtx file = do + mss <- getModuleGraph top <- map ms_mod <$> filterM isTop mss setContext top [] let [ms] = filter (\m -> ml_hs_file (ms_location m) == Just file) mss diff --git a/Language/Haskell/GhcMod/Info.hs b/Language/Haskell/GhcMod/Info.hs index 7bb4afa..1db6aad 100644 --- a/Language/Haskell/GhcMod/Info.hs +++ b/Language/Haskell/GhcMod/Info.hs @@ -140,6 +140,6 @@ inModuleContext opt cradle file action errmsg = ghandle handler $ do void $ initializeFlagsWithCradle opt cradle noWaringOptions False setTargetFiles [file] void $ G.load LoadAllTargets - G.depanal [] False >>= Gap.setCtx file >>= action + Gap.setCtx file >>= action where handler (SomeException _) = return errmsg