Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis nikomatsakis/json-proposal.md Secret
Last active May 9, 2016

Embed
What would you like to do?
json-proposal

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>
  • 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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.