[ ide-mode ] return formatted options string for :interpret ":opts" IDE command#1
Draft
keram wants to merge 2 commits intoide-mode-interpret-versionfrom
Draft
[ ide-mode ] return formatted options string for :interpret ":opts" IDE command#1keram wants to merge 2 commits intoide-mode-interpret-versionfrom
keram wants to merge 2 commits intoide-mode-interpret-versionfrom
Conversation
… IDE command Previously, the `:interpret ":opts"` returned a list of S-expression same as `((:get-options) n)` This leads to bad user experience at least in Emacs See: idris-hackers/idris-mode#661 and idris-hackers/idris-mode#662 This change distinguish between `:get-options` to return original S-expression and `:interpret ":opts" to return formatted options as a string. Before: ``` idris2 --ide-mode ((:interpret ":opts") 3) 00009b(:return (:ok ((:show-implicits :False) (:show-machinenames :False) (:show-namespace :False) (:show-types :False) (:eval "normalise") (:editor "vim"))) 3) ((:get-options) 3) 00009b(:return (:ok ((:show-implicits :False) (:show-machinenames :False) (:show-namespace :False) (:show-types :False) (:eval "normalise") (:editor "vim"))) 3) ``` After: ``` $ idris2 --ide-mode ((:interpret ":opts") 3) 00008d(:return (:ok "showimplicits = False showmachinenames = False shownamespace = False showtypes = False eval = normalise editor = \"vim\"") 3) ((:get-options) 3) 00009b(:return (:ok ((:show-implicits :False) (:show-machinenames :False) (:show-namespace :False) (:show-types :False) (:eval "normalise") (:editor "vim"))) 3) ``` Relates to: idris-lang#3768
keram
commented
Apr 24, 2026
Comment on lines
+133
to
+146
| 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) | ||
| ] | ||
|
|
Owner
Author
There was a problem hiding this comment.
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Previously, the
:interpret ":opts"returned a list of S-expression same as((:get-options) n)This leads to bad user experience at least in Emacs
See: idris-hackers/idris-mode#661
and idris-hackers/idris-mode#662
This change distinguish between
:get-optionsto return original S-expressionand `:interpret ":opts" to return formatted options as a string.
Before:
In Emacs
After:
Emacs:
Relates to:
idris-lang#3768