Use the hie-bios function that doesn't perform a downsweep. Fixes #99 (#102)

This commit is contained in:
Neil Mitchell 2019-09-20 16:33:37 +01:00 committed by Moritz Kiefer
parent 06bde2bf3a
commit 50e35f0e98

View File

@ -9,6 +9,7 @@ import Data.Maybe
import Data.List.Extra
import System.FilePath
import Control.Concurrent.Extra
import Control.Exception
import Control.Monad.Extra
import Data.Default
import System.Time.Extra
@ -41,7 +42,6 @@ import GHC hiding (def)
import qualified GHC.Paths
import HIE.Bios
import HIE.Bios.Ghc.Api (initializeFlagsWithCradle)
-- Set the GHC libdir to the nix libdir if it's present.
getLibdir :: IO FilePath
@ -130,9 +130,11 @@ showEvent lock (EventFileDiagnostics (toNormalizedFilePath -> file) diags) =
showEvent lock e = withLock lock $ print e
newSession' :: Cradle -> IO HscEnvEq
newSession' cradle = getLibdir >>= \libdir -> do
newSession' cradle = do
opts <- either throwIO return =<< getCompilerOptions "" cradle
libdir <- getLibdir
env <- runGhc (Just libdir) $ do
initializeFlagsWithCradle "" cradle
_targets <- initSession opts
getSession
initDynLinker env
newHscEnvEq env