Skip to content

Commit 1173138

Browse files
phijor4e554c4c
authored andcommitted
Get Agda version via interaction mode
1 parent 72382c5 commit 1173138

File tree

3 files changed

+10
-0
lines changed

3 files changed

+10
-0
lines changed

src/Cornelis/Types.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -317,6 +317,7 @@ data DisplayInfo
317317
| IntroConstructorUnknown [Text]
318318
| WhyInScope Text
319319
| NormalForm Text
320+
| Version Text
320321
| UnknownDisplayInfo Value
321322
deriving (Eq, Ord, Show, Generic)
322323

@@ -365,6 +366,7 @@ instance FromJSON DisplayInfo where
365366
InferredType <$> info .: "expr"
366367
(_ :: Text) ->
367368
pure $ UnknownDisplayInfo v
369+
"Version" -> Version <$> obj .: "version"
368370
(_ :: Text) -> pure $ UnknownDisplayInfo v
369371

370372
instance FromJSON Response where

src/Lib.hs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@ getInteractionPoint b i = gets $ preview $ #cs_buffers . ix b . #bs_ips . ix i
4242

4343
respondToHelperFunction :: DisplayInfo -> Neovim env ()
4444
respondToHelperFunction (HelperFunction sig) = setreg "\"" sig
45+
respondToHelperFunction (Version ver) = reportInfo ver
4546
respondToHelperFunction _ = pure ()
4647

4748

@@ -222,6 +223,7 @@ cornelis = do
222223
, $(command "CornelisQuestionToMeta" 'doQuestionToMeta) [CmdSync Async]
223224
, $(command "CornelisInc" 'doIncNextDigitSeq) [CmdSync Async]
224225
, $(command "CornelisDec" 'doDecNextDigitSeq) [CmdSync Async]
226+
, $(command "CornelisAgdaVersion" 'doGetVersion) [CmdSync Async]
225227
, $(command "CornelisDebug" 'doDebug) [CmdSync Async, debug_complete]
226228
, $(command "CornelisCloseInfoWindows" 'doCloseInfoWindows) [CmdSync Sync]
227229
, $(function "InternalCornelisRewriteModeCompletion" 'rewriteModeCompletion) Sync

src/Plugin.hs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -330,6 +330,12 @@ caseSplit thing = withAgda $ void $ withGoalAtCursor $ \b ip -> do
330330
(mkAbsPathRnage fp $ ip_interval' ip)
331331
$ T.unpack thing
332332

333+
getVersion :: Neovim CornelisEnv ()
334+
getVersion = withAgda $ void $ withCurrentBuffer $ getAgda >=> runIOTCM Cmd_show_version
335+
336+
doGetVersion :: CommandArguments -> Neovim CornelisEnv ()
337+
doGetVersion = const getVersion
338+
333339
doQuestionToMeta :: CommandArguments -> Neovim CornelisEnv ()
334340
doQuestionToMeta _ = withCurrentBuffer questionToMeta
335341

0 commit comments

Comments
 (0)