ekmett / trifecta

Parser combinators with highlighting, slicing, layout, literate comments, Clang-style diagnostics and the kitchen sink
http://ekmett.github.com/trifecta/
Other
298 stars 49 forks source link

Fixits don't render properly #2

Open thoughtpolice opened 13 years ago

thoughtpolice commented 13 years ago

Consider the following snippet:

{-# LANGUAGE OverloadedStrings #-}
module Main where
import Text.Trifecta
import Data.ByteString.Char8()

main :: IO ()
main = parseTest p "hello"
  where p = do
          string "h"
          (_ :~ s) <- spanned $ string "ello"
          warnAt [] "Fix this" $ render $ Fixit s "should be OMFGLOLOL"

When run it gives this output:

$ runghc trifecta.hs
(interactive):1:2: warning: Fix this
hello<EOF> 
 ~~~~      
 should be>
()

You would normally expect the fixit string to be as long as necessary.

ekmett commented 11 years ago

I'm still open to improving this. It just needs the rendering logic to be smart enough to take into account those longer lines.