on master help sign in
Merge pull request #545 from david-christiansen/issue/526

Check for file extension in :e

commit1aa559f0062dc4a7c5959ed676c0e9122863b34c authorEdwin Brady <edwin.brady@gmail.com> dateFri 18 Oct 2013, 04:11 (13 years ago) parentf185e63ce75a23
1 file changed+4−1
src/Idris/REPL.hs+4−1
src/Idris/REPL.hs+4−1
@@ -280,7 +280,7 @@ edit f orig
280280 let line = case errLine i of
281281 Just l -> " +" ++ show l ++ " "
282282 Nothing -> " "
283− let cmd = editor ++ line ++ f
283+ let cmd = editor ++ line ++ fixName f
284284 runIO $ system cmd
285285 clearErr
286286 putIState $ orig { idris_options = idris_options i
@@ -292,6 +292,9 @@ edit f orig
292292 where getEditor env | Just ed <- lookup "EDITOR" env = ed
293293 | Just ed <- lookup "VISUAL" env = ed
294294 | otherwise = "vi"
295+ fixName file | map toLower (takeExtension file) `elem` [".lidr", ".idr"] = file
296+ | otherwise = addExtension file "idr"
297+
295298
296299
297300proofs :: IState -> Idris ()