Skip to content

Commit

Permalink
fix: Don't trigger pattern completions when typing a wildcard pattern
Browse files Browse the repository at this point in the history
  • Loading branch information
Veykril committed Jun 20, 2022
1 parent 6e9c963 commit 1f02840
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 1 deletion.
6 changes: 5 additions & 1 deletion crates/ide-completion/src/completions.rs
Original file line number Diff line number Diff line change
Expand Up @@ -489,7 +489,11 @@ pub(super) fn complete_name(
NameKind::Function => {
item_list::trait_impl::complete_trait_impl_fn(acc, ctx, name);
}
NameKind::IdentPat(pattern_ctx) => complete_patterns(acc, ctx, pattern_ctx),
NameKind::IdentPat(pattern_ctx) => {
if ctx.token.kind() != syntax::T![_] {
complete_patterns(acc, ctx, pattern_ctx)
}
}
NameKind::Module(mod_under_caret) => {
mod_::complete_mod(acc, ctx, mod_under_caret);
}
Expand Down
12 changes: 12 additions & 0 deletions crates/ide-completion/src/tests/pattern.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,18 @@ fn check(ra_fixture: &str, expect: Expect) {
expect.assert_eq(&actual)
}

#[test]
fn wildcard() {
check(
r#"
fn quux() {
let _$0
}
"#,
expect![""],
);
}

#[test]
fn ident_rebind_pat() {
check_empty(
Expand Down

0 comments on commit 1f02840

Please sign in to comment.