extend selection expands macros and can totally panic

This commit is contained in:
Aleksey Kladov 2019-01-20 21:05:01 +03:00
parent 171f6e6d00
commit 73836cdbbc
3 changed files with 11 additions and 7 deletions

View file

@ -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()));
}
}

View file

@ -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<TextRange> {
self.with_db(|db| extend_selection::extend_selection(db, frange))
}
/// Returns position of the mathcing brace (all types of braces are