Don't show an import per namespace in auto_import

This commit is contained in:
Lukas Wirth 2021-07-03 22:11:01 +02:00
parent 96074f627b
commit 05ec824ab7

View File

@ -84,11 +84,13 @@
// ```
pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
let (import_assets, syntax_under_caret) = find_importable_node(ctx)?;
let proposed_imports =
let mut proposed_imports =
import_assets.search_for_imports(&ctx.sema, ctx.config.insert_use.prefix_kind);
if proposed_imports.is_empty() {
return None;
}
// we aren't interested in different namespaces
proposed_imports.dedup_by(|a, b| a.import_path == b.import_path);
let range = ctx.sema.original_range(&syntax_under_caret).range;
let group_label = group_label(import_assets.import_candidate());