@@ -8,6 +8,8 @@ module Main(main) where
8
8
import Control.Monad.IO.Class (liftIO )
9
9
import Data.Function ((&) )
10
10
import Data.Text (Text )
11
+ import qualified Development.IDE.Main as GhcideMain
12
+ import qualified Development.IDE.Main.HeapStats as HeapStats
11
13
import Development.IDE.Types.Logger (Doc ,
12
14
Priority (Debug , Error , Info ),
13
15
WithPriority (WithPriority , priority ),
@@ -16,7 +18,7 @@ import Development.IDE.Types.Logger (Doc,
16
18
layoutPretty ,
17
19
makeDefaultStderrRecorder ,
18
20
renderStrict ,
19
- withDefaultRecorder )
21
+ withDefaultRecorder , payload )
20
22
import qualified Development.IDE.Types.Logger as Logger
21
23
import Ide.Arguments (Arguments (.. ),
22
24
GhcideArguments (.. ),
@@ -32,6 +34,7 @@ import Language.LSP.Types as LSP
32
34
import qualified Plugins
33
35
#if MIN_VERSION_prettyprinter(1,7,0)
34
36
import Prettyprinter (Pretty (pretty ), vsep )
37
+ import Control.Arrow ((&&&) )
35
38
#else
36
39
import Data.Text.Prettyprint.Doc (Pretty (pretty ), vsep )
37
40
#endif
@@ -71,15 +74,19 @@ main = do
71
74
72
75
withDefaultRecorder logFilePath Nothing minPriority $ \ textWithPriorityRecorder -> do
73
76
let
74
- recorder = cmapWithPrio pretty $ mconcat
77
+ recorder = cmapWithPrio ( pretty &&& id ) $ mconcat
75
78
[textWithPriorityRecorder
76
79
& cfilter (\ WithPriority { priority } -> priority >= minPriority)
80
+ & cmapWithPrio fst
77
81
, lspMessageRecorder
78
82
& cfilter (\ WithPriority { priority } -> priority >= Error )
79
- & cmapWithPrio renderDoc
83
+ & cmapWithPrio ( renderDoc . fst )
80
84
, lspLogRecorder
81
85
& cfilter (\ WithPriority { priority } -> priority >= minPriority)
82
- & cmapWithPrio (renderStrict . layoutPretty defaultLayoutOptions)
86
+ & cmapWithPrio (renderStrict . layoutPretty defaultLayoutOptions . fst )
87
+ -- do not log heap stats to the LSP log as they interfere with the
88
+ -- ability of lsp-test to detect a stuck server in tests and benchmarks
89
+ & cfilter (not . heapStats . snd . payload)
83
90
]
84
91
plugins = (Plugins. idePlugins (cmapWithPrio LogPlugins recorder) includeExamplePlugins)
85
92
@@ -96,3 +103,7 @@ renderDoc d = renderStrict $ layoutPretty defaultLayoutOptions $ vsep
96
103
97
104
issueTrackerUrl :: Doc a
98
105
issueTrackerUrl = " https://github.com/haskell/haskell-language-server/issues"
106
+
107
+ heapStats :: Log -> Bool
108
+ heapStats (LogIdeMain (IdeMain. LogIDEMain (GhcideMain. LogHeapStats _))) = True
109
+ heapStats _ = False
0 commit comments