Skip to content

Commit

Permalink
Merge #9477
Browse files Browse the repository at this point in the history
9477: fix: Don't show an import per namespace in auto_import r=Veykril a=Veykril

Fixes #9113
bors r+

Co-authored-by: Lukas Wirth <[email protected]>
  • Loading branch information
bors[bot] and Veykril authored Jul 3, 2021
2 parents 336194c + 05ec824 commit e73328f
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion crates/ide_assists/src/handlers/auto_import.rs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,13 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel};
// ```
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());
Expand Down

0 comments on commit e73328f

Please sign in to comment.