From f909b20c540ea99dddfd04b8439ee35b8dd703b8 Mon Sep 17 00:00:00 2001 From: Akshay Date: Wed, 27 Oct 2021 17:10:42 +0530 Subject: allow stdin input to statix-single, vim plugin --- lib/src/lib.rs | 7 +++++++ 1 file changed, 7 insertions(+) (limited to 'lib') diff --git a/lib/src/lib.rs b/lib/src/lib.rs index 41e38c8..c2f24c6 100644 --- a/lib/src/lib.rs +++ b/lib/src/lib.rs @@ -56,6 +56,13 @@ impl Report { .flat_map(|d| Some(d.suggestion.as_ref()?.at)) .reduce(|acc, next| acc.cover(next)) } + /// A range that encompasses all the diagnostics provided in this report + pub fn total_diagnostic_range(&self) -> Option { + self.diagnostics + .iter() + .flat_map(|d| Some(d.at)) + .reduce(|acc, next| acc.cover(next)) + } /// Unsafe but handy replacement for above pub fn range(&self) -> TextRange { self.total_suggestion_range().unwrap() -- cgit v1.2.3