mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 22:31:43 +00:00
fix(completions): improve fn_param
- insert commas around when necessary - only suggest `self` completions when param list is empty - stop suggesting completions for identifiers which are already on the param list
This commit is contained in:
parent
dbb1c1b4b1
commit
a9612666f8
2 changed files with 75 additions and 24 deletions
|
@ -46,7 +46,20 @@ fn bar(file_id: usize) {}
|
|||
fn baz(file$0 id: u32) {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
bn file_id: usize
|
||||
bn file_id: usize,
|
||||
kw mut
|
||||
"#]],
|
||||
);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn repeated_param_name() {
|
||||
check(
|
||||
r#"
|
||||
fn foo(file_id: usize) {}
|
||||
fn bar(file_id: u32, $0) {}
|
||||
"#,
|
||||
expect![[r#"
|
||||
kw mut
|
||||
"#]],
|
||||
);
|
||||
|
@ -126,7 +139,6 @@ impl A {
|
|||
|
||||
#[test]
|
||||
fn in_impl_after_self() {
|
||||
// FIXME: self completions should not be here
|
||||
check(
|
||||
r#"
|
||||
struct A {}
|
||||
|
@ -137,10 +149,6 @@ impl A {
|
|||
}
|
||||
"#,
|
||||
expect![[r#"
|
||||
bn self
|
||||
bn &self
|
||||
bn mut self
|
||||
bn &mut self
|
||||
bn file_id: usize
|
||||
kw mut
|
||||
sp Self
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue