diff --git a/app/MainHie.hs b/app/MainHie.hs index 9375f92eb..2af52bfc0 100644 --- a/app/MainHie.hs +++ b/app/MainHie.hs @@ -111,22 +111,13 @@ run opts = do Core.setupLogger mLogFileName ["hie", "hie-bios"] logLevel - d <- getCurrentDirectory - -- Get the cabal directory from the cradle - cradle <- findLocalCradle (d "File.hs") - - projGhcVersion <- getProjectGhcVersion cradle - when (projGhcVersion /= hieGhcVersion) $ - warningm $ "Mismatching GHC versions: Project is " ++ projGhcVersion - ++ ", HIE is " ++ hieGhcVersion - origDir <- getCurrentDirectory maybe (pure ()) setCurrentDirectory $ projectRoot opts progName <- getProgName logm $ "Run entered for HIE(" ++ progName ++ ") " ++ version - logm $ "Current directory:" ++ d + logm $ "Current directory:" ++ origDir args <- getArgs logm $ "args:" ++ show args diff --git a/src/Haskell/Ide/Engine/Transport/LspStdio.hs b/src/Haskell/Ide/Engine/Transport/LspStdio.hs index 926607f68..f74f8c8f4 100644 --- a/src/Haskell/Ide/Engine/Transport/LspStdio.hs +++ b/src/Haskell/Ide/Engine/Transport/LspStdio.hs @@ -420,8 +420,10 @@ reactor inp diagIn = do reactorSend $ NotLogMessage $ fmServerLogMessageNotification J.MtLog $ "Using hie version: " <> T.pack version - d <- liftIO getCurrentDirectory - cradle <- liftIO $ findLocalCradle (d "File.hs") + lspRootDir <- asksLspFuncs Core.rootPath + currentDir <- liftIO getCurrentDirectory + + cradle <- liftIO $ findLocalCradle ((fromMaybe currentDir lspRootDir) "File.hs") -- Check for mismatching GHC versions projGhcVersion <- liftIO $ getProjectGhcVersion cradle when (projGhcVersion /= hieGhcVersion) $ do @@ -437,13 +439,12 @@ reactor inp diagIn = do reactorSend $ NotShowMessage $ fmServerShowMessageNotification J.MtWarning msg reactorSend $ NotLogMessage $ fmServerLogMessageNotification J.MtWarning msg - - lf <- ask + renv <- ask let hreq = GReq tn Nothing Nothing Nothing callback Nothing $ IdeResultOk <$> Hoogle.initializeHoogleDb - callback Nothing = flip runReaderT lf $ + callback Nothing = flip runReaderT renv $ reactorSend $ NotShowMessage $ fmServerShowMessageNotification J.MtWarning "No hoogle db found. Check the README for instructions to generate one" - callback (Just db) = flip runReaderT lf $ do + callback (Just db) = flip runReaderT renv $ do reactorSend $ NotLogMessage $ fmServerLogMessageNotification J.MtLog $ "Using hoogle db at: " <> T.pack db makeRequest hreq