@@ -241,22 +241,21 @@ runGhcSession
241241 -> Ghc a
242242 -> IO a
243243runGhcSession IdeOptions{..} modu env act = runGhcEnv env $ do
244− modifyDynFlags $ \x -> x{importPaths = maybe [] moduleImportPaths modu ++ importPaths x}
244+ modifyDynFlags $ \x -> x
245+ {importPaths = nubOrd $ maybeToList (moduleImportPaths =<< modu) ++ importPaths x}
245246 act
246247
247248
248−moduleImportPaths :: GHC.ParsedModule -> [FilePath]
249−moduleImportPaths pm =
250− maybe [] (\modRoot -> [modRoot]) mbModuleRoot
249+moduleImportPaths :: GHC.ParsedModule -> Maybe FilePath
250+moduleImportPaths pm
251+ | rootModDir == "." = Just rootPathDir
252+ | otherwise = dropTrailingPathSeparator <$> stripSuffix rootModDir rootPathDir
251253 where
252254 ms = GHC.pm_mod_summary pm
253255 file = GHC.ms_hspp_file ms
254256 mod' = GHC.ms_mod ms
255257 rootPathDir = takeDirectory file
256258 rootModDir = takeDirectory . moduleNameSlashes . GHC.moduleName $ mod'
257− mbModuleRoot
258− | rootModDir == "." = Just rootPathDir
259− | otherwise = dropTrailingPathSeparator <$> stripSuffix rootModDir rootPathDir
260259
261260
262261-- When we make a fresh GHC environment, the OrigNameCache comes already partially