Skip to content

Commit 8267966

Browse files
committed
2 parents 5174d3d + dd4d3f0 commit 8267966

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed

crates/ide-assists/src/handlers/auto_import.rs

+16
Original file line numberDiff line numberDiff line change
@@ -156,6 +156,8 @@ pub(super) fn find_importable_node(
156156
{
157157
ImportAssets::for_method_call(&method_under_caret, &ctx.sema)
158158
.zip(Some(method_under_caret.syntax().clone().into()))
159+
} else if let Some(_) = ctx.find_node_at_offset_with_descend::<ast::Param>() {
160+
None
159161
} else if let Some(pat) = ctx
160162
.find_node_at_offset_with_descend::<ast::IdentPat>()
161163
.filter(ast::IdentPat::is_simple_ident)
@@ -268,6 +270,20 @@ mod tests {
268270
assert_eq!(labels, order);
269271
}
270272

273+
#[test]
274+
fn ignore_parameter_name() {
275+
check_assist_not_applicable(
276+
auto_import,
277+
r"
278+
mod foo {
279+
pub mod bar {}
280+
}
281+
282+
fn foo(bar$0: &str) {}
283+
",
284+
);
285+
}
286+
271287
#[test]
272288
fn prefer_shorter_paths() {
273289
let before = r"

0 commit comments

Comments
 (0)