-
Couldn't load subscription status.
- Fork 960
Closed
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEP-highHigh priorityHigh priority
Milestone
Description
This surfaced at rust-lang/rls#1463 (fixed in rust-lang/rls#1497).
The underlying data structure discerns a missing/"all" state in addition to actual set (possibly empty) of lines:
rustfmt/src/config/file_lines.rs
Lines 151 to 157 in 26d370e
| /// A set of lines in files. | |
| /// | |
| /// It is represented as a multimap keyed on file names, with values a collection of | |
| /// non-overlapping ranges sorted by their start point. An inner `None` is interpreted to mean all | |
| /// lines in all files. | |
| #[derive(Clone, Debug, Default, PartialEq)] | |
| pub struct FileLines(Option<HashMap<FileName, Vec<Range>>>); |
whereas to_json_span only encodes a specified set of those changes (can't represent FileLines(None)):
rustfmt/src/config/file_lines.rs
Lines 218 to 221 in 26d370e
| /// Returns JSON representation as accepted by the `--file-lines JSON` arg. | |
| pub fn to_json_spans(&self) -> Vec<JsonSpan> { | |
| match &self.0 { | |
| None => vec![], |
I think we should either:
- panic/return err on
Nonematch into_json_spans(sincevec![]returned forFileLines(None)won't be parsed back into theFileLines(None)but ratherFileLines(Some(HashMap::new)) - Somehow discern or accept
nulllines in--file-lines JSONand maketo_json_spans()returnOption<Vec<JsonSpan>>
Thoughts?
ljw1004
Metadata
Metadata
Assignees
Labels
C-bugCategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICECategory: this is a bug; use also I-* labels for specific bug kinds, e.g. I-non-idempotency or I-ICEP-highHigh priorityHigh priority