Skip to content

Instantly share code, notes, and snippets.

@mpickering
Created November 14, 2025 13:46
Show Gist options
  • Select an option

  • Save mpickering/44ded755c218b670a3153f542b7064b9 to your computer and use it in GitHub Desktop.

Select an option

Save mpickering/44ded755c218b670a3153f542b7064b9 to your computer and use it in GitHub Desktop.
commit 8beeee14e3e51070883fac2413b8eb4dd553d733
Author: Matthew Pickering <[email protected]>
Date: Fri Nov 14 13:46:31 2025 +0000
Instrument HLS with eventlog-socket
diff --git a/exe/Main.hs b/exe/Main.hs
index 5684c6f89..9039e405d 100644
--- a/exe/Main.hs
+++ b/exe/Main.hs
@@ -33,6 +33,10 @@ import Ide.Types (PluginDescriptor (pluginNotifica
import Language.LSP.Protocol.Message as LSP
import Language.LSP.Server as LSP
import Prettyprinter (Pretty (pretty), vcat, vsep)
+import qualified GHC.Eventlog.Socket
+import System.Environment
+import Data.Maybe
+import Debug.Trace
data Log
= LogIdeMain IdeMain.Log
@@ -43,8 +47,14 @@ instance Pretty Log where
LogIdeMain ideMainLog -> pretty ideMainLog
LogPlugins pluginsLog -> pretty pluginsLog
+
main :: IO ()
main = do
+ eventlogSocket <-
+ fromMaybe "/tmp/ghc_eventlog.sock"
+ <$> lookupEnv "GHC_EVENTLOG_SOCKET"
+ traceShowM ("starting socket" ++ (show eventlogSocket))
+ GHC.Eventlog.Socket.start eventlogSocket
stderrRecorder <- makeDefaultStderrRecorder Nothing
-- plugin cli commands use stderr logger for now unless we change the args
-- parser to get logging arguments first or do more complicated things
diff --git a/haskell-language-server.cabal b/haskell-language-server.cabal
index 9e1b1d425..4afb3c524 100644
--- a/haskell-language-server.cabal
+++ b/haskell-language-server.cabal
@@ -1920,6 +1920,7 @@ executable haskell-language-server
, lsp
, prettyprinter >= 1.7
, text
+ , eventlog-socket
default-extensions: DataKinds
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment