@@ -16,7 +16,6 @@ import Control.Concurrent.MVar (newEmptyMVar,
16
16
putMVar , tryReadMVar )
17
17
import Control.Concurrent.STM.Stats (dumpSTMStats )
18
18
import Control.Exception.Safe (SomeException ,
19
- catchAny ,
20
19
displayException )
21
20
import Control.Monad.Extra (concatMapM , unless ,
22
21
when )
@@ -32,7 +31,7 @@ import Data.List.Extra (intercalate,
32
31
import Data.Maybe (catMaybes , isJust )
33
32
import qualified Data.Text as T
34
33
import Development.IDE (Action ,
35
- Priority (Debug , Error ),
34
+ Priority (Debug ),
36
35
Rules , hDuplicateTo' )
37
36
import Development.IDE.Core.Debouncer (Debouncer ,
38
37
newAsyncDebouncer )
@@ -72,9 +71,9 @@ import qualified Development.IDE.Plugin.HLS.GhcIde as GhcIde
72
71
import qualified Development.IDE.Plugin.Test as Test
73
72
import Development.IDE.Session (SessionLoadingOptions ,
74
73
getHieDbLoc ,
74
+ getInitialGhcLibDirDefault ,
75
75
loadSessionWithOptions ,
76
- retryOnSqliteBusy ,
77
- setInitialDynFlags )
76
+ retryOnSqliteBusy )
78
77
import qualified Development.IDE.Session as Session
79
78
import Development.IDE.Types.Location (NormalizedUri ,
80
79
toNormalizedFilePath' )
@@ -136,7 +135,6 @@ data Log
136
135
| LogLspStart [PluginId ]
137
136
| LogLspStartDuration ! Seconds
138
137
| LogShouldRunSubset ! Bool
139
- | LogSetInitialDynFlagsException ! SomeException
140
138
| LogConfigurationChange T. Text
141
139
| LogService Service. Log
142
140
| LogShake Shake. Log
@@ -160,8 +158,6 @@ instance Pretty Log where
160
158
" Started LSP server in" <+> pretty (showDuration duration)
161
159
LogShouldRunSubset shouldRunSubset ->
162
160
" shouldRunSubset:" <+> pretty shouldRunSubset
163
- LogSetInitialDynFlagsException e ->
164
- " setInitialDynFlags:" <+> pretty (displayException e)
165
161
LogConfigurationChange msg -> " Configuration changed:" <+> pretty msg
166
162
LogService msg -> pretty msg
167
163
LogShake msg -> pretty msg
@@ -329,13 +325,6 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
329
325
getIdeState env rootPath withHieDb threadQueue = do
330
326
t <- ioT
331
327
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
-
339
328
sessionLoader <- loadSessionWithOptions (cmapWithPrio LogSession recorder) argsSessionLoadingOptions rootPath (tLoaderQueue threadQueue)
340
329
config <- LSP. runLspT env LSP. getConfig
341
330
let def_options = argsIdeOptions config sessionLoader
@@ -435,7 +424,7 @@ defaultMain recorder Arguments{..} = withHeapStats (cmapWithPrio LogHeapStats re
435
424
let root = argsProjectRoot
436
425
dbLoc <- getHieDbLoc root
437
426
hPutStrLn stderr $ " Using hiedb at: " ++ dbLoc
438
- mlibdir <- setInitialDynFlags (cmapWithPrio LogSession recorder) root def
427
+ mlibdir <- getInitialGhcLibDirDefault (cmapWithPrio LogSession recorder) root
439
428
rng <- newStdGen
440
429
case mlibdir of
441
430
Nothing -> exitWith $ ExitFailure 1
0 commit comments