@@ -167,7 +167,7 @@ fn add_function_impl(
167
167
} ;
168
168
169
169
let mut item = CompletionItem :: new ( completion_kind, replacement_range, label) ;
170
- item. lookup_by ( fn_name)
170
+ item. lookup_by ( format ! ( "fn {}" , fn_name) )
171
171
. set_documentation ( func. docs ( ctx. db ) )
172
172
. set_relevance ( CompletionRelevance { is_item_from_trait : true , ..Default :: default ( ) } ) ;
173
173
@@ -232,7 +232,7 @@ fn add_type_alias_impl(
232
232
233
233
let mut item = CompletionItem :: new ( SymbolKind :: TypeAlias , replacement_range, label) ;
234
234
item. text_edit ( TextEdit :: replace ( replacement_range, snippet) )
235
- . lookup_by ( alias_name)
235
+ . lookup_by ( format ! ( "type {}" , alias_name) )
236
236
. set_documentation ( type_alias. docs ( ctx. db ) )
237
237
. set_relevance ( CompletionRelevance { is_item_from_trait : true , ..Default :: default ( ) } ) ;
238
238
item. add_to ( acc) ;
@@ -261,7 +261,7 @@ fn add_const_impl(
261
261
262
262
let mut item = CompletionItem :: new ( SymbolKind :: Const , replacement_range, label) ;
263
263
item. text_edit ( TextEdit :: replace ( replacement_range, snippet) )
264
- . lookup_by ( const_name)
264
+ . lookup_by ( format ! ( "const {}" , const_name) )
265
265
. set_documentation ( const_. docs ( ctx. db ) )
266
266
. set_relevance ( CompletionRelevance {
267
267
is_item_from_trait : true ,
@@ -549,7 +549,7 @@ impl Test for T {
549
549
#[ test]
550
550
fn name_ref_single_function ( ) {
551
551
check_edit (
552
- "test" ,
552
+ "fn test" ,
553
553
r#"
554
554
trait Test {
555
555
fn test();
@@ -578,7 +578,7 @@ impl Test for T {
578
578
#[ test]
579
579
fn single_function ( ) {
580
580
check_edit (
581
- "test" ,
581
+ "fn test" ,
582
582
r#"
583
583
trait Test {
584
584
fn test();
@@ -607,7 +607,7 @@ impl Test for T {
607
607
#[ test]
608
608
fn generic_fn ( ) {
609
609
check_edit (
610
- "foo" ,
610
+ "fn foo" ,
611
611
r#"
612
612
trait Test {
613
613
fn foo<T>();
@@ -632,7 +632,7 @@ impl Test for T {
632
632
"# ,
633
633
) ;
634
634
check_edit (
635
- "foo" ,
635
+ "fn foo" ,
636
636
r#"
637
637
trait Test {
638
638
fn foo<T>() where T: Into<String>;
@@ -662,7 +662,7 @@ where T: Into<String> {
662
662
#[ test]
663
663
fn associated_type ( ) {
664
664
check_edit (
665
- "SomeType" ,
665
+ "type SomeType" ,
666
666
r#"
667
667
trait Test {
668
668
type SomeType;
@@ -687,7 +687,7 @@ impl Test for () {
687
687
#[ test]
688
688
fn associated_const ( ) {
689
689
check_edit (
690
- "SOME_CONST" ,
690
+ "const SOME_CONST" ,
691
691
r#"
692
692
trait Test {
693
693
const SOME_CONST: u16;
@@ -709,7 +709,7 @@ impl Test for () {
709
709
) ;
710
710
711
711
check_edit (
712
- "SOME_CONST" ,
712
+ "const SOME_CONST" ,
713
713
r#"
714
714
trait Test {
715
715
const SOME_CONST: u16 = 92;
@@ -783,9 +783,9 @@ impl Test for T {{
783
783
"default type OtherType = i32;" ,
784
784
"default const OTHER_CONST: i32 = 0;" ,
785
785
] {
786
- test ( "bar" , "fn $0" , "fn bar() {\n $0\n }" , next_sibling) ;
787
- test ( "Foo" , "type $0" , "type Foo = " , next_sibling) ;
788
- test ( "CONST" , "const $0" , "const CONST: u16 = " , next_sibling) ;
786
+ test ( "fn bar" , "fn $0" , "fn bar() {\n $0\n }" , next_sibling) ;
787
+ test ( "type Foo" , "type $0" , "type Foo = " , next_sibling) ;
788
+ test ( "const CONST" , "const $0" , "const CONST: u16 = " , next_sibling) ;
789
789
}
790
790
}
791
791
@@ -830,15 +830,15 @@ impl Foo for T {{
830
830
) ,
831
831
)
832
832
} ;
833
- test ( "function" , "fn f$0" , "fn function() {\n $0\n }" ) ;
834
- test ( "Type" , "type T$0" , "type Type = " ) ;
835
- test ( "CONST" , "const C$0" , "const CONST: i32 = " ) ;
833
+ test ( "fn function" , "fn f$0" , "fn function() {\n $0\n }" ) ;
834
+ test ( "type Type" , "type T$0" , "type Type = " ) ;
835
+ test ( "const CONST" , "const C$0" , "const CONST: i32 = " ) ;
836
836
}
837
837
838
838
#[ test]
839
839
fn generics_are_inlined_in_return_type ( ) {
840
840
check_edit (
841
- "function" ,
841
+ "fn function" ,
842
842
r#"
843
843
trait Foo<T> {
844
844
fn function() -> T;
@@ -867,7 +867,7 @@ impl Foo<u32> for Bar {
867
867
#[ test]
868
868
fn generics_are_inlined_in_parameter ( ) {
869
869
check_edit (
870
- "function" ,
870
+ "fn function" ,
871
871
r#"
872
872
trait Foo<T> {
873
873
fn function(bar: T);
@@ -896,7 +896,7 @@ impl Foo<u32> for Bar {
896
896
#[ test]
897
897
fn generics_are_inlined_when_part_of_other_types ( ) {
898
898
check_edit (
899
- "function" ,
899
+ "fn function" ,
900
900
r#"
901
901
trait Foo<T> {
902
902
fn function(bar: Vec<T>);
@@ -925,7 +925,7 @@ impl Foo<u32> for Bar {
925
925
#[ test]
926
926
fn generics_are_inlined_complex ( ) {
927
927
check_edit (
928
- "function" ,
928
+ "fn function" ,
929
929
r#"
930
930
trait Foo<T, U, V> {
931
931
fn function(bar: Vec<T>, baz: U) -> Arc<Vec<V>>;
@@ -954,7 +954,7 @@ impl Foo<u32, Vec<usize>, u8> for Bar {
954
954
#[ test]
955
955
fn generics_are_inlined_in_associated_const ( ) {
956
956
check_edit (
957
- "BAR" ,
957
+ "const BAR" ,
958
958
r#"
959
959
trait Foo<T> {
960
960
const BAR: T;
@@ -981,7 +981,7 @@ impl Foo<u32> for Bar {
981
981
#[ test]
982
982
fn generics_are_inlined_in_where_clause ( ) {
983
983
check_edit (
984
- "function" ,
984
+ "fn function" ,
985
985
r#"
986
986
trait SomeTrait<T> {}
987
987
0 commit comments