Make selections in assists with trailing/leading whitespace more forgiving

This commit is contained in:
Lukas Wirth 2021-10-12 14:41:59 +02:00
parent 1cca1fa5bf
commit 03fcf1b246
14 changed files with 57 additions and 23 deletions

View file

@ -56,7 +56,7 @@ type FxIndexSet<T> = indexmap::IndexSet<T, BuildHasherDefault<FxHasher>>;
// }
// ```
pub(crate) fn extract_function(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
let range = ctx.frange.range;
let range = ctx.selection_trimmed();
if range.is_empty() {
return None;
}