From 6b0d0d4b269ac4c883b2d89989458c997889c0d8 Mon Sep 17 00:00:00 2001 From: Pepe Iborra Date: Sat, 6 Mar 2021 13:17:51 +0000 Subject: [PATCH] Close Shake session before exit in order to dump Shake profile --- ghcide/src/Development/IDE/LSP/LanguageServer.hs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/ghcide/src/Development/IDE/LSP/LanguageServer.hs b/ghcide/src/Development/IDE/LSP/LanguageServer.hs index a40715bcc15..df9c12264b4 100644 --- a/ghcide/src/Development/IDE/LSP/LanguageServer.hs +++ b/ghcide/src/Development/IDE/LSP/LanguageServer.hs @@ -200,7 +200,11 @@ cancelHandler cancelRequest = LSP.notificationHandler SCancelRequest $ \Notifica liftIO $ cancelRequest (SomeLspId _id) exitHandler :: IO () -> LSP.Handlers (ServerM c) -exitHandler exit = LSP.notificationHandler SExit (const $ liftIO exit) +exitHandler exit = LSP.notificationHandler SExit $ const $ do + (_, ide) <- ask + -- flush out the Shake session to record a Shake profile if applicable + liftIO $ restartShakeSession (shakeExtras ide) [] + liftIO exit modifyOptions :: LSP.Options -> LSP.Options modifyOptions x = x{ LSP.textDocumentSync = Just $ tweakTDS origTDS