Fix prettyRange so it prints ranges like it used to (#882)

Before it was garbled and wrong:
Range:    Range Start: Position Line: 2Character: 15End:   Position Line: 2Character: 15

After it's correct and like it was before:
Range:    3:15-3:17
This commit is contained in:
Neil Mitchell 2019-05-03 12:49:51 +01:00 committed by GitHub
parent a410abc82c
commit b7e7ae5692

View File

@ -161,17 +161,8 @@ ideTryIOException fp act =
type FileDiagnostics = (Uri, [Diagnostic])
prettyRange :: Range -> Doc SyntaxClass
prettyRange Range{..} =
slabel_ "Range" $ vcat
[ slabel_ "Start:" $ prettyPosition _start
, slabel_ "End: " $ prettyPosition _end
]
prettyPosition :: Position -> Doc SyntaxClass
prettyPosition Position{..} = slabel_ "Position" $ vcat
[ slabel_ "Line:" $ pretty _line
, slabel_ "Character:" $ pretty _character
]
prettyRange Range{..} = f _start <> "-" <> f _end
where f Position{..} = pretty (_line+1) <> colon <> pretty _character
stringParagraphs :: T.Text -> Doc a
stringParagraphs = vcat . map (fillSep . map pretty . T.words) . T.lines