Skip to content

Instantly share code, notes, and snippets.

@nikomatsakis
Last active May 9, 2016 12:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nikomatsakis/3ad1306ace259cb22404e8d8abbd73a8 to your computer and use it in GitHub Desktop.
Save nikomatsakis/3ad1306ace259cb22404e8d8abbd73a8 to your computer and use it in GitHub Desktop.
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