Skip to content

Commit 8786366

Browse files
committed
[ change ] Print log to stderr instead of stdout
1 parent 0e18ff2 commit 8786366

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

app/Main.hs

+1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ main = do
1313
-- https://github.com/agda/agda-language-server/issues/24
1414
hSetEncoding stdout utf8
1515
hSetEncoding stdin utf8
16+
1617
options <- getOptionsFromArgv
1718
if optHelp options
1819
then putStrLn usageMessage

src/Server.hs

+1-4
Original file line numberDiff line numberDiff line change
@@ -110,10 +110,7 @@ handlers =
110110
result <- Handler.onHover uri pos
111111
responder $ Right result,
112112
notificationHandler SInitialized $ \_not -> pure (),
113-
notificationHandler STextDocumentDidOpen $ \_not -> pure (),
114-
notificationHandler STextDocumentDidSave $ \_not -> pure (),
115-
notificationHandler STextDocumentDidChange $ \_not -> pure (),
116-
notificationHandler SCancelRequest $ \_not -> pure ()
113+
notificationHandler STextDocumentDidOpen $ \_not -> pure ()
117114
-- -- syntax highlighting
118115
-- , requestHandler STextD_cumentSemanticTokensFull $ \req responder -> do
119116
-- result <- Handler.onHighlight (req ^. (params . textDocument . uri))

src/Switchboard.hs

+3-2
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ import Language.LSP.Server
1212
import Language.LSP.Types hiding (TextDocumentSyncClientCapabilities (..))
1313
import Data.IORef
1414
import Options (Config)
15+
import System.IO (stderr)
1516

1617
data Switchboard = Switchboard
1718
{ sbPrintLog :: ThreadId
@@ -42,13 +43,13 @@ destroy switchboard = do
4243
killThread (sbRunAgda switchboard)
4344
writeIORef (sbLanguageContextEnv switchboard) Nothing
4445

45-
-- | Keep printing log
46+
-- | Keep printing log to stderr
4647
-- Consumer of `envLogChan`
4748
keepPrintingLog :: Env -> IO ()
4849
keepPrintingLog env = forever $ do
4950
result <- readChan (envLogChan env)
5051
when (envDevMode env) $ do
51-
Text.putStrLn result
52+
Text.hPutStrLn stderr result
5253

5354
-- | Keep sending reactions
5455
-- Consumer of `envResponseChan`

0 commit comments

Comments
 (0)