mirror of
https://github.com/haskell/haskell-ide-engine.git
synced 2024-08-15 22:10:31 +03:00
Use the LSP provided root directory to find the cradle
When checking for GHC version. This also removes the redundant check in MainHie (I'm not sure why were checking twice). This will remove the check for the JSON transport, but as far as I am aware this is unmantained anyway.
This commit is contained in:
parent
52691a6308
commit
e10545570e
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user