mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-23 04:14:28 +00:00
Merge #11263
11263: fix: Fix don't drop param completions when fully typing out a pattern r=Veykril a=Veykril bors r+ Co-authored-by: Lukas Wirth <lukastw97@gmail.com>
This commit is contained in:
commit
de50ef4bea
@ -83,9 +83,15 @@ fn remove_duplicated(
|
||||
let whole_param = param.syntax().text().to_string();
|
||||
file_params.remove(&whole_param);
|
||||
|
||||
if let Some(pattern) = param.pat() {
|
||||
let binding = pattern.syntax().text().to_string();
|
||||
file_params.retain(|_, v| v != &binding);
|
||||
match param.pat() {
|
||||
// remove suggestions for patterns that already exist
|
||||
// if the type is missing we are checking the current param to be completed
|
||||
// in which case this would find itself removing the suggestions due to itself
|
||||
Some(pattern) if param.ty().is_some() => {
|
||||
let binding = pattern.syntax().text().to_string();
|
||||
file_params.retain(|_, v| v != &binding);
|
||||
}
|
||||
_ => (),
|
||||
}
|
||||
})
|
||||
}
|
||||
|
@ -368,3 +368,17 @@ fn foo() {
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn completes_fully_equal() {
|
||||
check_empty(
|
||||
r#"
|
||||
fn foo(bar: u32) {}
|
||||
fn bar(bar$0) {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
bn bar: u32
|
||||
kw mut
|
||||
"#]],
|
||||
)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user