Open
Description
When a save a file, recompilation is triggered for all the files which depend on the file I saved.
I tracked down the bug to the fact that
- Interfaces are created with
-haddock
option set. - Recompilation checking is run in a context where
-haddock
is not set.
This seems to be complicated with all the logic with turning -haddock on in some situations and not in others.
The following diff "fixes" the immediate problem for me, but I don't know if there are some situations where interfaces are created without -haddock
being enabled.
--- a/ghcide/src/Development/IDE/Core/Compile.hs
+++ b/ghcide/src/Development/IDE/Core/Compile.hs
@@ -1275,7 +1275,7 @@ loadInterface
-> RecompilationInfo m
-> m ([FileDiagnostic], Maybe HiFileResult)
loadInterface session ms linkableNeeded RecompilationInfo{..} = do
- let sessionWithMsDynFlags = hscSetFlags (ms_hspp_opts ms) session
+ let sessionWithMsDynFlags = hscSetFlags (gopt_set (ms_hspp_opts ms) Opt_Haddock) session
mb_old_iface = hirModIface . fst <$> old_value
mb_old_version = snd <$> old_value
It would be simpler if the options chosen to compile a file were fixed at the start of compilation and not modified in ad-hoc places later on.
In my opinion this is a serious bug.