diff --git a/src/Idris/Output.hs b/src/Idris/Output.hs index f1f2041e2..0d030bd4c 100644 --- a/src/Idris/Output.hs +++ b/src/Idris/Output.hs @@ -90,7 +90,7 @@ iWarn fc err = else Nothing where sourceLine :: Maybe String - sourceLine = listToMaybe . drop (si - 1) . lines $ src + sourceLine = listToMaybe . drop (si - 1) . (++ [""]) . lines $ src haveSource :: Bool haveSource = isJust sourceLine diff --git a/src/Idris/Parser.hs b/src/Idris/Parser.hs index f7f2e8112..d707ec098 100644 --- a/src/Idris/Parser.hs +++ b/src/Idris/Parser.hs @@ -1519,10 +1519,8 @@ parseProg syn fname input mrk = do i <- getIState case runparser mainProg i fname input of Left err -> do let fc = errorExtent err + iWarn fc (Util.Pretty.string $ errorMessage err) i <- getIState - case idris_outputmode i of - RawOutput h -> iputStrLn (show . fixColour (idris_colourRepl i) . parseErrorDoc $ err) - IdeMode n h -> iWarn fc (Util.Pretty.text $ errorMessage err) putIState (i { errSpan = Just fc }) return [] Right (x, i) -> do putIState i diff --git a/src/Idris/Parser/Stack.hs b/src/Idris/Parser/Stack.hs index 146742d80..69395083d 100644 --- a/src/Idris/Parser/Stack.hs +++ b/src/Idris/Parser/Stack.hs @@ -72,7 +72,7 @@ errorExtent (ParseError _ err) = sourcePositionFC pos -- | A single-line parse error message, including location. errorMessage :: ParseError -> String -errorMessage (ParseError _ err) = P.parseErrorTextPretty err +errorMessage (ParseError _ err) = init (P.parseErrorTextPretty err) -- | A fully formatted parse error, with caret and bar, etc. prettyError :: ParseError -> String diff --git a/test/layout001/expected b/test/layout001/expected index 356f54458..ac378445b 100644 --- a/test/layout001/expected +++ b/test/layout001/expected @@ -1,58 +1,58 @@ -./layout001a.idr:5:1: +layout001a.idr:5:1: | 5 | y | ^ Wrong indention: should be greater than context indentation -./layout001b.idr:5:3: +layout001b.idr:5:3: | 5 | = y | ^ Wrong indention: should be greater than context indentation -./layout001c.idr:3:1: +layout001c.idr:3:1: | 3 | 2 | ^ Wrong indention: should be greater than context indentation -./layout001e.idr:6:1: +layout001e.idr:6:1: | 6 | 3 | ^ Wrong indention: should be greater than context indentation -./layout001f.idr:6:2: +layout001f.idr:6:2: | 6 | 3 | ^ Wrong indention: should be greater than context indentation -./layout001g.idr:6:3: +layout001g.idr:6:3: | 6 | 3 | ^ Wrong indention: should be greater than context indentation -./layout001h.idr:6:3: +layout001h.idr:6:3: | 6 | 3 | ^ Wrong indention: should be greater than context indentation -./layout001i.idr:6:4: +layout001i.idr:6:4: | 6 | 3 | ^ Wrong indention: should be greater than context indentation -./layout001j.idr:6:5: +layout001j.idr:6:5: | 6 | 3 | ^ Wrong indention: should be greater than context indentation -./layout001l.idr:6:1: +layout001l.idr:6:1: | 6 | y | ^ @@ -68,7 +68,7 @@ When checking right hand side of term with expected type When checking an application of function Prelude.Applicative.pure: No such variable f -./mplus2.idr:17:37: +mplus2.idr:17:37: | 17 | `mplus` pure f | ^ diff --git a/test/regression002/expected b/test/regression002/expected index 086284eb0..91a461b5f 100644 --- a/test/regression002/expected +++ b/test/regression002/expected @@ -182,13 +182,13 @@ When checking right hand side of uhOh with expected type No such variable Bogus -./badbangop.idr:7:1: +badbangop.idr:7:1: | 7 | (!) : List a -> Nat -> Maybe a | ^ ! is not a valid operator -./baddoublebang.idr:6:28: +baddoublebang.idr:6:28: | 6 | doubleBang mmn = do pure !!mmn | ^ @@ -308,15 +308,15 @@ reg070.idr:7:1-7: | ~~~~~~~ Test_show.Te implementation of Prelude.Show.Show is possibly not total due to: Prelude.Show.Test_show.Te implementation of Prelude.Show.Show, method show -./reg076.idr:8:1: +reg076.idr:8:1: | -8 | +8 | | ^ Missing fixity declaration for Main.:> -./reg077.idr:3:1: +reg077.idr:3:1: | -3 | +3 | | ^ Missing fixity declaration for Main.:>>