Skip to content

Commit f3eb580

Browse files
committed
absolute file at the beginning
1 parent 98ae446 commit f3eb580

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

ghcide/session-loader/Development/IDE/Session.hs

+8-7
Original file line numberDiff line numberDiff line change
@@ -677,6 +677,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
677677
atomicModifyIORef' error_loading_files (\xs -> (failedLoadingFiles <> xs,()))
678678
-- retry without other files
679679
atomically $ forM_ pendingFiles (writeTQueue pendingFilesTQueue)
680+
logWith recorder Info $ LogSessionReloadOnError cfp (Set.toList pendingFiles)
680681
consultCradle hieYaml cfp
681682
else do
682683
dep_info <- getDependencyInfo (maybeToList hieYaml)
@@ -724,8 +725,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
724725
atomicModifyIORef' cradle_files (\_ -> (Set.empty,()))
725726

726727
v <- Map.findWithDefault HM.empty hieYaml <$> readVar fileToFlags
727-
let cfp = toAbsolutePath file
728-
case HM.lookup (toNormalizedFilePath' cfp) v of
728+
case HM.lookup (toNormalizedFilePath' file) v of
729729
Just (opts, old_di) -> do
730730
deps_ok <- checkDependencyInfo old_di
731731
if not deps_ok
@@ -739,26 +739,27 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
739739
modifyVar_ filesMap (const (return HM.empty))
740740
-- Keep the same name cache
741741
modifyVar_ hscEnvs (return . Map.adjust (const []) hieYaml )
742-
consultCradle hieYaml cfp
742+
consultCradle hieYaml file
743743
else return (opts, Map.keys old_di)
744-
Nothing -> consultCradle hieYaml cfp
744+
Nothing -> consultCradle hieYaml file
745745

746746
-- The main function which gets options for a file. We only want one of these running
747747
-- at a time. Therefore the IORef contains the currently running cradle, if we try
748748
-- to get some more options then we wait for the currently running action to finish
749749
-- before attempting to do so.
750750
let getOptions :: FilePath -> IO (IdeResult HscEnvEq, [FilePath])
751751
getOptions file = do
752-
let ncfp = toNormalizedFilePath' (toAbsolutePath file)
752+
let ncfp = toNormalizedFilePath' file
753753
cachedHieYamlLocation <- HM.lookup ncfp <$> readVar filesMap
754754
hieYaml <- cradleLoc file
755755
sessionOpts (join cachedHieYamlLocation <|> hieYaml, file) `Safe.catch` \e ->
756756
return (([renderPackageSetupException file e], Nothing), maybe [] pure hieYaml)
757757

758758
returnWithVersion $ \file -> do
759-
atomically $ writeTQueue pendingFilesTQueue $ toAbsolutePath file
759+
let absFile = toAbsolutePath file
760+
atomically $ writeTQueue pendingFilesTQueue absFile
760761
-- see Note [Serializing runs in separate thread]
761-
awaitRunInThread que $ getOptions file
762+
awaitRunInThread que $ getOptions absFile
762763

763764
-- | Run the specific cradle on a specific FilePath via hie-bios.
764765
-- This then builds dependencies or whatever based on the cradle, gets the

0 commit comments

Comments
 (0)