From 64379a7c56f4e1d6efa44439ec9be8e644b43faa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Daniel=20Gr=C3=B6ber?= Date: Fri, 11 Sep 2015 09:53:24 +0200 Subject: [PATCH] Actually update `world` in legacyInteractiveLoop --- Language/Haskell/GhcMod/Target.hs | 9 +++++++-- src/GHCMod.hs | 7 ++++++- 2 files changed, 13 insertions(+), 3 deletions(-) diff --git a/Language/Haskell/GhcMod/Target.hs b/Language/Haskell/GhcMod/Target.hs index 3906b0a..79ccaef 100644 --- a/Language/Haskell/GhcMod/Target.hs +++ b/Language/Haskell/GhcMod/Target.hs @@ -69,8 +69,13 @@ initSession :: IOish m initSession opts mdf = do s <- gmsGet case gmGhcSession s of - Just GmGhcSession {..} -> when (gmgsOptions /= opts) $ putNewSession s - Nothing -> putNewSession s + Just GmGhcSession {..} | gmgsOptions /= opts-> do + gmLog GmDebug "initSession" $ text "Flags changed, creating new session" + putNewSession s + Just _ -> return () + Nothing -> do + gmLog GmDebug "initSession" $ text "Session not initialized, creating new one" + putNewSession s where putNewSession s = do diff --git a/src/GHCMod.hs b/src/GHCMod.hs index ce8b75b..a1a8ea3 100644 --- a/src/GHCMod.hs +++ b/src/GHCMod.hs @@ -462,6 +462,11 @@ legacyInteractiveLoop symdbreq world = do -- after blocking, we need to see if the world has changed. changed <- didWorldChange world + + world' <- if changed + then getCurrentWorld -- TODO: gah, we're hitting the fs twice + else return world + when changed $ do dropSession @@ -500,7 +505,7 @@ legacyInteractiveLoop symdbreq world = do _ -> fatalError $ "unknown command: `" ++ cmd ++ "'" gmPutStr res >> gmPutStrLn "OK" >> liftIO (hFlush stdout) - legacyInteractiveLoop symdbreq world + legacyInteractiveLoop symdbreq world' where interactiveHandlers = [ GHandler $ \e@(FatalError _) -> throw e