Skip to content
This repository has been archived by the owner on Jan 2, 2021. It is now read-only.

Canonicalize import dirs #870

Merged
merged 2 commits into from
Oct 15, 2020
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/Development/IDE/GHC/Util.hs
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ import RdrName (nameRdrName, rdrNameOcc)

import Development.IDE.GHC.Compat as GHC
import Development.IDE.Types.Location
import System.Directory (canonicalizePath)


----------------------------------------------------------------------
Expand Down Expand Up @@ -189,9 +190,14 @@ data HscEnvEq = HscEnvEq
newHscEnvEq :: FilePath -> HscEnv -> [(InstalledUnitId, DynFlags)] -> IO HscEnvEq
newHscEnvEq cradlePath hscEnv0 deps = do
envUnique <- newUnique
let envImportPaths = Just $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
relativeToCradle = (takeDirectory cradlePath </>)
let relativeToCradle = (takeDirectory cradlePath </>)
hscEnv = removeImportPaths hscEnv0

-- Canonicalize import paths since we also canonicalize targets
importPathsCanon <-
mapM canonicalizePath $ relativeToCradle <$> importPaths (hsc_dflags hscEnv0)
let envImportPaths = Just importPathsCanon

return HscEnvEq{..}

newHscEnvEqWithImportPaths :: Maybe [String] -> HscEnv -> [(InstalledUnitId, DynFlags)] -> IO HscEnvEq
Expand Down