Skip to content

Commit 41b7d5e

Browse files
authored
Merge pull request #156 from iwashis/master
autoOne functionality update for Agda v2.7.0 and up
2 parents 06d6020 + 80059af commit 41b7d5e

File tree

3 files changed

+15
-13
lines changed

3 files changed

+15
-13
lines changed

src/Cornelis/Types/Agda.hs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,8 @@ data Interaction' range
136136
| Cmd_solveOne Rewrite InteractionId range String
137137

138138
-- | Solve (all goals / the goal at point) by using Auto.
139-
| Cmd_autoOne InteractionId range String
140-
| Cmd_autoAll
139+
| Cmd_autoOne Rewrite InteractionId range String
140+
| Cmd_autoAll Rewrite
141141

142142
-- | Parse the given expression (as if it were defined at the
143143
-- top-level of the current module) and infer its type.

src/Lib.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -205,7 +205,7 @@ cornelis = do
205205
, $(command "CornelisLoad" 'doLoad) [CmdSync Async]
206206
, $(command "CornelisGoals" 'doAllGoals) [CmdSync Async]
207207
, $(command "CornelisSolve" 'solveOne) [CmdSync Async, rw_complete]
208-
, $(command "CornelisAuto" 'autoOne) [CmdSync Async]
208+
, $(command "CornelisAuto" 'autoOne) [CmdSync Async, rw_complete]
209209
, $(command "CornelisTypeInfer" 'doTypeInfer) [CmdSync Async]
210210
, $(command "CornelisTypeContext" 'typeContext) [CmdSync Async, rw_complete]
211211
, $(command "CornelisTypeContextInfer" 'typeContextInfer) [CmdSync Async, rw_complete]

src/Plugin.hs

Lines changed: 12 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -150,16 +150,18 @@ solveOne _ ms = withNormalizationMode ms $ \mode ->
150150
(mkAbsPathRnage fp $ ip_interval' ip)
151151
""
152152

153-
autoOne :: CommandArguments -> Neovim CornelisEnv ()
154-
autoOne _ = withAgda $ void $ withGoalAtCursor $ \b ip -> do
155-
agda <- getAgda b
156-
t <- getGoalContents b ip
157-
fp <- buffer_get_name b
158-
flip runIOTCM agda $
159-
Cmd_autoOne
160-
(ip_id ip)
161-
(mkAbsPathRnage fp $ ip_interval' ip)
162-
(T.unpack t)
153+
autoOne :: CommandArguments -> Maybe String -> Neovim CornelisEnv ()
154+
autoOne _ ms = withNormalizationMode ms $ \mode ->
155+
withAgda $ void $ withGoalAtCursor $ \b ip -> do
156+
agda <- getAgda b
157+
t <- getGoalContents b ip
158+
fp <- buffer_get_name b
159+
flip runIOTCM agda $
160+
Cmd_autoOne
161+
mode
162+
(ip_id ip)
163+
(mkAbsPathRnage fp $ ip_interval' ip)
164+
(T.unpack t)
163165

164166
withNormalizationMode :: Maybe String -> (Rewrite -> Neovim e ()) -> Neovim e ()
165167
withNormalizationMode Nothing f = normalizationMode >>= f

0 commit comments

Comments
 (0)