The following information would be included. The key idea is that we have both logical and presentation information. The logical information is basically what we have today: it describes what errors occur and where. The presentation information would be a "richly formatted" version of rustc's output. The idea would be that if you just emit the presentation information for an error, you get back exactly what rustc outputs (but you have to supply the ansi colors).
-
Diagnostic
- Logical:
- message ("mismatched types")
- labels (
vec<(Span, Option<String>, is_primary: bool)>
)- span: foo
- span: bar
- suggestions (
vec<(Span, String)>
)?- the string is alternative source code, not a label
- error code ("E0123", explanation)
- Subdiagnostics:
Vec<Logical>
- presentation:
Vec<PresentationLine>
- Logical:
-
Span:
- Start Point
- End Point
- plain text:
Vec<String>
- but: maybe crosses files?
-
Point:
- filename byte / line / column
-
PresentationLine
Option<Point>
- Bare text (String)
Vec<StyleSpan>
-
StyleSpan:
- column start
- column end
- style: choice of
- filename
- line-number
- primary carrot
- secondary dash
- elision
- primary-label
- second-label
- etc.
RenderedLineKind: - source text - highlights - elision