Don't show an import per namespace in auto_import
This commit is contained in:
parent
96074f627b
commit
05ec824ab7
@ -84,11 +84,13 @@
|
|||||||
// ```
|
// ```
|
||||||
pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> {
|
||||||
let (import_assets, syntax_under_caret) = find_importable_node(ctx)?;
|
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);
|
import_assets.search_for_imports(&ctx.sema, ctx.config.insert_use.prefix_kind);
|
||||||
if proposed_imports.is_empty() {
|
if proposed_imports.is_empty() {
|
||||||
return None;
|
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 range = ctx.sema.original_range(&syntax_under_caret).range;
|
||||||
let group_label = group_label(import_assets.import_candidate());
|
let group_label = group_label(import_assets.import_candidate());
|
||||||
|
Loading…
Reference in New Issue
Block a user