@@ -189,57 +189,56 @@ runSessionWithServer' ::
189
189
Session a ->
190
190
IO a
191
191
runSessionWithServer' plugins conf sconf caps root s = withLock lock $ keepCurrentDirectory $ do
192
- (inR, inW) <- createPipe
193
- (outR, outW) <- createPipe
194
-
195
- docWithPriorityRecorder <- makeDefaultStderrRecorder Nothing Debug
196
-
197
- logStdErr <- fromMaybe " 0" <$> lookupEnv " LSP_TEST_LOG_STDERR"
198
-
199
- let
200
- docWithFilteredPriorityRecorder@ Recorder { logger_ } =
201
- if logStdErr == " 0" then mempty
202
- else cfilter (\ WithPriority { priority } -> priority >= Debug ) docWithPriorityRecorder
203
-
204
- -- exists until old logging style is phased out
205
- logger = Logger $ \ p m -> logger_ (WithPriority p emptyCallStack (pretty m))
206
-
207
- recorder = cmapWithPrio pretty docWithFilteredPriorityRecorder
208
-
209
- arguments@ Arguments { argsHlsPlugins, argsIdeOptions, argsLogger } = defaultArguments (cmapWithPrio LogIDEMain recorder) logger
210
-
211
- hlsPlugins =
212
- plugins
213
- ++ [Test. blockCommandDescriptor " block-command" , Test. plugin]
214
- ++ idePluginsToPluginDesc argsHlsPlugins
215
- ideOptions = \ config ghcSession ->
216
- let defIdeOptions = argsIdeOptions config ghcSession
217
- in defIdeOptions
218
- { optTesting = IdeTesting True
219
- , optCheckProject = pure False
220
- }
221
-
222
- server <-
223
- async $
224
- Ghcide. defaultMain
225
- (cmapWithPrio LogIDEMain recorder)
226
- arguments
227
- { argsHandleIn = pure inR
228
- , argsHandleOut = pure outW
229
- , argsDefaultHlsConfig = conf
230
- , argsLogger = argsLogger
231
- , argsIdeOptions = ideOptions
232
- , argsHlsPlugins = pluginDescToIdePlugins hlsPlugins }
233
-
234
- x <- runSessionWithHandles inW outR sconf caps root s
235
- hClose inW
236
- timeout 3 (wait server) >>= \ case
237
- Just () -> pure ()
238
- Nothing -> do
239
- putStrLn " Server does not exit in 3s, canceling the async task..."
240
- (t, _) <- duration $ cancel server
241
- putStrLn $ " Finishing canceling (took " <> showDuration t <> " s)"
242
- pure x
192
+ (inR, inW) <- createPipe
193
+ (outR, outW) <- createPipe
194
+
195
+ docWithPriorityRecorder <- makeDefaultStderrRecorder Nothing Debug
196
+
197
+ logStdErr <- fromMaybe " 0" <$> lookupEnv " LSP_TEST_LOG_STDERR"
198
+
199
+ let
200
+ docWithFilteredPriorityRecorder@ Recorder { logger_ } =
201
+ if logStdErr == " 0" then mempty
202
+ else cfilter (\ WithPriority { priority } -> priority >= Debug ) docWithPriorityRecorder
203
+
204
+ -- exists until old logging style is phased out
205
+ logger = Logger $ \ p m -> logger_ (WithPriority p emptyCallStack (pretty m))
206
+
207
+ recorder = cmapWithPrio pretty docWithFilteredPriorityRecorder
208
+
209
+ arguments@ Arguments { argsHlsPlugins, argsIdeOptions, argsLogger } = defaultArguments (cmapWithPrio LogIDEMain recorder) logger
210
+
211
+ hlsPlugins =
212
+ plugins
213
+ ++ [Test. blockCommandDescriptor " block-command" , Test. plugin]
214
+ ++ idePluginsToPluginDesc argsHlsPlugins
215
+ ideOptions config ghcSession =
216
+ let defIdeOptions = argsIdeOptions config ghcSession
217
+ in defIdeOptions
218
+ { optTesting = IdeTesting True
219
+ , optCheckProject = pure False
220
+ }
221
+
222
+ server <- async $
223
+ Ghcide. defaultMain (cmapWithPrio LogIDEMain recorder)
224
+ arguments
225
+ { argsHandleIn = pure inR
226
+ , argsHandleOut = pure outW
227
+ , argsDefaultHlsConfig = conf
228
+ , argsLogger = argsLogger
229
+ , argsIdeOptions = ideOptions
230
+ , argsHlsPlugins = pluginDescToIdePlugins hlsPlugins
231
+ }
232
+
233
+ x <- runSessionWithHandles inW outR sconf caps root s
234
+ hClose inW
235
+ timeout 3 (wait server) >>= \ case
236
+ Just () -> pure ()
237
+ Nothing -> do
238
+ putStrLn " Server does not exit in 3s, canceling the async task..."
239
+ (t, _) <- duration $ cancel server
240
+ putStrLn $ " Finishing canceling (took " <> showDuration t <> " s)"
241
+ pure x
243
242
244
243
-- | Wait for the next progress end step
245
244
waitForProgressDone :: Session ()
0 commit comments