@@ -24,8 +24,8 @@ module Development.IDE.Types.Diagnostics (
2424 ideErrorPretty,
2525 errorDiag,
2626 ideTryIOException,
27− prettyFileDiagnostics,
28− prettyDiagnostic,
27+ showDiagnostics,
28+ showDiagnosticsColored,
2929 prettyDiagnosticStore,
3030 defDiagnostic,
3131 addDiagnostics,
@@ -162,35 +162,45 @@ type FileDiagnostics = (Uri, [Diagnostic])
162162
163163prettyRange :: Range -> Doc SyntaxClass
164164prettyRange Range{..} =
165− label_ "Range" $ vcat
166− [ label_ "Start:" $ prettyPosition _start
167− , label_ "End: " $ prettyPosition _end
165+ slabel_ "Range" $ vcat
166+ [ slabel_ "Start:" $ prettyPosition _start
167+ , slabel_ "End: " $ prettyPosition _end
168168 ]
169169
170170prettyPosition :: Position -> Doc SyntaxClass
171−prettyPosition Position{..} = label_ "Position" $ vcat
172− [ label_ "Line:" $ pretty _line
173− , label_ "Character:" $ pretty _character
171+prettyPosition Position{..} = slabel_ "Position" $ vcat
172+ [ slabel_ "Line:" $ pretty _line
173+ , slabel_ "Character:" $ pretty _character
174174 ]
175175
176176stringParagraphs :: T.Text -> Doc a
177177stringParagraphs = vcat . map (fillSep . map pretty . T.words) . T.lines
178178
179+showDiagnostics :: [LSP.Diagnostic] -> T.Text
180+showDiagnostics = srenderPlain . prettyDiagnostics
181+
182+showDiagnosticsColored :: [LSP.Diagnostic] -> T.Text
183+showDiagnosticsColored = srenderColored . prettyDiagnostics
184+
185+
186+prettyDiagnostics :: [LSP.Diagnostic] -> Doc SyntaxClass
187+prettyDiagnostics = vcat . map prettyDiagnostic
188+
179189prettyDiagnostic :: LSP.Diagnostic -> Doc SyntaxClass
180190prettyDiagnostic LSP.Diagnostic{..} =
181191 vcat
182− [label_ "Range: "
192+ [slabel_ "Range: "
183193 $ prettyRange _range
184− , label_ "Source: " $ pretty _source
185− , label_ "Severity:" $ pretty $ show sev
186− , label_ "Message: "
194+ , slabel_ "Source: " $ pretty _source
195+ , slabel_ "Severity:" $ pretty $ show sev
196+ , slabel_ "Message: "
187197 $ case sev of
188198 LSP.DsError -> annotate ErrorSC
189199 LSP.DsWarning -> annotate WarningSC
190200 LSP.DsInfo -> annotate InfoSC
191201 LSP.DsHint -> annotate HintSC
192202 $ stringParagraphs _message
193− , label_ "Code:" $ pretty _code
203+ , slabel_ "Code:" $ pretty _code
194204 ]
195205 where
196206 sev = fromMaybe LSP.DsError _severity
@@ -204,18 +214,18 @@ prettyDiagnosticStore ds =
204214
205215prettyFileDiagnostics :: FileDiagnostics -> Doc SyntaxClass
206216prettyFileDiagnostics (uri, diags) =
207− label_ "Compiler error in" $ vcat
208− [ label_ "File:" $ pretty filePath
209− , label_ "Errors:" $ vcat $ map prettyDiagnostic diags
217+ slabel_ "Compiler error in" $ vcat
218+ [ slabel_ "File:" $ pretty filePath
219+ , slabel_ "Errors:" $ vcat $ map prettyDiagnostic diags
210220 ] where
211221
212222 -- prettyFileDiags :: (FilePath, [(T.Text, [LSP.Diagnostic])]) -> Doc SyntaxClass
213223 -- prettyFileDiags (fp,stages) =
214− -- label_ ("File: "<>fp) $ vcat $ map prettyStage stages
224+ -- slabel_ ("File: "<>fp) $ vcat $ map prettyStage stages
215225
216226 -- prettyStage :: (T.Text, [LSP.Diagnostic]) -> Doc SyntaxClass
217227 -- prettyStage (stage,diags) =
218− -- label_ ("Stage: "<>T.unpack stage) $ vcat $ map prettyDiagnostic diags
228+ -- slabel_ ("Stage: "<>T.unpack stage) $ vcat $ map prettyDiagnostic diags
219229
220230 filePath :: FilePath
221231 filePath = fromMaybe dontKnow $ uriToFilePath uri