aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide/src/completion
diff options
context:
space:
mode:
authorFlorian Diebold <[email protected]>2020-03-15 10:26:54 +0000
committerFlorian Diebold <[email protected]>2020-03-16 17:38:19 +0000
commit035db0fbb94e35c78cc76798844db06bd6ad8451 (patch)
tree43e1efbd8357bbaa2f78958f505e771ad55ea264 /crates/ra_ide/src/completion
parentc32529ddd0d66a219226dd63da2d4b1825375c0e (diff)
Add test, remove printlns
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r--crates/ra_ide/src/completion/complete_scope.rs53
1 files changed, 53 insertions, 0 deletions
diff --git a/crates/ra_ide/src/completion/complete_scope.rs b/crates/ra_ide/src/completion/complete_scope.rs
index 2733922f8..81d3cc1b6 100644
--- a/crates/ra_ide/src/completion/complete_scope.rs
+++ b/crates/ra_ide/src/completion/complete_scope.rs
@@ -906,6 +906,59 @@ mod tests {
906 } 906 }
907 907
908 #[test] 908 #[test]
909 fn completes_in_simple_macro_without_closing_parens() {
910 assert_debug_snapshot!(
911 do_reference_completion(
912 r"
913 macro_rules! m { ($e:expr) => { $e } }
914 fn quux(x: i32) {
915 let y = 92;
916 m!(x<|>
917 }
918 "
919 ),
920 @r###"
921 [
922 CompletionItem {
923 label: "m!",
924 source_range: [145; 146),
925 delete: [145; 146),
926 insert: "m!($0)",
927 kind: Macro,
928 detail: "macro_rules! m",
929 },
930 CompletionItem {
931 label: "quux(…)",
932 source_range: [145; 146),
933 delete: [145; 146),
934 insert: "quux(${1:x})$0",
935 kind: Function,
936 lookup: "quux",
937 detail: "fn quux(x: i32)",
938 trigger_call_info: true,
939 },
940 CompletionItem {
941 label: "x",
942 source_range: [145; 146),
943 delete: [145; 146),
944 insert: "x",
945 kind: Binding,
946 detail: "i32",
947 },
948 CompletionItem {
949 label: "y",
950 source_range: [145; 146),
951 delete: [145; 146),
952 insert: "y",
953 kind: Binding,
954 detail: "i32",
955 },
956 ]
957 "###
958 );
959 }
960
961 #[test]
909 fn completes_unresolved_uses() { 962 fn completes_unresolved_uses() {
910 assert_debug_snapshot!( 963 assert_debug_snapshot!(
911 do_reference_completion( 964 do_reference_completion(