@@ -162,6 +162,7 @@ import Language.LSP.Protocol.Types (MessageType (Mess
162
162
ShowMessageParams (ShowMessageParams ))
163
163
import Language.LSP.Server (LspT )
164
164
import qualified Language.LSP.Server as LSP
165
+ import qualified Language.LSP.Protocol.Message as LSP
165
166
import Language.LSP.VFS
166
167
import Prelude hiding (mod )
167
168
import System.Directory (doesFileExist ,
@@ -170,6 +171,7 @@ import System.Info.Extra (isWindows)
170
171
171
172
172
173
import GHC.Fingerprint
174
+ import qualified Development.IDE.Session as Session
173
175
174
176
-- See Note [Guidelines For Using CPP In GHCIDE Import Statements]
175
177
@@ -179,12 +181,14 @@ import GHC (mgModSummaries)
179
181
180
182
#if MIN_VERSION_ghc(9,3,0)
181
183
import qualified Data.IntMap as IM
184
+ import Data.Row (KnownSymbol )
182
185
#endif
183
186
184
187
185
188
186
189
data Log
187
190
= LogShake Shake. Log
191
+ | LogSession Session. Log
188
192
| LogReindexingHieFile ! NormalizedFilePath
189
193
| LogLoadingHieFile ! NormalizedFilePath
190
194
| LogLoadingHieFileFail ! FilePath ! SomeException
@@ -214,6 +218,7 @@ instance Pretty Log where
214
218
<+> " the HLS version being used, the plugins enabled, and if possible the codebase and file which"
215
219
<+> " triggered this warning."
216
220
]
221
+ LogSession msg -> pretty msg
217
222
218
223
templateHaskellInstructions :: T. Text
219
224
templateHaskellInstructions = " https://haskell-language-server.readthedocs.io/en/latest/troubleshooting.html#static-binaries"
@@ -707,8 +712,24 @@ loadGhcSession recorder ghcSessionDepsConfig = do
707
712
return (fingerprint, res)
708
713
709
714
defineEarlyCutoff (cmapWithPrio LogShake recorder) $ Rule $ \ GhcSession file -> do
715
+ -- todo add signal
716
+ ShakeExtras {exportsMap, ideTesting = IdeTesting testing, lspEnv, progress} <- getShakeExtras
717
+ let
718
+ signal' :: KnownSymbol s => Proxy s -> String -> Action ()
719
+ signal' msg str = when testing $ liftIO $
720
+ mRunLspT lspEnv $
721
+ LSP. sendNotification (LSP. SMethod_CustomMethod msg) $
722
+ toJSON $ [str]
723
+ signal :: KnownSymbol s => Proxy s -> Action ()
724
+ signal msg = signal' msg (show file)
725
+
726
+
727
+
728
+ signal (Proxy @ " GhcSession/start" )
710
729
IdeGhcSession {loadSessionFun} <- useNoFile_ GhcSessionIO
730
+ signal (Proxy @ " GhcSession/loadSessionFun/before" )
711
731
(val,deps) <- liftIO $ loadSessionFun $ fromNormalizedFilePath file
732
+ signal (Proxy @ " GhcSession/loadSessionFun/after" )
712
733
713
734
-- add the deps to the Shake graph
714
735
let addDependency fp = do
@@ -721,6 +742,7 @@ loadGhcSession recorder ghcSessionDepsConfig = do
721
742
mapM_ addDependency deps
722
743
723
744
let cutoffHash = LBS. toStrict $ B. encode (hash (snd val))
745
+ signal (Proxy @ " GhcSession/done" )
724
746
return (Just cutoffHash, val)
725
747
726
748
defineNoDiagnostics (cmapWithPrio LogShake recorder) $ \ (GhcSessionDeps_ fullModSummary) file -> do
0 commit comments