diff options
Diffstat (limited to 'crates/ide_completion/src/render.rs')
-rw-r--r-- | crates/ide_completion/src/render.rs | 54 |
1 files changed, 46 insertions, 8 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs index db31896e5..d9bf52582 100644 --- a/crates/ide_completion/src/render.rs +++ b/crates/ide_completion/src/render.rs | |||
@@ -425,6 +425,44 @@ fn main() { Foo::Fo$0 } | |||
425 | } | 425 | } |
426 | 426 | ||
427 | #[test] | 427 | #[test] |
428 | fn fn_detail_includes_args_and_return_type() { | ||
429 | check( | ||
430 | r#" | ||
431 | fn foo<T>(a: u32, b: u32, t: T) -> (u32, T) { (a, t) } | ||
432 | |||
433 | fn main() { fo$0 } | ||
434 | "#, | ||
435 | expect![[r#" | ||
436 | [ | ||
437 | CompletionItem { | ||
438 | label: "foo(…)", | ||
439 | source_range: 68..70, | ||
440 | delete: 68..70, | ||
441 | insert: "foo(${1:a}, ${2:b}, ${3:t})$0", | ||
442 | kind: SymbolKind( | ||
443 | Function, | ||
444 | ), | ||
445 | lookup: "foo", | ||
446 | detail: "fn(u32, u32, T) -> (u32, T)", | ||
447 | trigger_call_info: true, | ||
448 | }, | ||
449 | CompletionItem { | ||
450 | label: "main()", | ||
451 | source_range: 68..70, | ||
452 | delete: 68..70, | ||
453 | insert: "main()$0", | ||
454 | kind: SymbolKind( | ||
455 | Function, | ||
456 | ), | ||
457 | lookup: "main", | ||
458 | detail: "fn()", | ||
459 | }, | ||
460 | ] | ||
461 | "#]], | ||
462 | ); | ||
463 | } | ||
464 | |||
465 | #[test] | ||
428 | fn enum_detail_just_parentheses_for_unit() { | 466 | fn enum_detail_just_parentheses_for_unit() { |
429 | check( | 467 | check( |
430 | r#" | 468 | r#" |
@@ -501,7 +539,7 @@ fn main() { let _: m::Spam = S$0 } | |||
501 | Function, | 539 | Function, |
502 | ), | 540 | ), |
503 | lookup: "main", | 541 | lookup: "main", |
504 | detail: "-> ()", | 542 | detail: "fn()", |
505 | }, | 543 | }, |
506 | ] | 544 | ] |
507 | "#]], | 545 | "#]], |
@@ -530,7 +568,7 @@ fn main() { som$0 } | |||
530 | Function, | 568 | Function, |
531 | ), | 569 | ), |
532 | lookup: "main", | 570 | lookup: "main", |
533 | detail: "-> ()", | 571 | detail: "fn()", |
534 | }, | 572 | }, |
535 | CompletionItem { | 573 | CompletionItem { |
536 | label: "something_deprecated()", | 574 | label: "something_deprecated()", |
@@ -541,7 +579,7 @@ fn main() { som$0 } | |||
541 | Function, | 579 | Function, |
542 | ), | 580 | ), |
543 | lookup: "something_deprecated", | 581 | lookup: "something_deprecated", |
544 | detail: "-> ()", | 582 | detail: "fn()", |
545 | deprecated: true, | 583 | deprecated: true, |
546 | }, | 584 | }, |
547 | CompletionItem { | 585 | CompletionItem { |
@@ -553,7 +591,7 @@ fn main() { som$0 } | |||
553 | Function, | 591 | Function, |
554 | ), | 592 | ), |
555 | lookup: "something_else_deprecated", | 593 | lookup: "something_else_deprecated", |
556 | detail: "-> ()", | 594 | detail: "fn()", |
557 | deprecated: true, | 595 | deprecated: true, |
558 | }, | 596 | }, |
559 | ] | 597 | ] |
@@ -604,7 +642,7 @@ impl S { | |||
604 | insert: "bar()$0", | 642 | insert: "bar()$0", |
605 | kind: Method, | 643 | kind: Method, |
606 | lookup: "bar", | 644 | lookup: "bar", |
607 | detail: "-> ()", | 645 | detail: "fn(self)", |
608 | documentation: Documentation( | 646 | documentation: Documentation( |
609 | "Method docs", | 647 | "Method docs", |
610 | ), | 648 | ), |
@@ -704,7 +742,7 @@ fn foo(s: S) { s.$0 } | |||
704 | insert: "the_method()$0", | 742 | insert: "the_method()$0", |
705 | kind: Method, | 743 | kind: Method, |
706 | lookup: "the_method", | 744 | lookup: "the_method", |
707 | detail: "-> ()", | 745 | detail: "fn(&self)", |
708 | }, | 746 | }, |
709 | ] | 747 | ] |
710 | "#]], | 748 | "#]], |
@@ -954,7 +992,7 @@ fn main() { | |||
954 | Function, | 992 | Function, |
955 | ), | 993 | ), |
956 | lookup: "foo", | 994 | lookup: "foo", |
957 | detail: "-> ()", | 995 | detail: "fn(&mut S)", |
958 | trigger_call_info: true, | 996 | trigger_call_info: true, |
959 | }, | 997 | }, |
960 | CompletionItem { | 998 | CompletionItem { |
@@ -966,7 +1004,7 @@ fn main() { | |||
966 | Function, | 1004 | Function, |
967 | ), | 1005 | ), |
968 | lookup: "main", | 1006 | lookup: "main", |
969 | detail: "-> ()", | 1007 | detail: "fn()", |
970 | }, | 1008 | }, |
971 | CompletionItem { | 1009 | CompletionItem { |
972 | label: "s", | 1010 | label: "s", |