@@ -43,6 +43,7 @@ import Language.PureScript.Ide.Util (discardAnn, identifierFromIdeDeclaration, n
4343import Language.PureScript.Ide.Usage (findUsages )
4444import System.Directory (getCurrentDirectory , getDirectoryContents , doesDirectoryExist , doesFileExist )
4545import System.FilePath ((</>) , normalise )
46+ import Control.Concurrent.Async.Lifted (mapConcurrently , mapConcurrently_ )
4647
4748-- | Accepts a Command and runs it against psc-ide's State. This is the main
4849-- entry point for the server.
@@ -219,16 +220,16 @@ loadModules moduleNames = do
219220 oDir <- outputDirectory
220221 let efPaths =
221222 map (\ mn -> oDir </> toS (P. runModuleName mn) </> P. externsFileName) moduleNames
222- efiles <- traverse readExternFile efPaths
223- traverse_ insertExterns efiles
223+ efiles <- mapConcurrently readExternFile efPaths
224+ mapConcurrently_ insertExterns efiles
224225
225226 -- We parse all source files, log eventual parse failures and insert the
226227 -- successful parses into the state.
227228 (failures, allModules) <-
228229 partitionEithers <$> (parseModulesFromFiles =<< findAllSourceFiles)
229230 unless (null failures) $
230231 logWarnN (" Failed to parse: " <> show failures)
231- traverse_ insertModule allModules
232+ mapConcurrently_ insertModule allModules
232233
233234 pure (TextResult (" Loaded " <> show (length efiles) <> " modules and "
234235 <> show (length allModules) <> " source files." ))
0 commit comments