[ ide-mode ] return formatted version string for :interpret ":version" command#3768
Open
keram wants to merge 1 commit intoidris-lang:mainfrom
Open
[ ide-mode ] return formatted version string for :interpret ":version" command#3768keram wants to merge 1 commit intoidris-lang:mainfrom
:interpret ":version" command#3768keram wants to merge 1 commit intoidris-lang:mainfrom
Conversation
… command Previously, the IDE command `:version` (via `interpret`) reused `ShowVersion` and returned a structured S-expression containing semantic version components and commit hash. As `idris-mode` expects for output of `:interpret` command to be always a string. This leads to bad user experience on commands that return S-expression. See: idris-hackers/idris-mode#661 and idris-hackers/idris-mode#662 This introduces a dedicated `VersionSExp` constructor in `IDEResult` and updates `process Version` to return the raw `version` value directly. The IDE mode now distinguishes between: - `REPL (VersionIs x)` -> structured `AVersion` (unchanged) - `VersionSExp x` -> formatted string via `showVersion` As a result, `:version` in IDE interpret mode now produces a human-readable string (e.g. "0.8.0-<hash>") instead of a structured tuple. Before: ``` idris2 --ide-mode 000018(:protocol-version 2 1) (:version 1) 00002a(:return (:ok ((0 8 0) ("19a3f4ec0"))) 1) ((:interpret ":version") 2) 00002a(:return (:ok ((0 8 0) ("19a3f4ec0"))) 2) ``` After: ``` $ idris2 --ide-mode 000018(:protocol-version 2 1) (:version 1) 00002a(:return (:ok ((0 8 0) ("ed55358b6"))) 1) ((:interpret ":version") 2) 000024(:return (:ok "0.8.0-ed55358b6") 2) ``` Next steps: Update `:opts` command in similar way. ``` ((:interpret ":opts") 3) 00009b(:return (:ok ((:show-implicits :False) ...)) 3) ;; should be string ((:get-options) 3) 00009b(:return (:ok ((:show-implicits :False) .. (:editor "vim"))) 3) ;; stay same ```
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.
Note:
I acknowledge the AI contributing policy and made the changes primarily on own but I did consulted AI and been guided by it to make this change correctly.
Previously, the IDE command
:version(viainterpret) reusedShowVersionand returned a structured S-expression containing semantic version components and commit hash.As
idris-modeexpects for output of:interpretcommand to be always a string. This leads to bad user experience on commands that return S-expression. See: idris-hackers/idris-mode#661 and idris-hackers/idris-mode#662This introduces a dedicated
VersionSExpconstructor inIDEResultand updatesprocess Versionto return the rawversionvalue directly.The IDE mode now distinguishes between:
REPL (VersionIs x)-> structuredAVersion(unchanged)VersionSExp x-> formatted string viashowVersionAs a result,
:versionin IDE interpret mode now produces a human-readable string (e.g. "0.8.0-") instead of a structured tuple.Before:
After:
Next steps:
Update
:optscommand in similar way.Description
Self-check
CONTRIBUTING.mdand I've updated
CONTRIBUTORSwith my name.implementation, I have updated
CHANGELOG_NEXT.md