diff options
author | Kirill Bulatov <[email protected]> | 2021-02-28 08:32:15 +0000 |
---|---|---|
committer | Kirill Bulatov <[email protected]> | 2021-03-08 21:59:20 +0000 |
commit | 89d410cef571f5fa7631b17e2fbe52a8f8f03990 (patch) | |
tree | 6c40354741dda2072ef08f1bab9920547277bdd0 /crates/ide_assists | |
parent | 9482353fa8e1e88cb720a029b9bb6304819c7399 (diff) |
Do not propose already imported imports
Diffstat (limited to 'crates/ide_assists')
-rw-r--r-- | crates/ide_assists/src/handlers/auto_import.rs | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/crates/ide_assists/src/handlers/auto_import.rs b/crates/ide_assists/src/handlers/auto_import.rs index e9993a7cc..182547589 100644 --- a/crates/ide_assists/src/handlers/auto_import.rs +++ b/crates/ide_assists/src/handlers/auto_import.rs | |||
@@ -111,7 +111,9 @@ pub(crate) fn auto_import(acc: &mut Assists, ctx: &AssistContext) -> Option<()> | |||
111 | Some(()) | 111 | Some(()) |
112 | } | 112 | } |
113 | 113 | ||
114 | pub(super) fn find_importable_node(ctx: &AssistContext) -> Option<(ImportAssets, SyntaxNode)> { | 114 | pub(super) fn find_importable_node<'a>( |
115 | ctx: &'a AssistContext, | ||
116 | ) -> Option<(ImportAssets<'a>, SyntaxNode)> { | ||
115 | if let Some(path_under_caret) = ctx.find_node_at_offset_with_descend::<ast::Path>() { | 117 | if let Some(path_under_caret) = ctx.find_node_at_offset_with_descend::<ast::Path>() { |
116 | ImportAssets::for_exact_path(&path_under_caret, &ctx.sema) | 118 | ImportAssets::for_exact_path(&path_under_caret, &ctx.sema) |
117 | .zip(Some(path_under_caret.syntax().clone())) | 119 | .zip(Some(path_under_caret.syntax().clone())) |