on master help sign in
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

commitb7e7ae5692163f9d6a20c5171ea4cdde2aefa6c8 authorNeil Mitchell <35463327+neil-da@users.noreply.github.com> dateFri 3 May 2019, 12:49 (7 years ago) parenta410abc
1 file changed+2−11
src/Development/IDE/Types/Diagnostics.hs+2−11
src/Development/IDE/Types/Diagnostics.hs+2−11
@@ -161,17 +161,8 @@ ideTryIOException fp act =
161161type FileDiagnostics = (Uri, [Diagnostic])
162162
163163prettyRange :: Range -> Doc SyntaxClass
164−prettyRange Range{..} =
165− slabel_ "Range" $ vcat
166− [ slabel_ "Start:" $ prettyPosition _start
167− , slabel_ "End: " $ prettyPosition _end
168− ]
169−
170−prettyPosition :: Position -> Doc SyntaxClass
171−prettyPosition Position{..} = slabel_ "Position" $ vcat
172− [ slabel_ "Line:" $ pretty _line
173− , slabel_ "Character:" $ pretty _character
174− ]
164+prettyRange Range{..} = f _start <> "-" <> f _end
165+ where f Position{..} = pretty (_line+1) <> colon <> pretty _character
175166
176167stringParagraphs :: T.Text -> Doc a
177168stringParagraphs = vcat . map (fillSep . map pretty . T.words) . T.lines