Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

All dependent files are recompiled on a save #4511

Open
mpickering opened this issue Mar 4, 2025 · 0 comments
Open

All dependent files are recompiled on a save #4511

mpickering opened this issue Mar 4, 2025 · 0 comments
Assignees
Labels
component: ghcide priority: high High priority item type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..

Comments

@mpickering
Copy link
Contributor

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

  1. Interfaces are created with -haddock option set.
  2. 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.

@mpickering mpickering added status: needs triage type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc.. labels Mar 4, 2025
@fendor fendor self-assigned this Mar 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: ghcide priority: high High priority item type: bug Something isn't right: doesn't work as intended, documentation is missing/outdated, etc..
Projects
None yet
Development

No branches or pull requests

2 participants