diff options
Diffstat (limited to 'lib/src/lib.rs')
-rw-r--r-- | lib/src/lib.rs | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 4374ac7..6bb16b6 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs | |||
@@ -42,6 +42,13 @@ impl Report { | |||
42 | .push(Diagnostic::suggest(at, message, suggestion)); | 42 | .push(Diagnostic::suggest(at, message, suggestion)); |
43 | self | 43 | self |
44 | } | 44 | } |
45 | /// A range that encompasses all the suggestions provided in this report | ||
46 | pub fn total_suggestion_range(&self) -> Option<TextRange> { | ||
47 | self.diagnostics | ||
48 | .iter() | ||
49 | .flat_map(|d| Some(d.suggestion.as_ref()?.at)) | ||
50 | .reduce(|acc, next| acc.cover(next)) | ||
51 | } | ||
45 | } | 52 | } |
46 | 53 | ||
47 | /// Mapping from a bytespan to an error message. | 54 | /// Mapping from a bytespan to an error message. |