diff options
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_scope.rs | 118 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/complete_snippet.rs | 30 | ||||
-rw-r--r-- | crates/ra_ide_api/src/completion/presentation.rs | 64 | ||||
-rw-r--r-- | crates/ra_ide_api/src/display/structure.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide_api/src/runnables.rs | 18 |
5 files changed, 117 insertions, 117 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index 1baa5227a..07c2e5f94 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -122,7 +122,7 @@ impl ImportResolver { | |||
122 | #[cfg(test)] | 122 | #[cfg(test)] |
123 | mod tests { | 123 | mod tests { |
124 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; | 124 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; |
125 | use insta::assert_debug_snapshot_matches; | 125 | use insta::assert_debug_snapshot_matches; |
126 | 126 | ||
127 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { | 127 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { |
128 | do_completion(code, CompletionKind::Reference) | 128 | do_completion(code, CompletionKind::Reference) |
@@ -131,16 +131,16 @@ mod tests { | |||
131 | #[test] | 131 | #[test] |
132 | fn completes_bindings_from_let() { | 132 | fn completes_bindings_from_let() { |
133 | assert_debug_snapshot_matches!( | 133 | assert_debug_snapshot_matches!( |
134 | do_reference_completion( | 134 | do_reference_completion( |
135 | r" | 135 | r" |
136 | fn quux(x: i32) { | 136 | fn quux(x: i32) { |
137 | let y = 92; | 137 | let y = 92; |
138 | 1 + <|>; | 138 | 1 + <|>; |
139 | let z = (); | 139 | let z = (); |
140 | } | 140 | } |
141 | " | 141 | " |
142 | ), | 142 | ), |
143 | @r###" | 143 | @r###" |
144 | ⋮[ | 144 | ⋮[ |
145 | ⋮ CompletionItem { | 145 | ⋮ CompletionItem { |
146 | ⋮ label: "quux", | 146 | ⋮ label: "quux", |
@@ -168,14 +168,14 @@ mod tests { | |||
168 | ⋮ }, | 168 | ⋮ }, |
169 | ⋮] | 169 | ⋮] |
170 | "### | 170 | "### |
171 | ); | 171 | ); |
172 | } | 172 | } |
173 | 173 | ||
174 | #[test] | 174 | #[test] |
175 | fn completes_bindings_from_if_let() { | 175 | fn completes_bindings_from_if_let() { |
176 | assert_debug_snapshot_matches!( | 176 | assert_debug_snapshot_matches!( |
177 | do_reference_completion( | 177 | do_reference_completion( |
178 | r" | 178 | r" |
179 | fn quux() { | 179 | fn quux() { |
180 | if let Some(x) = foo() { | 180 | if let Some(x) = foo() { |
181 | let y = 92; | 181 | let y = 92; |
@@ -186,8 +186,8 @@ mod tests { | |||
186 | } | 186 | } |
187 | } | 187 | } |
188 | " | 188 | " |
189 | ), | 189 | ), |
190 | @r###" | 190 | @r###" |
191 | ⋮[ | 191 | ⋮[ |
192 | ⋮ CompletionItem { | 192 | ⋮ CompletionItem { |
193 | ⋮ label: "a", | 193 | ⋮ label: "a", |
@@ -214,22 +214,22 @@ mod tests { | |||
214 | ⋮ }, | 214 | ⋮ }, |
215 | ⋮] | 215 | ⋮] |
216 | "### | 216 | "### |
217 | ); | 217 | ); |
218 | } | 218 | } |
219 | 219 | ||
220 | #[test] | 220 | #[test] |
221 | fn completes_bindings_from_for() { | 221 | fn completes_bindings_from_for() { |
222 | assert_debug_snapshot_matches!( | 222 | assert_debug_snapshot_matches!( |
223 | do_reference_completion( | 223 | do_reference_completion( |
224 | r" | 224 | r" |
225 | fn quux() { | 225 | fn quux() { |
226 | for x in &[1, 2, 3] { | 226 | for x in &[1, 2, 3] { |
227 | <|> | 227 | <|> |
228 | } | 228 | } |
229 | } | 229 | } |
230 | " | 230 | " |
231 | ), | 231 | ), |
232 | @r###" | 232 | @r###" |
233 | ⋮[ | 233 | ⋮[ |
234 | ⋮ CompletionItem { | 234 | ⋮ CompletionItem { |
235 | ⋮ label: "quux", | 235 | ⋮ label: "quux", |
@@ -248,20 +248,20 @@ mod tests { | |||
248 | ⋮ }, | 248 | ⋮ }, |
249 | ⋮] | 249 | ⋮] |
250 | "### | 250 | "### |
251 | ); | 251 | ); |
252 | } | 252 | } |
253 | 253 | ||
254 | #[test] | 254 | #[test] |
255 | fn completes_generic_params() { | 255 | fn completes_generic_params() { |
256 | assert_debug_snapshot_matches!( | 256 | assert_debug_snapshot_matches!( |
257 | do_reference_completion( | 257 | do_reference_completion( |
258 | r" | 258 | r" |
259 | fn quux<T>() { | 259 | fn quux<T>() { |
260 | <|> | 260 | <|> |
261 | } | 261 | } |
262 | " | 262 | " |
263 | ), | 263 | ), |
264 | @r###" | 264 | @r###" |
265 | ⋮[ | 265 | ⋮[ |
266 | ⋮ CompletionItem { | 266 | ⋮ CompletionItem { |
267 | ⋮ label: "T", | 267 | ⋮ label: "T", |
@@ -280,20 +280,20 @@ mod tests { | |||
280 | ⋮ }, | 280 | ⋮ }, |
281 | ⋮] | 281 | ⋮] |
282 | "### | 282 | "### |
283 | ); | 283 | ); |
284 | } | 284 | } |
285 | 285 | ||
286 | #[test] | 286 | #[test] |
287 | fn completes_generic_params_in_struct() { | 287 | fn completes_generic_params_in_struct() { |
288 | assert_debug_snapshot_matches!( | 288 | assert_debug_snapshot_matches!( |
289 | do_reference_completion( | 289 | do_reference_completion( |
290 | r" | 290 | r" |
291 | struct X<T> { | 291 | struct X<T> { |
292 | x: <|> | 292 | x: <|> |
293 | } | 293 | } |
294 | " | 294 | " |
295 | ), | 295 | ), |
296 | @r###" | 296 | @r###" |
297 | ⋮[ | 297 | ⋮[ |
298 | ⋮ CompletionItem { | 298 | ⋮ CompletionItem { |
299 | ⋮ label: "T", | 299 | ⋮ label: "T", |
@@ -311,22 +311,22 @@ mod tests { | |||
311 | ⋮ }, | 311 | ⋮ }, |
312 | ⋮] | 312 | ⋮] |
313 | "### | 313 | "### |
314 | ); | 314 | ); |
315 | } | 315 | } |
316 | 316 | ||
317 | #[test] | 317 | #[test] |
318 | fn completes_module_items() { | 318 | fn completes_module_items() { |
319 | assert_debug_snapshot_matches!( | 319 | assert_debug_snapshot_matches!( |
320 | do_reference_completion( | 320 | do_reference_completion( |
321 | r" | 321 | r" |
322 | struct Foo; | 322 | struct Foo; |
323 | enum Baz {} | 323 | enum Baz {} |
324 | fn quux() { | 324 | fn quux() { |
325 | <|> | 325 | <|> |
326 | } | 326 | } |
327 | " | 327 | " |
328 | ), | 328 | ), |
329 | @r###" | 329 | @r###" |
330 | ⋮[ | 330 | ⋮[ |
331 | ⋮ CompletionItem { | 331 | ⋮ CompletionItem { |
332 | ⋮ label: "Baz", | 332 | ⋮ label: "Baz", |
@@ -352,22 +352,22 @@ mod tests { | |||
352 | ⋮ }, | 352 | ⋮ }, |
353 | ⋮] | 353 | ⋮] |
354 | "### | 354 | "### |
355 | ); | 355 | ); |
356 | } | 356 | } |
357 | 357 | ||
358 | #[test] | 358 | #[test] |
359 | fn completes_extern_prelude() { | 359 | fn completes_extern_prelude() { |
360 | assert_debug_snapshot_matches!( | 360 | assert_debug_snapshot_matches!( |
361 | do_reference_completion( | 361 | do_reference_completion( |
362 | r" | 362 | r" |
363 | //- /lib.rs | 363 | //- /lib.rs |
364 | use <|>; | 364 | use <|>; |
365 | 365 | ||
366 | //- /other_crate/lib.rs | 366 | //- /other_crate/lib.rs |
367 | // nothing here | 367 | // nothing here |
368 | " | 368 | " |
369 | ), | 369 | ), |
370 | @r#"[ | 370 | @r#"[ |
371 | CompletionItem { | 371 | CompletionItem { |
372 | label: "other_crate", | 372 | label: "other_crate", |
373 | source_range: [4; 4), | 373 | source_range: [4; 4), |
@@ -376,22 +376,22 @@ mod tests { | |||
376 | kind: Module, | 376 | kind: Module, |
377 | }, | 377 | }, |
378 | ]"# | 378 | ]"# |
379 | ); | 379 | ); |
380 | } | 380 | } |
381 | 381 | ||
382 | #[test] | 382 | #[test] |
383 | fn completes_module_items_in_nested_modules() { | 383 | fn completes_module_items_in_nested_modules() { |
384 | assert_debug_snapshot_matches!( | 384 | assert_debug_snapshot_matches!( |
385 | do_reference_completion( | 385 | do_reference_completion( |
386 | r" | 386 | r" |
387 | struct Foo; | 387 | struct Foo; |
388 | mod m { | 388 | mod m { |
389 | struct Bar; | 389 | struct Bar; |
390 | fn quux() { <|> } | 390 | fn quux() { <|> } |
391 | } | 391 | } |
392 | " | 392 | " |
393 | ), | 393 | ), |
394 | @r###" | 394 | @r###" |
395 | ⋮[ | 395 | ⋮[ |
396 | ⋮ CompletionItem { | 396 | ⋮ CompletionItem { |
397 | ⋮ label: "Bar", | 397 | ⋮ label: "Bar", |
@@ -410,19 +410,19 @@ mod tests { | |||
410 | ⋮ }, | 410 | ⋮ }, |
411 | ⋮] | 411 | ⋮] |
412 | "### | 412 | "### |
413 | ); | 413 | ); |
414 | } | 414 | } |
415 | 415 | ||
416 | #[test] | 416 | #[test] |
417 | fn completes_return_type() { | 417 | fn completes_return_type() { |
418 | assert_debug_snapshot_matches!( | 418 | assert_debug_snapshot_matches!( |
419 | do_reference_completion( | 419 | do_reference_completion( |
420 | r" | 420 | r" |
421 | struct Foo; | 421 | struct Foo; |
422 | fn x() -> <|> | 422 | fn x() -> <|> |
423 | " | 423 | " |
424 | ), | 424 | ), |
425 | @r###" | 425 | @r###" |
426 | ⋮[ | 426 | ⋮[ |
427 | ⋮ CompletionItem { | 427 | ⋮ CompletionItem { |
428 | ⋮ label: "Foo", | 428 | ⋮ label: "Foo", |
@@ -441,14 +441,14 @@ mod tests { | |||
441 | ⋮ }, | 441 | ⋮ }, |
442 | ⋮] | 442 | ⋮] |
443 | "### | 443 | "### |
444 | ); | 444 | ); |
445 | } | 445 | } |
446 | 446 | ||
447 | #[test] | 447 | #[test] |
448 | fn dont_show_both_completions_for_shadowing() { | 448 | fn dont_show_both_completions_for_shadowing() { |
449 | assert_debug_snapshot_matches!( | 449 | assert_debug_snapshot_matches!( |
450 | do_reference_completion( | 450 | do_reference_completion( |
451 | r" | 451 | r" |
452 | fn foo() { | 452 | fn foo() { |
453 | let bar = 92; | 453 | let bar = 92; |
454 | { | 454 | { |
@@ -457,8 +457,8 @@ mod tests { | |||
457 | } | 457 | } |
458 | } | 458 | } |
459 | " | 459 | " |
460 | ), | 460 | ), |
461 | @r###" | 461 | @r###" |
462 | ⋮[ | 462 | ⋮[ |
463 | ⋮ CompletionItem { | 463 | ⋮ CompletionItem { |
464 | ⋮ label: "bar", | 464 | ⋮ label: "bar", |
@@ -478,14 +478,14 @@ mod tests { | |||
478 | ⋮ }, | 478 | ⋮ }, |
479 | ⋮] | 479 | ⋮] |
480 | "### | 480 | "### |
481 | ); | 481 | ); |
482 | } | 482 | } |
483 | 483 | ||
484 | #[test] | 484 | #[test] |
485 | fn completes_self_in_methods() { | 485 | fn completes_self_in_methods() { |
486 | assert_debug_snapshot_matches!( | 486 | assert_debug_snapshot_matches!( |
487 | do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), | 487 | do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), |
488 | @r#"[ | 488 | @r#"[ |
489 | CompletionItem { | 489 | CompletionItem { |
490 | label: "Self", | 490 | label: "Self", |
491 | source_range: [25; 25), | 491 | source_range: [25; 25), |
@@ -502,14 +502,14 @@ mod tests { | |||
502 | detail: "&{unknown}", | 502 | detail: "&{unknown}", |
503 | }, | 503 | }, |
504 | ]"# | 504 | ]"# |
505 | ); | 505 | ); |
506 | } | 506 | } |
507 | 507 | ||
508 | #[test] | 508 | #[test] |
509 | fn completes_prelude() { | 509 | fn completes_prelude() { |
510 | assert_debug_snapshot_matches!( | 510 | assert_debug_snapshot_matches!( |
511 | do_reference_completion( | 511 | do_reference_completion( |
512 | " | 512 | " |
513 | //- /main.rs | 513 | //- /main.rs |
514 | fn foo() { let x: <|> } | 514 | fn foo() { let x: <|> } |
515 | 515 | ||
@@ -521,8 +521,8 @@ mod tests { | |||
521 | struct Option; | 521 | struct Option; |
522 | } | 522 | } |
523 | " | 523 | " |
524 | ), | 524 | ), |
525 | @r#"[ | 525 | @r#"[ |
526 | CompletionItem { | 526 | CompletionItem { |
527 | label: "Option", | 527 | label: "Option", |
528 | source_range: [18; 18), | 528 | source_range: [18; 18), |
@@ -546,6 +546,6 @@ mod tests { | |||
546 | kind: Module, | 546 | kind: Module, |
547 | }, | 547 | }, |
548 | ]"# | 548 | ]"# |
549 | ); | 549 | ); |
550 | } | 550 | } |
551 | } | 551 | } |
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index 063b69319..e0368b3b2 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs | |||
@@ -40,7 +40,7 @@ fn ${1:feature}() { | |||
40 | #[cfg(test)] | 40 | #[cfg(test)] |
41 | mod tests { | 41 | mod tests { |
42 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; | 42 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; |
43 | use insta::assert_debug_snapshot_matches; | 43 | use insta::assert_debug_snapshot_matches; |
44 | 44 | ||
45 | fn do_snippet_completion(code: &str) -> Vec<CompletionItem> { | 45 | fn do_snippet_completion(code: &str) -> Vec<CompletionItem> { |
46 | do_completion(code, CompletionKind::Snippet) | 46 | do_completion(code, CompletionKind::Snippet) |
@@ -49,8 +49,8 @@ mod tests { | |||
49 | #[test] | 49 | #[test] |
50 | fn completes_snippets_in_expressions() { | 50 | fn completes_snippets_in_expressions() { |
51 | assert_debug_snapshot_matches!( | 51 | assert_debug_snapshot_matches!( |
52 | do_snippet_completion(r"fn foo(x: i32) { <|> }"), | 52 | do_snippet_completion(r"fn foo(x: i32) { <|> }"), |
53 | @r#"[ | 53 | @r#"[ |
54 | CompletionItem { | 54 | CompletionItem { |
55 | label: "pd", | 55 | label: "pd", |
56 | source_range: [17; 17), | 56 | source_range: [17; 17), |
@@ -66,33 +66,33 @@ mod tests { | |||
66 | kind: Snippet, | 66 | kind: Snippet, |
67 | }, | 67 | }, |
68 | ]"# | 68 | ]"# |
69 | ); | 69 | ); |
70 | } | 70 | } |
71 | 71 | ||
72 | #[test] | 72 | #[test] |
73 | fn should_not_complete_snippets_in_path() { | 73 | fn should_not_complete_snippets_in_path() { |
74 | assert_debug_snapshot_matches!( | 74 | assert_debug_snapshot_matches!( |
75 | do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), | 75 | do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), |
76 | @r#"[]"# | 76 | @r#"[]"# |
77 | ); | 77 | ); |
78 | assert_debug_snapshot_matches!( | 78 | assert_debug_snapshot_matches!( |
79 | do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), | 79 | do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), |
80 | @r#"[]"# | 80 | @r#"[]"# |
81 | ); | 81 | ); |
82 | } | 82 | } |
83 | 83 | ||
84 | #[test] | 84 | #[test] |
85 | fn completes_snippets_in_items() { | 85 | fn completes_snippets_in_items() { |
86 | assert_debug_snapshot_matches!( | 86 | assert_debug_snapshot_matches!( |
87 | do_snippet_completion( | 87 | do_snippet_completion( |
88 | r" | 88 | r" |
89 | #[cfg(test)] | 89 | #[cfg(test)] |
90 | mod tests { | 90 | mod tests { |
91 | <|> | 91 | <|> |
92 | } | 92 | } |
93 | " | 93 | " |
94 | ), | 94 | ), |
95 | @r###" | 95 | @r###" |
96 | ⋮[ | 96 | ⋮[ |
97 | ⋮ CompletionItem { | 97 | ⋮ CompletionItem { |
98 | ⋮ label: "Test function", | 98 | ⋮ label: "Test function", |
@@ -111,6 +111,6 @@ mod tests { | |||
111 | ⋮ }, | 111 | ⋮ }, |
112 | ⋮] | 112 | ⋮] |
113 | "### | 113 | "### |
114 | ); | 114 | ); |
115 | } | 115 | } |
116 | } | 116 | } |
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index fe7581adf..5df19990c 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -182,9 +182,9 @@ impl Completions { | |||
182 | 182 | ||
183 | #[cfg(test)] | 183 | #[cfg(test)] |
184 | mod tests { | 184 | mod tests { |
185 | use test_utils::covers; | ||
186 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; | 185 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; |
187 | use insta::assert_debug_snapshot_matches; | 186 | use insta::assert_debug_snapshot_matches; |
187 | use test_utils::covers; | ||
188 | 188 | ||
189 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { | 189 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { |
190 | do_completion(code, CompletionKind::Reference) | 190 | do_completion(code, CompletionKind::Reference) |
@@ -194,13 +194,13 @@ mod tests { | |||
194 | fn inserts_parens_for_function_calls() { | 194 | fn inserts_parens_for_function_calls() { |
195 | covers!(inserts_parens_for_function_calls); | 195 | covers!(inserts_parens_for_function_calls); |
196 | assert_debug_snapshot_matches!( | 196 | assert_debug_snapshot_matches!( |
197 | do_reference_completion( | 197 | do_reference_completion( |
198 | r" | 198 | r" |
199 | fn no_args() {} | 199 | fn no_args() {} |
200 | fn main() { no_<|> } | 200 | fn main() { no_<|> } |
201 | " | 201 | " |
202 | ), | 202 | ), |
203 | @r###" | 203 | @r###" |
204 | ⋮[ | 204 | ⋮[ |
205 | ⋮ CompletionItem { | 205 | ⋮ CompletionItem { |
206 | ⋮ label: "main", | 206 | ⋮ label: "main", |
@@ -220,15 +220,15 @@ mod tests { | |||
220 | ⋮ }, | 220 | ⋮ }, |
221 | ⋮] | 221 | ⋮] |
222 | "### | 222 | "### |
223 | ); | 223 | ); |
224 | assert_debug_snapshot_matches!( | 224 | assert_debug_snapshot_matches!( |
225 | do_reference_completion( | 225 | do_reference_completion( |
226 | r" | 226 | r" |
227 | fn with_args(x: i32, y: String) {} | 227 | fn with_args(x: i32, y: String) {} |
228 | fn main() { with_<|> } | 228 | fn main() { with_<|> } |
229 | " | 229 | " |
230 | ), | 230 | ), |
231 | @r###" | 231 | @r###" |
232 | ⋮[ | 232 | ⋮[ |
233 | ⋮ CompletionItem { | 233 | ⋮ CompletionItem { |
234 | ⋮ label: "main", | 234 | ⋮ label: "main", |
@@ -248,10 +248,10 @@ mod tests { | |||
248 | ⋮ }, | 248 | ⋮ }, |
249 | ⋮] | 249 | ⋮] |
250 | "### | 250 | "### |
251 | ); | 251 | ); |
252 | assert_debug_snapshot_matches!( | 252 | assert_debug_snapshot_matches!( |
253 | do_reference_completion( | 253 | do_reference_completion( |
254 | r" | 254 | r" |
255 | struct S {} | 255 | struct S {} |
256 | impl S { | 256 | impl S { |
257 | fn foo(&self) {} | 257 | fn foo(&self) {} |
@@ -260,8 +260,8 @@ mod tests { | |||
260 | s.f<|> | 260 | s.f<|> |
261 | } | 261 | } |
262 | " | 262 | " |
263 | ), | 263 | ), |
264 | @r###" | 264 | @r###" |
265 | ⋮[ | 265 | ⋮[ |
266 | ⋮ CompletionItem { | 266 | ⋮ CompletionItem { |
267 | ⋮ label: "foo", | 267 | ⋮ label: "foo", |
@@ -273,20 +273,20 @@ mod tests { | |||
273 | ⋮ }, | 273 | ⋮ }, |
274 | ⋮] | 274 | ⋮] |
275 | "### | 275 | "### |
276 | ); | 276 | ); |
277 | } | 277 | } |
278 | 278 | ||
279 | #[test] | 279 | #[test] |
280 | fn dont_render_function_parens_in_use_item() { | 280 | fn dont_render_function_parens_in_use_item() { |
281 | assert_debug_snapshot_matches!( | 281 | assert_debug_snapshot_matches!( |
282 | do_reference_completion( | 282 | do_reference_completion( |
283 | " | 283 | " |
284 | //- /lib.rs | 284 | //- /lib.rs |
285 | mod m { pub fn foo() {} } | 285 | mod m { pub fn foo() {} } |
286 | use crate::m::f<|>; | 286 | use crate::m::f<|>; |
287 | " | 287 | " |
288 | ), | 288 | ), |
289 | @r#"[ | 289 | @r#"[ |
290 | CompletionItem { | 290 | CompletionItem { |
291 | label: "foo", | 291 | label: "foo", |
292 | source_range: [40; 41), | 292 | source_range: [40; 41), |
@@ -296,22 +296,22 @@ mod tests { | |||
296 | detail: "pub fn foo()", | 296 | detail: "pub fn foo()", |
297 | }, | 297 | }, |
298 | ]"# | 298 | ]"# |
299 | ); | 299 | ); |
300 | } | 300 | } |
301 | 301 | ||
302 | #[test] | 302 | #[test] |
303 | fn dont_render_function_parens_if_already_call() { | 303 | fn dont_render_function_parens_if_already_call() { |
304 | assert_debug_snapshot_matches!( | 304 | assert_debug_snapshot_matches!( |
305 | do_reference_completion( | 305 | do_reference_completion( |
306 | " | 306 | " |
307 | //- /lib.rs | 307 | //- /lib.rs |
308 | fn frobnicate() {} | 308 | fn frobnicate() {} |
309 | fn main() { | 309 | fn main() { |
310 | frob<|>(); | 310 | frob<|>(); |
311 | } | 311 | } |
312 | " | 312 | " |
313 | ), | 313 | ), |
314 | @r#"[ | 314 | @r#"[ |
315 | CompletionItem { | 315 | CompletionItem { |
316 | label: "frobnicate", | 316 | label: "frobnicate", |
317 | source_range: [35; 39), | 317 | source_range: [35; 39), |
@@ -329,10 +329,10 @@ mod tests { | |||
329 | detail: "fn main()", | 329 | detail: "fn main()", |
330 | }, | 330 | }, |
331 | ]"# | 331 | ]"# |
332 | ); | 332 | ); |
333 | assert_debug_snapshot_matches!( | 333 | assert_debug_snapshot_matches!( |
334 | do_reference_completion( | 334 | do_reference_completion( |
335 | " | 335 | " |
336 | //- /lib.rs | 336 | //- /lib.rs |
337 | struct Foo {} | 337 | struct Foo {} |
338 | impl Foo { fn new() -> Foo {} } | 338 | impl Foo { fn new() -> Foo {} } |
@@ -340,8 +340,8 @@ mod tests { | |||
340 | Foo::ne<|>(); | 340 | Foo::ne<|>(); |
341 | } | 341 | } |
342 | " | 342 | " |
343 | ), | 343 | ), |
344 | @r#"[ | 344 | @r#"[ |
345 | CompletionItem { | 345 | CompletionItem { |
346 | label: "new", | 346 | label: "new", |
347 | source_range: [67; 69), | 347 | source_range: [67; 69), |
@@ -351,6 +351,6 @@ mod tests { | |||
351 | detail: "fn new() -> Foo", | 351 | detail: "fn new() -> Foo", |
352 | }, | 352 | }, |
353 | ]"# | 353 | ]"# |
354 | ); | 354 | ); |
355 | } | 355 | } |
356 | } | 356 | } |
diff --git a/crates/ra_ide_api/src/display/structure.rs b/crates/ra_ide_api/src/display/structure.rs index 38e1fe323..b026dfa59 100644 --- a/crates/ra_ide_api/src/display/structure.rs +++ b/crates/ra_ide_api/src/display/structure.rs | |||
@@ -205,7 +205,7 @@ fn very_obsolete() {} | |||
205 | .unwrap(); | 205 | .unwrap(); |
206 | let structure = file_structure(&file); | 206 | let structure = file_structure(&file); |
207 | assert_debug_snapshot_matches!(structure, | 207 | assert_debug_snapshot_matches!(structure, |
208 | @r#"[ | 208 | @r#"[ |
209 | StructureNode { | 209 | StructureNode { |
210 | parent: None, | 210 | parent: None, |
211 | label: "Foo", | 211 | label: "Foo", |
@@ -390,6 +390,6 @@ fn very_obsolete() {} | |||
390 | deprecated: true, | 390 | deprecated: true, |
391 | }, | 391 | }, |
392 | ]"# | 392 | ]"# |
393 | ); | 393 | ); |
394 | } | 394 | } |
395 | } | 395 | } |
diff --git a/crates/ra_ide_api/src/runnables.rs b/crates/ra_ide_api/src/runnables.rs index 7a3a574ad..09c082de9 100644 --- a/crates/ra_ide_api/src/runnables.rs +++ b/crates/ra_ide_api/src/runnables.rs | |||
@@ -93,7 +93,7 @@ mod tests { | |||
93 | ); | 93 | ); |
94 | let runnables = analysis.runnables(pos.file_id).unwrap(); | 94 | let runnables = analysis.runnables(pos.file_id).unwrap(); |
95 | assert_debug_snapshot_matches!(&runnables, | 95 | assert_debug_snapshot_matches!(&runnables, |
96 | @r#"[ | 96 | @r#"[ |
97 | Runnable { | 97 | Runnable { |
98 | range: [1; 21), | 98 | range: [1; 21), |
99 | kind: Bin, | 99 | kind: Bin, |
@@ -111,7 +111,7 @@ mod tests { | |||
111 | }, | 111 | }, |
112 | }, | 112 | }, |
113 | ]"# | 113 | ]"# |
114 | ); | 114 | ); |
115 | } | 115 | } |
116 | 116 | ||
117 | #[test] | 117 | #[test] |
@@ -127,8 +127,8 @@ mod tests { | |||
127 | "#, | 127 | "#, |
128 | ); | 128 | ); |
129 | let runnables = analysis.runnables(pos.file_id).unwrap(); | 129 | let runnables = analysis.runnables(pos.file_id).unwrap(); |
130 | assert_debug_snapshot_matches!(&runnables, | 130 | assert_debug_snapshot_matches!(&runnables, |
131 | @r#"[ | 131 | @r#"[ |
132 | Runnable { | 132 | Runnable { |
133 | range: [1; 59), | 133 | range: [1; 59), |
134 | kind: TestMod { | 134 | kind: TestMod { |
@@ -142,7 +142,7 @@ mod tests { | |||
142 | }, | 142 | }, |
143 | }, | 143 | }, |
144 | ]"# | 144 | ]"# |
145 | ); | 145 | ); |
146 | } | 146 | } |
147 | 147 | ||
148 | #[test] | 148 | #[test] |
@@ -161,7 +161,7 @@ mod tests { | |||
161 | ); | 161 | ); |
162 | let runnables = analysis.runnables(pos.file_id).unwrap(); | 162 | let runnables = analysis.runnables(pos.file_id).unwrap(); |
163 | assert_debug_snapshot_matches!(&runnables, | 163 | assert_debug_snapshot_matches!(&runnables, |
164 | @r#"[ | 164 | @r#"[ |
165 | Runnable { | 165 | Runnable { |
166 | range: [23; 85), | 166 | range: [23; 85), |
167 | kind: TestMod { | 167 | kind: TestMod { |
@@ -175,7 +175,7 @@ mod tests { | |||
175 | }, | 175 | }, |
176 | }, | 176 | }, |
177 | ]"# | 177 | ]"# |
178 | ); | 178 | ); |
179 | } | 179 | } |
180 | 180 | ||
181 | #[test] | 181 | #[test] |
@@ -196,7 +196,7 @@ mod tests { | |||
196 | ); | 196 | ); |
197 | let runnables = analysis.runnables(pos.file_id).unwrap(); | 197 | let runnables = analysis.runnables(pos.file_id).unwrap(); |
198 | assert_debug_snapshot_matches!(&runnables, | 198 | assert_debug_snapshot_matches!(&runnables, |
199 | @r#"[ | 199 | @r#"[ |
200 | Runnable { | 200 | Runnable { |
201 | range: [41; 115), | 201 | range: [41; 115), |
202 | kind: TestMod { | 202 | kind: TestMod { |
@@ -210,7 +210,7 @@ mod tests { | |||
210 | }, | 210 | }, |
211 | }, | 211 | }, |
212 | ]"# | 212 | ]"# |
213 | ); | 213 | ); |
214 | } | 214 | } |
215 | 215 | ||
216 | #[test] | 216 | #[test] |