mirror of
https://github.com/edwinb/Idris2-boot.git
synced 2024-11-28 05:32:03 +03:00
handle more commands in IDE mode
This commit is contained in:
parent
ed27d32392
commit
85e6e9ca7a
@ -25,7 +25,9 @@ data IDECommand
|
||||
| MakeLemma Integer String
|
||||
| MakeCase Integer String
|
||||
| MakeWith Integer String
|
||||
| Metavariables Integer
|
||||
| Version
|
||||
| GetOptions
|
||||
|
||||
readHints : List SExp -> Maybe (List String)
|
||||
readHints [] = Just []
|
||||
@ -75,7 +77,10 @@ getIDECommand (SExpList [SymbolAtom "make-case", IntegerAtom l, StringAtom n])
|
||||
= Just $ MakeCase l n
|
||||
getIDECommand (SExpList [SymbolAtom "make-with", IntegerAtom l, StringAtom n])
|
||||
= Just $ MakeWith l n
|
||||
getIDECommand (SExpList [SymbolAtom "metavariables", IntegerAtom n])
|
||||
= Just $ Metavariables n
|
||||
getIDECommand (SymbolAtom "version") = Just Version
|
||||
getIDECommand (SExpList [SymbolAtom "get-options"]) = Just GetOptions
|
||||
getIDECommand _ = Nothing
|
||||
|
||||
export
|
||||
@ -96,6 +101,8 @@ putIDECommand (GenerateDef line n) = (SExpList [SymbolAtom "generate-
|
||||
putIDECommand (MakeLemma line n) = (SExpList [SymbolAtom "make-lemma", IntegerAtom line, StringAtom n])
|
||||
putIDECommand (MakeCase line n) = (SExpList [SymbolAtom "make-case", IntegerAtom line, StringAtom n])
|
||||
putIDECommand (MakeWith line n) = (SExpList [SymbolAtom "make-with", IntegerAtom line, StringAtom n])
|
||||
putIDECommand (Metavariables n) = (SExpList [SymbolAtom "metavariables", IntegerAtom n])
|
||||
putIDECommand GetOptions = (SExpList [SymbolAtom "get-options"])
|
||||
putIDECommand Version = SymbolAtom "version"
|
||||
|
||||
export
|
||||
|
@ -189,6 +189,12 @@ process (MakeWith l n)
|
||||
process Version
|
||||
= do Idris.REPL.process ShowVersion
|
||||
pure ()
|
||||
process (Metavariables _)
|
||||
= do Idris.REPL.process Metavars
|
||||
pure ()
|
||||
process GetOptions
|
||||
= do printResult ""
|
||||
pure ()
|
||||
|
||||
processCatch : {auto c : Ref Ctxt Defs} ->
|
||||
{auto u : Ref UST UState} ->
|
||||
|
@ -22,9 +22,9 @@ iputStrLn msg
|
||||
REPL False => coreLift $ putStrLn msg
|
||||
REPL _ => pure ()
|
||||
IDEMode i _ f =>
|
||||
send f (SExpList [SymbolAtom "write-string",
|
||||
send f (SExpList [SymbolAtom "write-string",
|
||||
toSExp msg, toSExp i])
|
||||
|
||||
|
||||
|
||||
printWithStatus : {auto o : Ref ROpts REPLOpts} ->
|
||||
String -> String -> Core ()
|
||||
@ -33,9 +33,7 @@ printWithStatus status msg
|
||||
case idemode opts of
|
||||
REPL _ => coreLift $ putStrLn msg
|
||||
IDEMode i _ f =>
|
||||
do let m = SExpList [SymbolAtom status, toSExp msg,
|
||||
-- highlighting; currently blank
|
||||
SExpList []]
|
||||
do let m = SExpList [SymbolAtom status, toSExp msg ]
|
||||
send f (SExpList [SymbolAtom "return", m, toSExp i])
|
||||
|
||||
export
|
||||
@ -58,7 +56,7 @@ emitError : {auto c : Ref Ctxt Defs} ->
|
||||
emitError err
|
||||
= do opts <- get ROpts
|
||||
case idemode opts of
|
||||
REPL _ =>
|
||||
REPL _ =>
|
||||
do msg <- display err
|
||||
coreLift $ putStrLn msg
|
||||
IDEMode i _ f =>
|
||||
@ -66,10 +64,10 @@ emitError err
|
||||
case getErrorLoc err of
|
||||
Nothing => iputStrLn msg
|
||||
Just fc =>
|
||||
send f (SExpList [SymbolAtom "warning",
|
||||
SExpList [toSExp (file fc),
|
||||
toSExp (addOne (startPos fc)),
|
||||
toSExp (addOne (endPos fc)),
|
||||
send f (SExpList [SymbolAtom "warning",
|
||||
SExpList [toSExp (file fc),
|
||||
toSExp (addOne (startPos fc)),
|
||||
toSExp (addOne (endPos fc)),
|
||||
toSExp msg,
|
||||
-- highlighting; currently blank
|
||||
SExpList []],
|
||||
@ -104,5 +102,3 @@ resetContext
|
||||
put UST initUState
|
||||
put Syn initSyntax
|
||||
put MD initMetadata
|
||||
|
||||
|
||||
|
@ -1,4 +1,4 @@
|
||||
000018(:protocol-version 2 0)
|
||||
000038(:write-string "1/1: Building LocType (LocType.idr)" 1)
|
||||
00002a(:return (:ok "Loaded LocType.idr" ()) 1)
|
||||
000027(:return (:ok "Loaded LocType.idr") 1)
|
||||
Alas the file is done, aborting
|
||||
|
Loading…
Reference in New Issue
Block a user