From 6f51f728a114078a0c3a029fc66cfb8c4daf9a28 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 1 Dec 2020 13:53:12 +0300 Subject: Type-safer API for dealing with parameter lists with optional self --- crates/completion/src/completions/trait_impl.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'crates/completion/src/completions') diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs index a14be9c73..e2fe44aff 100644 --- a/crates/completion/src/completions/trait_impl.rs +++ b/crates/completion/src/completions/trait_impl.rs @@ -139,7 +139,7 @@ fn add_function_impl( ) { let fn_name = func.name(ctx.db).to_string(); - let label = if func.params(ctx.db).is_empty() { + let label = if func.assoc_fn_params(ctx.db).is_empty() { format!("fn {}()", fn_name) } else { format!("fn {}(..)", fn_name) -- cgit v1.2.3 From 9d94ffad44f2b250e498f162cd498aed62877c8e Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Tue, 1 Dec 2020 14:23:00 +0300 Subject: Place cursor correctly when completing assoc fns with self --- .../completion/src/completions/qualified_path.rs | 40 +++++++++++----------- 1 file changed, 20 insertions(+), 20 deletions(-) (limited to 'crates/completion/src/completions') diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/completion/src/completions/qualified_path.rs index d9387054d..bc23bea3f 100644 --- a/crates/completion/src/completions/qualified_path.rs +++ b/crates/completion/src/completions/qualified_path.rs @@ -353,10 +353,10 @@ impl S { fn foo() { let _ = S::<|> } "#, expect![[r#" - ct C const C: i32 = 42; - ta T type T = i32; - fn a() fn a() - me b() fn b(&self) + ct C const C: i32 = 42; + ta T type T = i32; + fn a() fn a() + me b(…) fn b(&self) "#]], ); } @@ -503,14 +503,14 @@ trait Sub: Super { fn foo() { T::<|> } "#, expect![[r#" - ct C2 const C2: (); - ct CONST const CONST: u8; - ta SubTy type SubTy; - ta Ty type Ty; - fn func() fn func() - me method() fn method(&self) - fn subfunc() fn subfunc() - me submethod() fn submethod(&self) + ct C2 const C2: (); + ct CONST const CONST: u8; + ta SubTy type SubTy; + ta Ty type Ty; + fn func() fn func() + me method(…) fn method(&self) + fn subfunc() fn subfunc() + me submethod(…) fn submethod(&self) "#]], ); } @@ -543,14 +543,14 @@ impl Sub for Wrap { } "#, expect![[r#" - ct C2 const C2: () = (); - ct CONST const CONST: u8 = 0; - ta SubTy type SubTy; - ta Ty type Ty; - fn func() fn func() - me method() fn method(&self) - fn subfunc() fn subfunc() - me submethod() fn submethod(&self) + ct C2 const C2: () = (); + ct CONST const CONST: u8 = 0; + ta SubTy type SubTy; + ta Ty type Ty; + fn func() fn func() + me method(…) fn method(&self) + fn subfunc() fn subfunc() + me submethod(…) fn submethod(&self) "#]], ); } -- cgit v1.2.3