mirror of
https://github.com/nerdypepper/statix.git
synced 2024-08-16 17:00:27 +03:00
improve json output for suggestions, bump to v0.2.5
This commit is contained in:
parent
6e8dd004ea
commit
c3cede18c9
2
Cargo.lock
generated
2
Cargo.lock
generated
@ -388,7 +388,7 @@ checksum = "b203e79e90905594272c1c97c7af701533d42adaab0beb3859018e477d54a3b0"
|
||||
|
||||
[[package]]
|
||||
name = "statix"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
dependencies = [
|
||||
"ariadne",
|
||||
"clap",
|
||||
|
@ -1,6 +1,6 @@
|
||||
[package]
|
||||
name = "statix"
|
||||
version = "0.2.4"
|
||||
version = "0.2.5"
|
||||
edition = "2018"
|
||||
license = "MIT"
|
||||
authors = [ "Akshay <nerdy@peppe.rs>" ]
|
||||
|
@ -118,7 +118,6 @@ mod json {
|
||||
|
||||
use std::io::{self, Write};
|
||||
|
||||
use lib::Suggestion;
|
||||
use rnix::TextRange;
|
||||
use serde::Serialize;
|
||||
use serde_json;
|
||||
@ -142,7 +141,13 @@ mod json {
|
||||
struct JsonDiagnostic<'μ> {
|
||||
at: JsonSpan,
|
||||
message: &'μ String,
|
||||
suggestion: &'μ Option<Suggestion>,
|
||||
suggestion: Option<JsonSuggestion>,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
struct JsonSuggestion {
|
||||
at: JsonSpan,
|
||||
fix: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize)]
|
||||
@ -193,7 +198,10 @@ mod json {
|
||||
.map(|d| JsonDiagnostic {
|
||||
at: JsonSpan::from_textrange(d.at, src),
|
||||
message: &d.message,
|
||||
suggestion: &d.suggestion,
|
||||
suggestion: d.suggestion.as_ref().map(|s| JsonSuggestion {
|
||||
at: JsonSpan::from_textrange(s.at, src),
|
||||
fix: s.fix.to_string(),
|
||||
}),
|
||||
})
|
||||
.collect::<Vec<_>>();
|
||||
JsonReport {
|
||||
|
Loading…
Reference in New Issue
Block a user