on master help sign in
Fix recognition of infix names in IDE mode
commit058b23d18a4b099e698909a27769185859f2bbd6 authorDavid Raymond Christiansen <david@davidchristiansen.dk> dateWed 14 Jan 2015, 17:59 (12 years ago) parent1784f06
1 file changed+5−12
src/Idris/REPL.hs+5−12
src/Idris/REPL.hs+5−12
@@ -331,11 +331,6 @@ runIdeSlaveCommand h id orig fn mods (IdeSlave.TypeOf name) =
331331 Left err -> iPrintError err
332332 Right n -> process "(ideslave)"
333333 (Check (PRef (FC "(ideslave)" (0,0) (0,0)) n))
334− where splitName :: String -> Either String Name
335− splitName s = case reverse $ splitOn "." s of
336− [] -> Left ("Didn't understand name '" ++ s ++ "'")
337− [n] -> Right $ sUN n
338− (n:ns) -> Right $ sNS (sUN n) ns
339334runIdeSlaveCommand h id orig fn mods (IdeSlave.DocsFor name) =
340335 case parseConst orig name of
341336 Success c -> process "(ideslave)" (DocStr (Right c))
@@ -487,11 +482,6 @@ runIdeSlaveCommand h id orig fn mods (IdeSlave.PrintDef name) =
487482 case splitName name of
488483 Left err -> iPrintError err
489484 Right n -> process "(ideslave)" (PrintDef n)
490− where splitName :: String -> Either String Name
491− splitName s = case reverse $ splitOn "." s of
492− [] -> Left ("Didn't understand name '" ++ s ++ "'")
493− [n] -> Right $ sUN n
494− (n:ns) -> Right $ sNS (sUN n) ns
495485runIdeSlaveCommand h id orig fn modes (IdeSlave.ErrString e) =
496486 do ist <- getIState
497487 let out = displayS . renderPretty 1.0 60 $ pprintErr ist e
@@ -523,8 +513,11 @@ ideSlaveForceTermImplicits h id bnd impl tm =
523513splitName :: String -> Either String Name
524514splitName s = case reverse $ splitOn "." s of
525515 [] -> Left ("Didn't understand name '" ++ s ++ "'")
526− [n] -> Right $ sUN n
527− (n:ns) -> Right $ sNS (sUN n) ns
516+ [n] -> Right . sUN $ unparen n
517+ (n:ns) -> Right $ sNS (sUN (unparen n)) ns
518+ where unparen "" = ""
519+ unparen ('(':x:xs) | last xs == ')' = init (x:xs)
520+ unparen str = str
528521
529522ideslaveProcess :: FilePath -> Command -> Idris ()
530523ideslaveProcess fn Warranty = process fn Warranty