@@ -16,7 +16,6 @@ import Control.Concurrent.MVar (newEmptyMVar,
1616 putMVar , tryReadMVar )
1717import Control.Concurrent.STM.Stats (dumpSTMStats )
1818import Control.Exception.Safe (SomeException ,
19- catchAny ,
2019 displayException )
2120import Control.Monad.Extra (concatMapM , unless ,
2221 when )
@@ -32,7 +31,7 @@ import Data.List.Extra (intercalate,
3231import Data.Maybe (catMaybes , isJust )
3332import qualified Data.Text as T
3433import Development.IDE (Action ,
35- Priority (Debug , Error ),
34+ Priority (Debug ),
3635 Rules , hDuplicateTo' )
3736import Development.IDE.Core.Debouncer (Debouncer ,
3837 newAsyncDebouncer )
@@ -72,9 +71,9 @@ import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
7271import qualified Development.IDE.Plugin.Test as Test
7372import Development.IDE.Session (SessionLoadingOptions ,
7473 getHieDbLoc ,
74+ getInitialGhcLibDirDefault ,
7575 loadSessionWithOptions ,
76- retryOnSqliteBusy ,
77- setInitialDynFlags )
76+ retryOnSqliteBusy )
7877import qualified Development.IDE.Session as Session
7978import Development.IDE.Types.Location (NormalizedUri ,
8079 toNormalizedFilePath' )
@@ -136,7 +135,6 @@ data Log
136135 | LogLspStart [PluginId ]
137136 | LogLspStartDuration ! Seconds
138137 | LogShouldRunSubset ! Bool
139- | LogSetInitialDynFlagsException ! SomeException
140138 | LogConfigurationChange T. Text
141139 | LogService Service. Log
142140 | LogShake Shake. Log
@@ -160,8 +158,6 @@ instance Pretty Log where
160158 " Started LSP server in" <+> pretty (showDuration duration)
161159 LogShouldRunSubset shouldRunSubset ->
162160 " shouldRunSubset:" <+> pretty shouldRunSubset
163- LogSetInitialDynFlagsException e ->
164- " setInitialDynFlags:" <+> pretty (displayException e)
165161 LogConfigurationChange msg -> " Configuration changed:" <+> pretty msg
166162 LogService msg -> pretty msg
167163 LogShake msg -> pretty msg
@@ -329,13 +325,6 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
329325 getIdeState env rootPath withHieDb threadQueue = do
330326 t <- ioT
331327 logWith recorder Info $ LogLspStartDuration t
332- -- We want to set the global DynFlags right now, so that we can use
333- -- `unsafeGlobalDynFlags` even before the project is configured
334- _mlibdir <-
335- setInitialDynFlags (cmapWithPrio LogSession recorder) rootPath argsSessionLoadingOptions
336- -- TODO: should probably catch/log/rethrow at top level instead
337- `catchAny` (\ e -> logWith recorder Error (LogSetInitialDynFlagsException e) >> pure Nothing )
338-
339328 sessionLoader <- loadSessionWithOptions (cmapWithPrio LogSession recorder) argsSessionLoadingOptions rootPath (tLoaderQueue threadQueue)
340329 config <- LSP. runLspT env LSP. getConfig
341330 let def_options = argsIdeOptions config sessionLoader
@@ -435,7 +424,7 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
435424 let root = argsProjectRoot
436425 dbLoc <- getHieDbLoc root
437426 hPutStrLn stderr $ " Using hiedb at: " ++ dbLoc
438- mlibdir <- setInitialDynFlags (cmapWithPrio LogSession recorder) root def
427+ mlibdir <- getInitialGhcLibDirDefault (cmapWithPrio LogSession recorder) root
439428 rng <- newStdGen
440429 case mlibdir of
441430 Nothing -> exitWith $ ExitFailure 1
0 commit comments