Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 21 additions & 1 deletion src/Idris/IDEMode/REPL.idr
Original file line number Diff line number Diff line change
Expand Up @@ -128,6 +128,22 @@ data IDEResult
| TTTerm String -- should be a TT Term + metadata, or perhaps SExp
| NameLocList (List (Name, FC))
| VersionSExp Version
| OptionsSExp (List REPLOpt)

getOptions : {auto c : Ref Ctxt Defs} ->
{auto o : Ref ROpts REPLOpts} ->
Core (List REPLOpt)
getOptions = do
pp <- getPPrint
opts <- get ROpts
pure $ [ ShowImplicits (showImplicits pp)
, ShowMachineNames (showMachineNames pp)
, ShowNamespace (fullNamespace pp)
, ShowTypes (showTypes opts)
, EvalMode (evalMode opts)
, Editor (editor opts)
]

Comment on lines +133 to +146
Copy link
Copy Markdown
Owner Author

@keram keram Apr 24, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is copy-paste from Idris/REPL.idr https://github.com/idris-lang/Idris2/blob/main/src/Idris/REPL.idr#L191 as when trying reusing it here got an error.

Error: While processing right hand side of process. 
Name Idris.REPL.getOptions is private.
...
Suggestion: add an explicit export or public export modifier. 

I don't know which is the right suggested solution or some other better way to get the opts.


replWrap : Core REPLResult -> Core IDEResult
replWrap m = pure $ REPL !m
Expand Down Expand Up @@ -238,7 +254,8 @@ process Version
process (Metavariables _)
= FoundHoles <$> getUserHolesData
process GetOptions
= replWrap $ Idris.REPL.process GetOpts
= do opts <- getOptions
pure $ OptionsSExp opts

processCatch : {auto c : Ref Ctxt Defs} ->
{auto u : Ref UST UState} ->
Expand Down Expand Up @@ -364,6 +381,9 @@ displayIDEResult outf i (REPL $ LogLevelSet k)
= printIDEResult outf i
$ AString $ "Set loglevel to " ++ show k
displayIDEResult outf i (REPL $ OptionsSet opts)
= printIDEResult outf i
$ AString $ showSep "\n" $ map show opts
displayIDEResult outf i (OptionsSExp opts)
= printIDEResult outf i $ AnOptionList $ map cast opts
displayIDEResult outf i (REPL $ VersionIs x)
= printIDEResult outf i $ AString (showVersion True x)
Expand Down
6 changes: 4 additions & 2 deletions src/Idris/REPL.idr
Original file line number Diff line number Diff line change
Expand Up @@ -194,9 +194,11 @@ getOptions : {auto c : Ref Ctxt Defs} ->
getOptions = do
pp <- getPPrint
opts <- get ROpts
pure $ [ ShowImplicits (showImplicits pp), ShowMachineNames (showMachineNames pp)
pure $ [ ShowImplicits (showImplicits pp)
, ShowMachineNames (showMachineNames pp)
, ShowNamespace (fullNamespace pp)
, ShowTypes (showTypes opts), EvalMode (evalMode opts)
, ShowTypes (showTypes opts)
, EvalMode (evalMode opts)
, Editor (editor opts)
]

Expand Down
Loading