Introduce machine-readable manifest diagnostics#3127
Conversation
|
This change is part of the following stack: Change managed by git-spice. |
fcffdb8 to
e5a6b47
Compare
e5a6b47 to
91b68f5
Compare
| }) | ||
| .unwrap_or(MachineDiagnosticSpan { start: 0, end: 0 }), | ||
| ); | ||
| diagnostic.related = related |
There was a problem hiding this comment.
nitpick: maybe use a builder pattern instead? could get rid of setting the defaults too.
| span, | ||
| related, | ||
| })); | ||
| config.ui().force_print(MachineMessage(diagnostic)); |
There was a problem hiding this comment.
nitpick: could be just Message impl for MachineDiagnostic.
| } | ||
| } | ||
|
|
||
| pub fn all_crate_inputs(db: &dyn Database) -> Vec<CrateInput> { |
| start: span.start, | ||
| end: span.end, | ||
| }) | ||
| .unwrap_or(MachineDiagnosticSpan { start: 0, end: 0 }), |
There was a problem hiding this comment.
Should this be default for MachineDiagnosticSpan?
There was a problem hiding this comment.
+1, if the span is no longer an Option, the 0,0 span should be set as a default
| } | ||
|
|
||
| #[derive(Debug, Clone, Serialize)] | ||
| pub struct MachineRelatedLocation { |
There was a problem hiding this comment.
nit
| pub struct MachineRelatedLocation { | |
| pub struct MachineDiagnosticRelatedLocation { |
| } | ||
|
|
||
| #[derive(Debug, Clone, Serialize)] | ||
| pub struct MachineDiagnosticData { |
wawel37
left a comment
There was a problem hiding this comment.
Seems fine, some small nit picks only
| start: span.start, | ||
| end: span.end, | ||
| }) | ||
| .unwrap_or(MachineDiagnosticSpan { start: 0, end: 0 }), |
There was a problem hiding this comment.
+1, if the span is no longer an Option, the 0,0 span should be set as a default
| MachineDiagnosticKind::ManifestDiagnostic, | ||
| sem.to_string(), | ||
| MachineDiagnosticSeverity::Error, | ||
| file.unwrap_or_else(|| "<unknown>".to_string()), |
There was a problem hiding this comment.
nit: i'd assign the <unknown> string to some consts and have it named properly, so its clear it describes "no file" state
No description provided.