0 | module Idris.IDEMode.Commands
2 | import Core.Context.Log
3 | import public Idris.REPL.Opts
8 | import public Protocol.IDE
9 | import public Protocol.SExp
14 | Cast (FileName, NonEmptyFC) FileContext where
15 | cast (filename, _, (startLine, startCol), (endLine, endCol)) =
18 | , range = MkBounds {startLine, startCol, endLine, endCol}
22 | getMsg : SExp -> Maybe (IDECommand, Integer)
23 | getMsg (SExpList [cmdexp, IntegerAtom num])
24 | = do cmd <- fromSExp cmdexp
30 | toSExp = SymbolAtom . show
32 | sendStr : File -> String -> IO ()
34 | map (const ()) (fPutStr f st)
37 | send : {auto c : Ref Ctxt Defs} -> File -> Reply -> Core ()
39 | = do let r = show (toSExp resp) ++ "\n"
40 | log "ide-mode.send" 20 r
41 | coreLift $
sendStr f $
leftPad '0' 6 (asHex (cast (length r)))
42 | coreLift $
sendStr f r