File tree Expand file tree Collapse file tree 2 files changed +23
-3
lines changed
crates/ide_completion/src Expand file tree Collapse file tree 2 files changed +23
-3
lines changed Original file line number Diff line number Diff line change @@ -83,9 +83,15 @@ fn remove_duplicated(
83
83
let whole_param = param. syntax ( ) . text ( ) . to_string ( ) ;
84
84
file_params. remove ( & whole_param) ;
85
85
86
- if let Some ( pattern) = param. pat ( ) {
87
- let binding = pattern. syntax ( ) . text ( ) . to_string ( ) ;
88
- file_params. retain ( |_, v| v != & binding) ;
86
+ match param. pat ( ) {
87
+ // remove suggestions for patterns that already exist
88
+ // if the type is missing we are checking the current param to be completed
89
+ // in which case this would find itself removing the suggestions due to itself
90
+ Some ( pattern) if param. ty ( ) . is_some ( ) => {
91
+ let binding = pattern. syntax ( ) . text ( ) . to_string ( ) ;
92
+ file_params. retain ( |_, v| v != & binding) ;
93
+ }
94
+ _ => ( ) ,
89
95
}
90
96
} )
91
97
}
Original file line number Diff line number Diff line change @@ -368,3 +368,17 @@ fn foo() {
368
368
"# ] ] ,
369
369
)
370
370
}
371
+
372
+ #[ test]
373
+ fn completes_fully_equal ( ) {
374
+ check_empty (
375
+ r#"
376
+ fn foo(bar: u32) {}
377
+ fn bar(bar$0) {}
378
+ "# ,
379
+ expect ! [ [ r#"
380
+ bn bar: u32
381
+ kw mut
382
+ "# ] ] ,
383
+ )
384
+ }
You can’t perform that action at this time.
0 commit comments