diff options
author | Akshay <[email protected]> | 2021-10-19 11:30:03 +0100 |
---|---|---|
committer | Akshay <[email protected]> | 2021-10-19 11:30:03 +0100 |
commit | d666cfa6b1739ac17d080790068e31eb26bb9c4a (patch) | |
tree | 814ffd195695ca5e10aef49039be83995127f366 /lib/src/lib.rs | |
parent | 214e3bc4b675b08ce4df76b1373f4548949e67ee (diff) |
rework few error messages
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. |