Teach Diagnostics to highlight text by estebank · Pull Request #38955 · rust-lang/rust (original) (raw)

This isn't necessarily in conflict, is it?

True, @nikomatsakis.

Given that the current json output in this PR for the epected note is:

{ "message": "expected type usize\n found type &'static str", "code":null, "level":"note", "spans":[], "children":[], "rendered":null }

Would it make sense to turn it into

{ "message": "expected type usize\n found type &'static str", "message_highlights": [ {"start": 15, "end": 20}, {"start": 37, "end": 49}, ], "code":null, "level":"note", "spans":[], "children":[], "rendered":null }

or, more closely to what @nrc advocates:

{ "message": "expected type usize\n found type &'static str", "message_annotations": [ {"start": 15, "end": 20, "type": "type", "content": "usize"}, {"start": 37, "end": 49, "type": "type", "content": "&'static str"}, ], "code":null, "level":"note", "spans":[], "children":[], "rendered":null }