aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_completion/src/render.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ide_completion/src/render.rs')
-rw-r--r--crates/ide_completion/src/render.rs54
1 files changed, 46 insertions, 8 deletions
diff --git a/crates/ide_completion/src/render.rs b/crates/ide_completion/src/render.rs
index 09a27de71..36655667c 100644
--- a/crates/ide_completion/src/render.rs
+++ b/crates/ide_completion/src/render.rs
@@ -452,6 +452,44 @@ fn main() { Foo::Fo$0 }
452 } 452 }
453 453
454 #[test] 454 #[test]
455 fn fn_detail_includes_args_and_return_type() {
456 check(
457 r#"
458fn foo<T>(a: u32, b: u32, t: T) -> (u32, T) { (a, t) }
459
460fn main() { fo$0 }
461"#,
462 expect![[r#"
463 [
464 CompletionItem {
465 label: "foo(…)",
466 source_range: 68..70,
467 delete: 68..70,
468 insert: "foo(${1:a}, ${2:b}, ${3:t})$0",
469 kind: SymbolKind(
470 Function,
471 ),
472 lookup: "foo",
473 detail: "fn(u32, u32, T) -> (u32, T)",
474 trigger_call_info: true,
475 },
476 CompletionItem {
477 label: "main()",
478 source_range: 68..70,
479 delete: 68..70,
480 insert: "main()$0",
481 kind: SymbolKind(
482 Function,
483 ),
484 lookup: "main",
485 detail: "fn()",
486 },
487 ]
488 "#]],
489 );
490 }
491
492 #[test]
455 fn enum_detail_just_parentheses_for_unit() { 493 fn enum_detail_just_parentheses_for_unit() {
456 check( 494 check(
457 r#" 495 r#"
@@ -538,7 +576,7 @@ fn main() { let _: m::Spam = S$0 }
538 Function, 576 Function,
539 ), 577 ),
540 lookup: "main", 578 lookup: "main",
541 detail: "-> ()", 579 detail: "fn()",
542 }, 580 },
543 ] 581 ]
544 "#]], 582 "#]],
@@ -567,7 +605,7 @@ fn main() { som$0 }
567 Function, 605 Function,
568 ), 606 ),
569 lookup: "main", 607 lookup: "main",
570 detail: "-> ()", 608 detail: "fn()",
571 }, 609 },
572 CompletionItem { 610 CompletionItem {
573 label: "something_deprecated()", 611 label: "something_deprecated()",
@@ -578,7 +616,7 @@ fn main() { som$0 }
578 Function, 616 Function,
579 ), 617 ),
580 lookup: "something_deprecated", 618 lookup: "something_deprecated",
581 detail: "-> ()", 619 detail: "fn()",
582 deprecated: true, 620 deprecated: true,
583 }, 621 },
584 CompletionItem { 622 CompletionItem {
@@ -590,7 +628,7 @@ fn main() { som$0 }
590 Function, 628 Function,
591 ), 629 ),
592 lookup: "something_else_deprecated", 630 lookup: "something_else_deprecated",
593 detail: "-> ()", 631 detail: "fn()",
594 deprecated: true, 632 deprecated: true,
595 }, 633 },
596 ] 634 ]
@@ -641,7 +679,7 @@ impl S {
641 insert: "bar()$0", 679 insert: "bar()$0",
642 kind: Method, 680 kind: Method,
643 lookup: "bar", 681 lookup: "bar",
644 detail: "-> ()", 682 detail: "fn(self)",
645 documentation: Documentation( 683 documentation: Documentation(
646 "Method docs", 684 "Method docs",
647 ), 685 ),
@@ -741,7 +779,7 @@ fn foo(s: S) { s.$0 }
741 insert: "the_method()$0", 779 insert: "the_method()$0",
742 kind: Method, 780 kind: Method,
743 lookup: "the_method", 781 lookup: "the_method",
744 detail: "-> ()", 782 detail: "fn(&self)",
745 }, 783 },
746 ] 784 ]
747 "#]], 785 "#]],
@@ -1049,7 +1087,7 @@ fn main() {
1049 Function, 1087 Function,
1050 ), 1088 ),
1051 lookup: "foo", 1089 lookup: "foo",
1052 detail: "-> ()", 1090 detail: "fn(&mut S)",
1053 trigger_call_info: true, 1091 trigger_call_info: true,
1054 }, 1092 },
1055 CompletionItem { 1093 CompletionItem {
@@ -1061,7 +1099,7 @@ fn main() {
1061 Function, 1099 Function,
1062 ), 1100 ),
1063 lookup: "main", 1101 lookup: "main",
1064 detail: "-> ()", 1102 detail: "fn()",
1065 }, 1103 },
1066 CompletionItem { 1104 CompletionItem {
1067 label: "s", 1105 label: "s",