Skip to content

Commit 9fdfa9f

Browse files
committed
Auto merge of rust-lang#12596 - Veykril:completions, r=Veykril
fix: Don't trigger pattern completions when typing a wildcard pattern Fixes rust-lang/rust-analyzer#12592
2 parents a1ff3ca + 1f02840 commit 9fdfa9f

File tree

2 files changed

+17
-1
lines changed

2 files changed

+17
-1
lines changed

crates/ide-completion/src/completions.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -489,7 +489,11 @@ pub(super) fn complete_name(
489489
NameKind::Function => {
490490
item_list::trait_impl::complete_trait_impl_fn(acc, ctx, name);
491491
}
492-
NameKind::IdentPat(pattern_ctx) => complete_patterns(acc, ctx, pattern_ctx),
492+
NameKind::IdentPat(pattern_ctx) => {
493+
if ctx.token.kind() != syntax::T![_] {
494+
complete_patterns(acc, ctx, pattern_ctx)
495+
}
496+
}
493497
NameKind::Module(mod_under_caret) => {
494498
mod_::complete_mod(acc, ctx, mod_under_caret);
495499
}

crates/ide-completion/src/tests/pattern.rs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,18 @@ fn check(ra_fixture: &str, expect: Expect) {
1313
expect.assert_eq(&actual)
1414
}
1515

16+
#[test]
17+
fn wildcard() {
18+
check(
19+
r#"
20+
fn quux() {
21+
let _$0
22+
}
23+
"#,
24+
expect![""],
25+
);
26+
}
27+
1628
#[test]
1729
fn ident_rebind_pat() {
1830
check_empty(

0 commit comments

Comments
 (0)