@@ -1551,21 +1551,6 @@ parseImports fname input
1551 shebang :: IdrisParser ()
1551 shebang :: IdrisParser ()
1552 shebang = string "#!" *> many (P.satisfy $ not . isEol) *> eol *> pure ()
1552 shebang = string "#!" *> many (P.satisfy $ not . isEol) *> eol *> pure ()
1554−-- | There should be a better way of doing this...
1555−findFC :: PP.Doc -> (FC, String)
1556−findFC x = let s = show (PP.plain x) in findFC' s
1557− where findFC' s = case span (/= ':') s of
1558− -- Horrid kludge to prevent crashes on Windows
1559− (prefix, ':':'\\':rest) ->
1560− case findFC' rest of
1561− (NoFC, msg) -> (NoFC, msg)
1562− (FileFC f, msg) -> (FileFC (prefix ++ ":\\" ++ f), msg)
1563− (FC f start end, msg) -> (FC (prefix ++ ":\\" ++ f) start end, msg)
1564− (failname, ':':rest) -> case span isDigit rest of
1565− (line, ':':rest') -> case span isDigit rest' of
1566− (col, ':':msg) -> let pos = (read line, read col) in
1567− (FC failname pos pos, msg)
1569-- | Check if the coloring matches the options and corrects if necessary
1554-- | Check if the coloring matches the options and corrects if necessary
1570fixColour :: Bool -> PP.Doc -> PP.Doc
1555fixColour :: Bool -> PP.Doc -> PP.Doc
1571fixColour False doc = PP.plain doc
1556fixColour False doc = PP.plain doc
@@ -1577,15 +1562,11 @@ parseProg :: SyntaxInfo -> FilePath -> String -> Maybe ParseState -> Idris [PDec
1577parseProg syn fname input mrk
1562parseProg syn fname input mrk
1578 = do i <- getIState
1563 = do i <- getIState
1579 case runparser mainProg i fname input of
1564 case runparser mainProg i fname input of
1580− Left err -> do -- FIXME: Get error location from trifecta
1565+ Left err -> do let fc = parseErrorFC err
1581− -- this can't be the solution!
1582− -- Issue #1575 on the issue tracker.
1583− -- https://github.com/idris-lang/Idris-dev/issues/1575
1584− let (fc, msg) = findFC $ parseErrorDoc err
1585 i <- getIState
1566 i <- getIState
1586 case idris_outputmode i of
1567 case idris_outputmode i of
1587 RawOutput h -> iputStrLn (show . fixColour (idris_colourRepl i) . parseErrorDoc $ err)
1568 RawOutput h -> iputStrLn (show . fixColour (idris_colourRepl i) . parseErrorDoc $ err)
1588− IdeMode n h -> iWarn fc (Util.Pretty.text msg)
1569+ IdeMode n h -> iWarn fc (Util.Pretty.text $ parseErrorMessage err)
1589 putIState (i { errSpan = Just fc })
1570 putIState (i { errSpan = Just fc })
1590 return []
1571 return []
1591 Right (x, i) -> do putIState i
1572 Right (x, i) -> do putIState i