Skip to content

Commit

Permalink
use set for old files
Browse files Browse the repository at this point in the history
  • Loading branch information
soulomoon committed Oct 27, 2024
1 parent 7d38a6d commit fe20770
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion cabal.project
Original file line number Diff line number Diff line change
Expand Up @@ -55,4 +55,4 @@ if impl(ghc >= 9.9)
source-repository-package
type: git
location: https://github.com/soulomoon/hie-bios.git
tag: 9b07c0804e1ef44e7ed64ca1ee2cf5818f8216bf
tag: 45cfe1f4e1bac53e6d6f0cc98c3e8031d85c8e24
6 changes: 3 additions & 3 deletions ghcide/session-loader/Development/IDE/Session.hs
Original file line number Diff line number Diff line change
Expand Up @@ -436,7 +436,7 @@ getHieDbLoc dir = do
loadSessionWithOptions :: Recorder (WithPriority Log) -> SessionLoadingOptions -> FilePath -> TQueue (IO ()) -> IO (Action IdeGhcSession)
loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
let toAbsolutePath = toAbsolute rootDir -- see Note [Root Directory]
cradle_files <- newIORef []
cradle_files <- newIORef $ Set.empty

Check warning on line 439 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Suggestion in loadSessionWithOptions in module Development.IDE.Session: Redundant $ ▫︎ Found: "newIORef $ Set.empty" ▫︎ Perhaps: "newIORef Set.empty"
-- Mapping from hie.yaml file to HscEnv, one per hie.yaml file
hscEnvs <- newVar Map.empty :: IO (Var HieMap)
-- Mapping from a Filepath to HscEnv
Expand Down Expand Up @@ -639,7 +639,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
[] -> error $ "GHC version could not be parsed: " <> version
((runTime, _):_)
| compileTime == runTime -> do
atomicModifyIORef' cradle_files (\xs -> (cfps<>xs,()))
atomicModifyIORef' cradle_files (\xs -> (Set.fromList cfps<>xs,()))

Check warning on line 642 in ghcide/session-loader/Development/IDE/Session.hs

View workflow job for this annotation

GitHub Actions / Hlint check run

Warning in loadSessionWithOptions in module Development.IDE.Session: Use atomicModifyIORef'_ ▫︎ Found: "atomicModifyIORef'\n cradle_files (\\ xs -> (Set.fromList cfps <> xs, ()))" ▫︎ Perhaps: "atomicModifyIORef'_ cradle_files ((<>) (Set.fromList cfps))"
fmap (fmap Just) $ session (hieYaml, toNormalizedFilePath' <$> cfps, opts, libDir)
| otherwise -> return ([(toNormalizedFilePath' cfp, (([renderPackageSetupException cfp GhcVersionMismatch{..}], Nothing), [])) | cfp <- cfps], Nothing)
-- Failure case, either a cradle error or the none cradle
Expand All @@ -658,7 +658,7 @@ loadSessionWithOptions recorder SessionLoadingOptions{..} rootDir que = do
<> " (for " <> T.intercalate "," (T.pack <$> lfpLogs) <> ")"
eoptsList <- mRunLspTCallback lspEnv (\act -> withIndefiniteProgress progMsg Nothing NotCancellable (const act)) $
do old_files <- readIORef cradle_files
res <- cradleToOptsAndLibDirs recorder (sessionLoading clientConfig) cradles old_files
res <- cradleToOptsAndLibDirs recorder (sessionLoading clientConfig) cradles (Set.toList old_files)
return res
mapM (\(cr, hieYaml, fps, eopts) -> eoptsHscEnv (hieYaml, NE.toList fps, cr, eopts)) eoptsList

Expand Down

0 comments on commit fe20770

Please sign in to comment.