on master help sign in
support for add-clause in IdeSlave
commitdbe880cbace84c1610aa2e312ad2e3e6e07fc3d0 authorHannes Mehnert <hannes@mehnert.org> dateMon 18 Nov 2013, 22:49 (13 years ago) parent40611be
2 files changed+5−1
src/Idris/IdeSlave.hs+2 src/Idris/REPL.hs+3−1
src/Idris/IdeSlave.hs+2
@@ -95,6 +95,7 @@ data IdeSlaveCommand = REPLCompletions String
9595 | Interpret String
9696 | TypeOf String
9797 | CaseSplit Int String
98+ | AddClause Int String
9899 | LoadFile String
99100 deriving Show
100101
@@ -105,6 +106,7 @@ sexpToCommand (SexpList [SymbolAtom "repl-completions", StringAtom prefix])
105106sexpToCommand (SexpList [SymbolAtom "load-file", StringAtom filename]) = Just (LoadFile filename)
106107sexpToCommand (SexpList [SymbolAtom "type-of", StringAtom name]) = Just (TypeOf name)
107108sexpToCommand (SexpList [SymbolAtom "case-split", IntegerAtom line, StringAtom name]) = Just (CaseSplit (fromInteger line) name)
109+sexpToCommand (SexpList [SymbolAtom "add-clause", IntegerAtom line, StringAtom name]) = Just (AddClause (fromInteger line) name)
108110sexpToCommand _ = Nothing
109111
110112parseMessage :: String -> Either Err (SExp, Integer)
src/Idris/REPL.hs+3−1
@@ -237,6 +237,8 @@ ideslave orig mods
237237 process stdout "(ideslave)" (Check (PRef (FC "(ideslave)" 0 0) (UN name)))
238238 Just (IdeSlave.CaseSplit line name) ->
239239 process stdout fn (CaseSplitAt False line (UN name))
240+ Just (IdeSlave.AddClause line name) ->
241+ process stdout fn (AddClauseFrom False line (UN name))
240242 Nothing -> do iPrintError "did not understand")
241243 (\e -> do iPrintError $ show e)
242244 ideslave orig mods
@@ -572,7 +574,7 @@ process h fn (AddClauseFrom updatefile l n)
572574 cl ++ "\n" ++
573575 unlines rest)
574576 runIO $ copyFile fb fn
575− else ihputStrLn h cl
577+ else ihPrintResult h cl
576578 where
577579 getIndent i n [] = 0
578580 getIndent i n xs | take (length n) xs == n = i