aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r--crates/ra_ide/src/completion/complete_scope.rs36
-rw-r--r--crates/ra_ide/src/completion/completion_item.rs3
-rw-r--r--crates/ra_ide/src/completion/presentation.rs7
3 files changed, 46 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs
index bd4adf23a..5ffff5a1c 100644
--- a/crates/ra_ide/src/completion/complete_scope.rs
+++ b/crates/ra_ide/src/completion/complete_scope.rs
@@ -42,6 +42,7 @@ mod tests {
42 kind: Function, 42 kind: Function,
43 lookup: "quux", 43 lookup: "quux",
44 detail: "fn quux(x: i32)", 44 detail: "fn quux(x: i32)",
45 trigger_call_info: true,
45 }, 46 },
46 CompletionItem { 47 CompletionItem {
47 label: "x", 48 label: "x",
@@ -844,6 +845,7 @@ mod tests {
844 kind: Function, 845 kind: Function,
845 lookup: "quux", 846 lookup: "quux",
846 detail: "fn quux(x: i32)", 847 detail: "fn quux(x: i32)",
848 trigger_call_info: true,
847 }, 849 },
848 CompletionItem { 850 CompletionItem {
849 label: "x", 851 label: "x",
@@ -865,4 +867,38 @@ mod tests {
865 "### 867 "###
866 ); 868 );
867 } 869 }
870
871 #[test]
872 fn completes_unresolved_uses() {
873 assert_debug_snapshot!(
874 do_reference_completion(
875 r"
876 use spam::Quux;
877
878 fn main() {
879 <|>
880 }
881 "
882 ),
883 @r###"
884 [
885 CompletionItem {
886 label: "Quux",
887 source_range: [82; 82),
888 delete: [82; 82),
889 insert: "Quux",
890 },
891 CompletionItem {
892 label: "main()",
893 source_range: [82; 82),
894 delete: [82; 82),
895 insert: "main()$0",
896 kind: Function,
897 lookup: "main",
898 detail: "fn main()",
899 },
900 ]
901 "###
902 );
903 }
868} 904}
diff --git a/crates/ra_ide/src/completion/completion_item.rs b/crates/ra_ide/src/completion/completion_item.rs
index ef0eb43b2..bc0f1aff5 100644
--- a/crates/ra_ide/src/completion/completion_item.rs
+++ b/crates/ra_ide/src/completion/completion_item.rs
@@ -80,6 +80,9 @@ impl fmt::Debug for CompletionItem {
80 if self.deprecated { 80 if self.deprecated {
81 s.field("deprecated", &true); 81 s.field("deprecated", &true);
82 } 82 }
83 if self.trigger_call_info {
84 s.field("trigger_call_info", &true);
85 }
83 s.finish() 86 s.finish()
84 } 87 }
85} 88}
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs
index 5213def20..a4e9aefe2 100644
--- a/crates/ra_ide/src/completion/presentation.rs
+++ b/crates/ra_ide/src/completion/presentation.rs
@@ -510,6 +510,7 @@ mod tests {
510 kind: Function, 510 kind: Function,
511 lookup: "with_args", 511 lookup: "with_args",
512 detail: "fn with_args(x: i32, y: String)", 512 detail: "fn with_args(x: i32, y: String)",
513 trigger_call_info: true,
513 }, 514 },
514 ] 515 ]
515 "### 516 "###
@@ -566,6 +567,7 @@ mod tests {
566 kind: Method, 567 kind: Method,
567 lookup: "foo", 568 lookup: "foo",
568 detail: "fn foo(&self, x: i32)", 569 detail: "fn foo(&self, x: i32)",
570 trigger_call_info: true,
569 }, 571 },
570 ] 572 ]
571 "### 573 "###
@@ -600,6 +602,7 @@ mod tests {
600 kind: Method, 602 kind: Method,
601 lookup: "foo", 603 lookup: "foo",
602 detail: "fn foo(&self, x: i32)", 604 detail: "fn foo(&self, x: i32)",
605 trigger_call_info: true,
603 }, 606 },
604 ] 607 ]
605 "### 608 "###
@@ -718,6 +721,7 @@ mod tests {
718 kind: Function, 721 kind: Function,
719 lookup: "foo", 722 lookup: "foo",
720 detail: "fn foo(xs: Ve)", 723 detail: "fn foo(xs: Ve)",
724 trigger_call_info: true,
721 }, 725 },
722 ] 726 ]
723 "### 727 "###
@@ -747,6 +751,7 @@ mod tests {
747 kind: Function, 751 kind: Function,
748 lookup: "foo", 752 lookup: "foo",
749 detail: "fn foo(xs: Ve)", 753 detail: "fn foo(xs: Ve)",
754 trigger_call_info: true,
750 }, 755 },
751 ] 756 ]
752 "### 757 "###
@@ -775,6 +780,7 @@ mod tests {
775 kind: Function, 780 kind: Function,
776 lookup: "foo", 781 lookup: "foo",
777 detail: "fn foo(xs: Ve)", 782 detail: "fn foo(xs: Ve)",
783 trigger_call_info: true,
778 }, 784 },
779 ] 785 ]
780 "### 786 "###
@@ -803,6 +809,7 @@ mod tests {
803 kind: Function, 809 kind: Function,
804 lookup: "foo", 810 lookup: "foo",
805 detail: "fn foo(xs: Ve<i128>)", 811 detail: "fn foo(xs: Ve<i128>)",
812 trigger_call_info: true,
806 }, 813 },
807 ] 814 ]
808 "### 815 "###