Skip to content

Commit 3b31665

Browse files
committed
Revert back to GhcSession rule
Depending on GhcSessionDeps means we do not need to reload all the module dependencies in the GHC session. On the other hand, with the GhcSession dependency we *do* have to reload them (from interface files, hopefully) Unfortunately, the ModSummary objects that GhcSessionDeps puts in the GHC session are not suitable for reuse since they clear out the timestamps to avoid internal bugs. This can probably be relaxed so that plugins like Eval can reuse them.
1 parent c17d331 commit 3b31665

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Ide/Plugin/Eval.hs

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ import qualified Data.Text as T
3636
import Data.Time (getCurrentTime)
3737
import Development.IDE.Core.Rules (runAction)
3838
import Development.IDE.Core.RuleTypes (GetModSummary (..),
39-
GhcSessionDeps (..))
39+
GhcSession (..))
4040
import Development.IDE.Core.Shake (use_)
4141
import Development.IDE.GHC.Util (evalGhcEnv, hscEnv,
4242
textToStringBuffer)
@@ -169,10 +169,22 @@ runEvalCmd lsp state EvalParams {..} = response' $ do
169169
contents <- liftIO $ getVirtualFileFunc lsp $ toNormalizedUri _uri
170170
text <- handleMaybe "contents" $ virtualFileText <$> contents
171171

172+
{- Note: GhcSessionDeps
173+
174+
Depending on GhcSession means we do need to reload all the module
175+
dependencies in the GHC session(from interface files, hopefully).
176+
177+
The GhcSessionDeps dependency would allow us to reuse a GHC session preloaded
178+
with all the dependencies. Unfortunately, the ModSummary objects that
179+
GhcSessionDeps puts in the GHC session are not suitable for reuse since they
180+
clear out the timestamps; this is done to avoid internal ghcide bugs and
181+
can probably be relaxed so that plugins like Eval can reuse them. Once that's
182+
done, we want to switch back to GhcSessionDeps
183+
-}
172184
session <-
173185
liftIO $
174186
runAction "runEvalCmd.ghcSession" state $
175-
use_ GhcSessionDeps $
187+
use_ GhcSession $ -- See the note on GhcSessionDeps
176188
toNormalizedFilePath' $
177189
fp
178190

0 commit comments

Comments
 (0)