diff options
Diffstat (limited to 'crates/completion')
-rw-r--r-- | crates/completion/src/lib.rs | 82 |
1 files changed, 37 insertions, 45 deletions
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 50329b499..db8bfbbc3 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -209,24 +209,23 @@ mod tests { | |||
209 | fn test_completion_detail_from_macro_generated_struct_fn_doc_attr() { | 209 | fn test_completion_detail_from_macro_generated_struct_fn_doc_attr() { |
210 | check_detail_and_documentation( | 210 | check_detail_and_documentation( |
211 | r#" | 211 | r#" |
212 | //- /lib.rs | 212 | macro_rules! bar { |
213 | macro_rules! bar { | 213 | () => { |
214 | () => { | 214 | struct Bar; |
215 | struct Bar; | 215 | impl Bar { |
216 | impl Bar { | 216 | #[doc = "Do the foo"] |
217 | #[doc = "Do the foo"] | 217 | fn foo(&self) {} |
218 | fn foo(&self) {} | 218 | } |
219 | } | 219 | } |
220 | } | 220 | } |
221 | } | ||
222 | 221 | ||
223 | bar!(); | 222 | bar!(); |
224 | 223 | ||
225 | fn foo() { | 224 | fn foo() { |
226 | let bar = Bar; | 225 | let bar = Bar; |
227 | bar.fo$0; | 226 | bar.fo$0; |
228 | } | 227 | } |
229 | "#, | 228 | "#, |
230 | DetailAndDocumentation { detail: "-> ()", documentation: "Do the foo" }, | 229 | DetailAndDocumentation { detail: "-> ()", documentation: "Do the foo" }, |
231 | ); | 230 | ); |
232 | } | 231 | } |
@@ -235,24 +234,23 @@ mod tests { | |||
235 | fn test_completion_detail_from_macro_generated_struct_fn_doc_comment() { | 234 | fn test_completion_detail_from_macro_generated_struct_fn_doc_comment() { |
236 | check_detail_and_documentation( | 235 | check_detail_and_documentation( |
237 | r#" | 236 | r#" |
238 | //- /lib.rs | 237 | macro_rules! bar { |
239 | macro_rules! bar { | 238 | () => { |
240 | () => { | 239 | struct Bar; |
241 | struct Bar; | 240 | impl Bar { |
242 | impl Bar { | 241 | /// Do the foo |
243 | /// Do the foo | 242 | fn foo(&self) {} |
244 | fn foo(&self) {} | 243 | } |
245 | } | 244 | } |
246 | } | 245 | } |
247 | } | ||
248 | 246 | ||
249 | bar!(); | 247 | bar!(); |
250 | 248 | ||
251 | fn foo() { | 249 | fn foo() { |
252 | let bar = Bar; | 250 | let bar = Bar; |
253 | bar.fo$0; | 251 | bar.fo$0; |
254 | } | 252 | } |
255 | "#, | 253 | "#, |
256 | DetailAndDocumentation { detail: "-> ()", documentation: " Do the foo" }, | 254 | DetailAndDocumentation { detail: "-> ()", documentation: " Do the foo" }, |
257 | ); | 255 | ); |
258 | } | 256 | } |
@@ -260,23 +258,17 @@ mod tests { | |||
260 | #[test] | 258 | #[test] |
261 | fn test_no_completions_required() { | 259 | fn test_no_completions_required() { |
262 | // There must be no hint for 'in' keyword. | 260 | // There must be no hint for 'in' keyword. |
263 | check_no_completion( | 261 | check_no_completion(r#"fn foo() { for i i$0 }"#); |
264 | r#" | ||
265 | fn foo() { | ||
266 | for i i$0 | ||
267 | } | ||
268 | "#, | ||
269 | ); | ||
270 | // After 'in' keyword hints may be spawned. | 262 | // After 'in' keyword hints may be spawned. |
271 | check_detail_and_documentation( | 263 | check_detail_and_documentation( |
272 | r#" | 264 | r#" |
273 | /// Do the foo | 265 | /// Do the foo |
274 | fn foo() -> &'static str { "foo" } | 266 | fn foo() -> &'static str { "foo" } |
275 | 267 | ||
276 | fn bar() { | 268 | fn bar() { |
277 | for c in fo$0 | 269 | for c in fo$0 |
278 | } | 270 | } |
279 | "#, | 271 | "#, |
280 | DetailAndDocumentation { detail: "-> &str", documentation: "Do the foo" }, | 272 | DetailAndDocumentation { detail: "-> &str", documentation: "Do the foo" }, |
281 | ); | 273 | ); |
282 | } | 274 | } |