diff options
Diffstat (limited to 'crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs | 95 |
1 files changed, 50 insertions, 45 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs b/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs index 09f743c66..faadd1e3f 100644 --- a/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs +++ b/crates/ra_ide_api/src/completion/complete_macro_in_item_position.rs | |||
@@ -37,16 +37,18 @@ mod tests { | |||
37 | <|> | 37 | <|> |
38 | " | 38 | " |
39 | ), | 39 | ), |
40 | @r##"[ | 40 | @r###" |
41 | CompletionItem { | 41 | [ |
42 | label: "foo!", | 42 | CompletionItem { |
43 | source_range: [46; 46), | 43 | label: "foo!", |
44 | delete: [46; 46), | 44 | source_range: [46; 46), |
45 | insert: "foo!($0)", | 45 | delete: [46; 46), |
46 | kind: Macro, | 46 | insert: "foo!($0)", |
47 | detail: "macro_rules! foo", | 47 | kind: Macro, |
48 | }, | 48 | detail: "macro_rules! foo", |
49 | ]"## | 49 | }, |
50 | ] | ||
51 | "### | ||
50 | ); | 52 | ); |
51 | } | 53 | } |
52 | 54 | ||
@@ -75,19 +77,21 @@ mod tests { | |||
75 | <|> | 77 | <|> |
76 | " | 78 | " |
77 | ), | 79 | ), |
78 | @r##"[ | 80 | @r###" |
79 | CompletionItem { | 81 | [ |
80 | label: "vec!", | 82 | CompletionItem { |
81 | source_range: [280; 280), | 83 | label: "vec!", |
82 | delete: [280; 280), | 84 | source_range: [280; 280), |
83 | insert: "vec![$0]", | 85 | delete: [280; 280), |
84 | kind: Macro, | 86 | insert: "vec![$0]", |
85 | detail: "macro_rules! vec", | 87 | kind: Macro, |
86 | documentation: Documentation( | 88 | detail: "macro_rules! vec", |
87 | "Creates a [`Vec`] containing the arguments.\n\n- Create a [`Vec`] containing a given list of elements:\n\n```\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```", | 89 | documentation: Documentation( |
88 | ), | 90 | "Creates a [`Vec`] containing the arguments.\n\n- Create a [`Vec`] containing a given list of elements:\n\n```\nlet v = vec![1, 2, 3];\nassert_eq!(v[0], 1);\nassert_eq!(v[1], 2);\nassert_eq!(v[2], 3);\n```", |
89 | }, | 91 | ), |
90 | ]"## | 92 | }, |
93 | ] | ||
94 | "### | ||
91 | ); | 95 | ); |
92 | } | 96 | } |
93 | 97 | ||
@@ -110,28 +114,29 @@ mod tests { | |||
110 | } | 114 | } |
111 | " | 115 | " |
112 | ), | 116 | ), |
113 | @r###"[ | 117 | @r###" |
114 | CompletionItem { | 118 | [ |
115 | label: "foo!", | 119 | CompletionItem { |
116 | source_range: [163; 163), | 120 | label: "foo!", |
117 | delete: [163; 163), | 121 | source_range: [163; 163), |
118 | insert: "foo! {$0}", | 122 | delete: [163; 163), |
119 | kind: Macro, | 123 | insert: "foo! {$0}", |
120 | detail: "macro_rules! foo", | 124 | kind: Macro, |
121 | documentation: Documentation( | 125 | detail: "macro_rules! foo", |
122 | "Foo\n\nNot call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`.\nCall as `let _=foo! { hello world };`", | 126 | documentation: Documentation( |
123 | ), | 127 | "Foo\n\nNot call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`.\nCall as `let _=foo! { hello world };`", |
124 | }, | 128 | ), |
125 | CompletionItem { | 129 | }, |
126 | label: "main()", | 130 | CompletionItem { |
127 | source_range: [163; 163), | 131 | label: "main()", |
128 | delete: [163; 163), | 132 | source_range: [163; 163), |
129 | insert: "main()$0", | 133 | delete: [163; 163), |
130 | kind: Function, | 134 | insert: "main()$0", |
131 | lookup: "main", | 135 | kind: Function, |
132 | detail: "fn main()", | 136 | lookup: "main", |
133 | }, | 137 | detail: "fn main()", |
134 | ] | 138 | }, |
139 | ] | ||
135 | "### | 140 | "### |
136 | ); | 141 | ); |
137 | } | 142 | } |