@@ -5,10 +5,10 @@ module Cornelis.Agda where
55
66import Control.Concurrent.Chan.Unagi (newChan , readChan , writeChan )
77import Control.Lens
8- import Control.Monad (forever , replicateM_ , when )
8+ import Control.Monad (forever , replicateM_ )
99import Control.Monad.IO.Class
1010import Control.Monad.State
11- import Cornelis.Debug (reportExceptions )
11+ import Cornelis.Debug (reportExceptions , debugString )
1212import Cornelis.InfoWin (buildInfoBuffer )
1313import Cornelis.Types
1414import Cornelis.Types.Agda
@@ -28,9 +28,8 @@ import System.Process
2828
2929------------------------------------------------------------------------------
3030-- | When true, dump out received JSON as it arrives.
31- debugJson :: Bool
32- debugJson = False
33-
31+ debugJson :: Neovim CornelisEnv Bool
32+ debugJson = asks $ cc_debug . ce_config
3433
3534------------------------------------------------------------------------------
3635-- | Create an 'Agda' environment for the given buffer. This spawns an
@@ -70,7 +69,7 @@ spawnAgda buffer = do
7069 Right res -> do
7170 case res of
7271 HighlightingInfo _ _ -> pure ()
73- _ -> when debugJson $ vim_report_error $ T. pack $ show resp
72+ _ -> whenM debugJson $ debugString $ LT. unpack resp
7473 liftIO $ writeChan chan $ AgdaResp buffer res
7574
7675 void $ neovimAsync $ liftIO $ forever $ do
0 commit comments