From 73836cdbbc928f3512156f0bc0166e5a39ad9864 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Sun, 20 Jan 2019 21:05:01 +0300 Subject: extend selection expands macros and can totally panic --- crates/ra_ide_api/src/extend_selection.rs | 2 +- crates/ra_ide_api/src/lib.rs | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_api') diff --git a/crates/ra_ide_api/src/extend_selection.rs b/crates/ra_ide_api/src/extend_selection.rs index 9f0ab2f1c..718b4def5 100644 --- a/crates/ra_ide_api/src/extend_selection.rs +++ b/crates/ra_ide_api/src/extend_selection.rs @@ -51,7 +51,7 @@ mod tests { } ", ); - let r = analysis.extend_selection(frange); + let r = analysis.extend_selection(frange).unwrap(); assert_eq!(r, TextRange::from_to(51.into(), 56.into())); } } diff --git a/crates/ra_ide_api/src/lib.rs b/crates/ra_ide_api/src/lib.rs index e41d85e70..919d248e2 100644 --- a/crates/ra_ide_api/src/lib.rs +++ b/crates/ra_ide_api/src/lib.rs @@ -310,8 +310,8 @@ impl Analysis { } /// Selects the next syntactic nodes encopasing the range. - pub fn extend_selection(&self, frange: FileRange) -> TextRange { - extend_selection::extend_selection(&self.db, frange) + pub fn extend_selection(&self, frange: FileRange) -> Cancelable { + self.with_db(|db| extend_selection::extend_selection(db, frange)) } /// Returns position of the mathcing brace (all types of braces are -- cgit v1.2.3