Skip to content

Commit 0d85ef1

Browse files
committed
swap shakeShut and stopReactor
1 parent 0e52d91 commit 0d85ef1

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

ghcide/src/Development/IDE/LSP/LanguageServer.hs

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -262,10 +262,13 @@ shutdownHandler :: Recorder (WithPriority Log) -> IO () -> LSP.Handlers (ServerM
262262
shutdownHandler recorder stopReactor = LSP.requestHandler SMethod_Shutdown $ \_ resp -> do
263263
(_, ide) <- ask
264264
liftIO $ logWith recorder Debug LogServerShutdownMessage
265-
-- stop the reactor to free up the hiedb connection
266-
liftIO stopReactor
265+
-- we need to shut down the ide session before stopping the reactor
266+
-- since SessionIO depends on the reactor, we may hang if we stop the reactor first
267+
267268
-- flush out the Shake session to record a Shake profile if applicable
268269
liftIO $ shakeShut ide
270+
-- stop the reactor to free up the hiedb connection
271+
liftIO stopReactor
269272
resp $ Right Null
270273

271274
exitHandler :: IO () -> LSP.Handlers (ServerM c)

0 commit comments

Comments
 (0)