@@ -126,6 +126,7 @@ import GHC.Driver.Config.CoreToStg.Prep
126126#if MIN_VERSION_ghc(9,7,0)
127127import Data.Foldable (toList )
128128import GHC.Unit.Module.Warnings
129+ import Development.IDE.Core.WorkerThread (awaitRunInThread )
129130#else
130131import Development.IDE.Core.FileStore (shareFilePath )
131132#endif
@@ -196,6 +197,7 @@ typecheckModule (IdeDefer defer) hsc tc_helpers pm = do
196197 where
197198 demoteIfDefer = if defer then demoteTypeErrorsToWarnings else id
198199
200+
199201-- | Install hooks to capture the splices as well as the runtime module dependencies
200202captureSplicesAndDeps :: TypecheckHelpers -> HscEnv -> (HscEnv -> IO a ) -> IO (a , Splices , ModuleEnv BS. ByteString )
201203captureSplicesAndDeps TypecheckHelpers {.. } env k = do
@@ -432,6 +434,7 @@ mkHiFileResultCompile se session' tcm simplified_guts = catchErrs $ do
432434 let session = hscSetFlags (ms_hspp_opts ms) session'
433435 ms = pm_mod_summary $ tmrParsed tcm
434436
437+ traceM $ " [TRACE] Generating hi file for " ++ show (moduleName $ ms_mod ms)
435438 (details, guts) <- do
436439 -- write core file
437440 -- give variables unique OccNames
@@ -724,11 +727,13 @@ addRelativeImport fp modu dflags = dflags
724727-- | Also resets the interface store
725728atomicFileWrite :: ShakeExtras -> FilePath -> (FilePath -> IO a ) -> IO a
726729atomicFileWrite se targetPath write = do
730+ -- awaitRunInThread (restartQueue se) $ do
731+ traceM $ " [TRACE] Writing file: " <> targetPath
727732 let dir = takeDirectory targetPath
728733 createDirectoryIfMissing True dir
729734 (tempFilePath, cleanUp) <- newTempFileWithin dir
730735 (write tempFilePath >>= \ x -> renameFile tempFilePath targetPath >> atomically (resetInterfaceStore se (toNormalizedFilePath' targetPath)) >> pure x)
731- `onException` cleanUp
736+ `onException` ( cleanUp >> throwIO ( userError " atomicFileWrite: write failed " ))
732737
733738generateHieAsts :: HscEnv -> TcModuleResult -> IO ([FileDiagnostic ], Maybe (HieASTs Type ))
734739generateHieAsts hscEnv tcm =
0 commit comments