on master help sign in
Merge pull request #651 from hannesm/ideslave-logging
b6f54eeEdwin Brady
src/Idris/AbsSyntax.hs+6−3
@@ -577,9 +577,12 @@ setColour ct c = do i <- getIState
577logLvl :: Int -> String -> Idris ()
577logLvl :: Int -> String -> Idris ()
578logLvl l str = do i <- getIState
578logLvl l str = do i <- getIState
579 let lvl = opt_logLevel (idris_options i)
579 let lvl = opt_logLevel (idris_options i)
580− when (lvl >= l)
580+ when (lvl >= l) $
581+ case idris_outputmode i of
581− $ do runIO (putStrLn str)
582+ RawOutput -> do runIO $ putStrLn str
582− putIState $ i { idris_log = idris_log i ++ str ++ "\n" }
583+ IdeSlave n ->
584+ do let good = SexpList [IntegerAtom (toInteger l), toSExp str]
585+ runIO $ putStrLn $ convSExp "log" good n
583
586
584cmdOptType :: Opt -> Idris Bool
587cmdOptType :: Opt -> Idris Bool
585cmdOptType x = do i <- getIState
588cmdOptType x = do i <- getIState
src/Idris/AbsSyntaxTree.hs+1−2
@@ -97,7 +97,6 @@ data IState = IState {
97 idris_calledgraph :: Ctxt [Name],
97 idris_calledgraph :: Ctxt [Name],
98 idris_docstrings :: Ctxt String,
98 idris_docstrings :: Ctxt String,
99 idris_totcheck :: [(FC, Name)],
99 idris_totcheck :: [(FC, Name)],
100− idris_log :: String,
101 idris_options :: IOption,
100 idris_options :: IOption,
102 idris_name :: Int,
101 idris_name :: Int,
103 idris_lineapps :: [((FilePath, Int), PTerm)],
102 idris_lineapps :: [((FilePath, Int), PTerm)],
@@ -185,7 +184,7 @@ data IBCWrite = IBCFix FixDecl
185idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
184idrisInit = IState initContext [] [] emptyContext emptyContext emptyContext
186 emptyContext emptyContext emptyContext emptyContext
185 emptyContext emptyContext emptyContext emptyContext
187 emptyContext emptyContext emptyContext emptyContext
186 emptyContext emptyContext emptyContext emptyContext
188− [] "" defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
187+ [] defaultOpts 6 [] [] [] [] [] [] [] [] [] [] [] []
189 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
188 [] Nothing Nothing [] [] [] Hidden False [] Nothing [] [] RawOutput
190 True defaultTheme stdout
189 True defaultTheme stdout
191
190
src/Idris/REPL.hs+1−1
@@ -1156,7 +1156,7 @@ idrisMain opts =
1156
1156
1157 when runrepl $ initScript
1157 when runrepl $ initScript
1158 stvar <- runIO $ newMVar ist
1158 stvar <- runIO $ newMVar ist
1159− when runrepl $ startServer ist stvar inputs
1159+ when (runrepl && not idesl) $ startServer ist stvar inputs
1160 when (runrepl && not idesl) $ runInputT (replSettings (Just historyFile)) $ repl ist stvar inputs
1160 when (runrepl && not idesl) $ runInputT (replSettings (Just historyFile)) $ repl ist stvar inputs
1161 when (idesl) $ ideslaveStart ist inputs
1161 when (idesl) $ ideslaveStart ist inputs
1162 ok <- noErrors
1162 ok <- noErrors