diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-29 13:54:40 +0100 |
---|---|---|
committer | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-07-29 13:54:40 +0100 |
commit | 359b3376b32b38548c71e2b6e3a7393c4396ccf6 (patch) | |
tree | 7465f676da27b6ddc1421e901d41a4e44def0059 /crates/ra_ide_api/src/completion | |
parent | 9e2925f340bfd109ce31e8e454187df30e609a60 (diff) | |
parent | 67e75ca1261863d21b48620e36b1632043ef36f9 (diff) |
Merge #1601
1601: Inline snapshots for tests r=matklad a=theotherphil
Fixes https://github.com/rust-analyzer/rust-analyzer/issues/1127.
The "cargo format" commits are required to get the formatting tests to pass. However, they actually mess up the formatting.
Co-authored-by: Phil Ellison <[email protected]>
Diffstat (limited to 'crates/ra_ide_api/src/completion')
26 files changed, 547 insertions, 661 deletions
diff --git a/crates/ra_ide_api/src/completion/complete_scope.rs b/crates/ra_ide_api/src/completion/complete_scope.rs index f92034055..2000d953a 100644 --- a/crates/ra_ide_api/src/completion/complete_scope.rs +++ b/crates/ra_ide_api/src/completion/complete_scope.rs | |||
@@ -121,172 +121,413 @@ impl ImportResolver { | |||
121 | 121 | ||
122 | #[cfg(test)] | 122 | #[cfg(test)] |
123 | mod tests { | 123 | mod tests { |
124 | use crate::completion::{check_completion, CompletionKind}; | 124 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; |
125 | use insta::assert_debug_snapshot_matches; | ||
125 | 126 | ||
126 | fn check_reference_completion(name: &str, code: &str) { | 127 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { |
127 | check_completion(name, code, CompletionKind::Reference); | 128 | do_completion(code, CompletionKind::Reference) |
128 | } | 129 | } |
129 | 130 | ||
130 | #[test] | 131 | #[test] |
131 | fn completes_bindings_from_let() { | 132 | fn completes_bindings_from_let() { |
132 | check_reference_completion( | 133 | assert_debug_snapshot_matches!( |
133 | "bindings_from_let", | 134 | do_reference_completion( |
134 | r" | 135 | r" |
135 | fn quux(x: i32) { | 136 | fn quux(x: i32) { |
136 | let y = 92; | 137 | let y = 92; |
137 | 1 + <|>; | 138 | 1 + <|>; |
138 | let z = (); | 139 | let z = (); |
139 | } | 140 | } |
140 | ", | 141 | " |
142 | ), | ||
143 | @r###"[ | ||
144 | CompletionItem { | ||
145 | label: "quux", | ||
146 | source_range: [91; 91), | ||
147 | delete: [91; 91), | ||
148 | insert: "quux($0)", | ||
149 | kind: Function, | ||
150 | detail: "fn quux(x: i32)", | ||
151 | }, | ||
152 | CompletionItem { | ||
153 | label: "x", | ||
154 | source_range: [91; 91), | ||
155 | delete: [91; 91), | ||
156 | insert: "x", | ||
157 | kind: Binding, | ||
158 | detail: "i32", | ||
159 | }, | ||
160 | CompletionItem { | ||
161 | label: "y", | ||
162 | source_range: [91; 91), | ||
163 | delete: [91; 91), | ||
164 | insert: "y", | ||
165 | kind: Binding, | ||
166 | detail: "i32", | ||
167 | }, | ||
168 | ]"### | ||
141 | ); | 169 | ); |
142 | } | 170 | } |
143 | 171 | ||
144 | #[test] | 172 | #[test] |
145 | fn completes_bindings_from_if_let() { | 173 | fn completes_bindings_from_if_let() { |
146 | check_reference_completion( | 174 | assert_debug_snapshot_matches!( |
147 | "bindings_from_if_let", | 175 | do_reference_completion( |
148 | r" | 176 | r" |
149 | fn quux() { | 177 | fn quux() { |
150 | if let Some(x) = foo() { | 178 | if let Some(x) = foo() { |
151 | let y = 92; | 179 | let y = 92; |
152 | }; | 180 | }; |
153 | if let Some(a) = bar() { | 181 | if let Some(a) = bar() { |
154 | let b = 62; | 182 | let b = 62; |
155 | 1 + <|> | 183 | 1 + <|> |
184 | } | ||
156 | } | 185 | } |
157 | } | 186 | " |
158 | ", | 187 | ), |
188 | @r###"[ | ||
189 | CompletionItem { | ||
190 | label: "a", | ||
191 | source_range: [242; 242), | ||
192 | delete: [242; 242), | ||
193 | insert: "a", | ||
194 | kind: Binding, | ||
195 | }, | ||
196 | CompletionItem { | ||
197 | label: "b", | ||
198 | source_range: [242; 242), | ||
199 | delete: [242; 242), | ||
200 | insert: "b", | ||
201 | kind: Binding, | ||
202 | detail: "i32", | ||
203 | }, | ||
204 | CompletionItem { | ||
205 | label: "quux", | ||
206 | source_range: [242; 242), | ||
207 | delete: [242; 242), | ||
208 | insert: "quux()$0", | ||
209 | kind: Function, | ||
210 | detail: "fn quux()", | ||
211 | }, | ||
212 | ]"### | ||
159 | ); | 213 | ); |
160 | } | 214 | } |
161 | 215 | ||
162 | #[test] | 216 | #[test] |
163 | fn completes_bindings_from_for() { | 217 | fn completes_bindings_from_for() { |
164 | check_reference_completion( | 218 | assert_debug_snapshot_matches!( |
165 | "bindings_from_for", | 219 | do_reference_completion( |
166 | r" | 220 | r" |
167 | fn quux() { | 221 | fn quux() { |
168 | for x in &[1, 2, 3] { | 222 | for x in &[1, 2, 3] { |
169 | <|> | 223 | <|> |
224 | } | ||
170 | } | 225 | } |
171 | } | 226 | " |
172 | ", | 227 | ), |
228 | @r###"[ | ||
229 | CompletionItem { | ||
230 | label: "quux", | ||
231 | source_range: [95; 95), | ||
232 | delete: [95; 95), | ||
233 | insert: "quux()$0", | ||
234 | kind: Function, | ||
235 | detail: "fn quux()", | ||
236 | }, | ||
237 | CompletionItem { | ||
238 | label: "x", | ||
239 | source_range: [95; 95), | ||
240 | delete: [95; 95), | ||
241 | insert: "x", | ||
242 | kind: Binding, | ||
243 | }, | ||
244 | ]"### | ||
173 | ); | 245 | ); |
174 | } | 246 | } |
175 | 247 | ||
176 | #[test] | 248 | #[test] |
177 | fn completes_generic_params() { | 249 | fn completes_generic_params() { |
178 | check_reference_completion( | 250 | assert_debug_snapshot_matches!( |
179 | "generic_params", | 251 | do_reference_completion( |
180 | r" | 252 | r" |
181 | fn quux<T>() { | 253 | fn quux<T>() { |
182 | <|> | 254 | <|> |
183 | } | 255 | } |
184 | ", | 256 | " |
257 | ), | ||
258 | @r###"[ | ||
259 | CompletionItem { | ||
260 | label: "T", | ||
261 | source_range: [52; 52), | ||
262 | delete: [52; 52), | ||
263 | insert: "T", | ||
264 | kind: TypeParam, | ||
265 | }, | ||
266 | CompletionItem { | ||
267 | label: "quux", | ||
268 | source_range: [52; 52), | ||
269 | delete: [52; 52), | ||
270 | insert: "quux()$0", | ||
271 | kind: Function, | ||
272 | detail: "fn quux<T>()", | ||
273 | }, | ||
274 | ]"### | ||
185 | ); | 275 | ); |
186 | } | 276 | } |
187 | 277 | ||
188 | #[test] | 278 | #[test] |
189 | fn completes_generic_params_in_struct() { | 279 | fn completes_generic_params_in_struct() { |
190 | check_reference_completion( | 280 | assert_debug_snapshot_matches!( |
191 | "generic_params_in_struct", | 281 | do_reference_completion( |
192 | r" | 282 | r" |
193 | struct X<T> { | 283 | struct X<T> { |
194 | x: <|> | 284 | x: <|> |
195 | } | 285 | } |
196 | ", | 286 | " |
287 | ), | ||
288 | @r###"[ | ||
289 | CompletionItem { | ||
290 | label: "T", | ||
291 | source_range: [54; 54), | ||
292 | delete: [54; 54), | ||
293 | insert: "T", | ||
294 | kind: TypeParam, | ||
295 | }, | ||
296 | CompletionItem { | ||
297 | label: "X", | ||
298 | source_range: [54; 54), | ||
299 | delete: [54; 54), | ||
300 | insert: "X", | ||
301 | kind: Struct, | ||
302 | }, | ||
303 | ]"### | ||
197 | ); | 304 | ); |
198 | } | 305 | } |
199 | 306 | ||
200 | #[test] | 307 | #[test] |
201 | fn completes_module_items() { | 308 | fn completes_module_items() { |
202 | check_reference_completion( | 309 | assert_debug_snapshot_matches!( |
203 | "module_items", | 310 | do_reference_completion( |
204 | r" | 311 | r" |
205 | struct Foo; | 312 | struct Foo; |
206 | enum Baz {} | 313 | enum Baz {} |
207 | fn quux() { | 314 | fn quux() { |
208 | <|> | 315 | <|> |
209 | } | 316 | } |
210 | ", | 317 | " |
211 | ); | 318 | ), |
319 | @r###"[ | ||
320 | CompletionItem { | ||
321 | label: "Baz", | ||
322 | source_range: [105; 105), | ||
323 | delete: [105; 105), | ||
324 | insert: "Baz", | ||
325 | kind: Enum, | ||
326 | }, | ||
327 | CompletionItem { | ||
328 | label: "Foo", | ||
329 | source_range: [105; 105), | ||
330 | delete: [105; 105), | ||
331 | insert: "Foo", | ||
332 | kind: Struct, | ||
333 | }, | ||
334 | CompletionItem { | ||
335 | label: "quux", | ||
336 | source_range: [105; 105), | ||
337 | delete: [105; 105), | ||
338 | insert: "quux()$0", | ||
339 | kind: Function, | ||
340 | detail: "fn quux()", | ||
341 | }, | ||
342 | ]"### | ||
343 | ); | ||
212 | } | 344 | } |
213 | 345 | ||
214 | #[test] | 346 | #[test] |
215 | fn completes_extern_prelude() { | 347 | fn completes_extern_prelude() { |
216 | check_reference_completion( | 348 | assert_debug_snapshot_matches!( |
217 | "extern_prelude", | 349 | do_reference_completion( |
218 | r" | 350 | r" |
219 | //- /lib.rs | 351 | //- /lib.rs |
220 | use <|>; | 352 | use <|>; |
221 | 353 | ||
222 | //- /other_crate/lib.rs | 354 | //- /other_crate/lib.rs |
223 | // nothing here | 355 | // nothing here |
224 | ", | 356 | " |
357 | ), | ||
358 | @r#"[ | ||
359 | CompletionItem { | ||
360 | label: "other_crate", | ||
361 | source_range: [4; 4), | ||
362 | delete: [4; 4), | ||
363 | insert: "other_crate", | ||
364 | kind: Module, | ||
365 | }, | ||
366 | ]"# | ||
225 | ); | 367 | ); |
226 | } | 368 | } |
227 | 369 | ||
228 | #[test] | 370 | #[test] |
229 | fn completes_module_items_in_nested_modules() { | 371 | fn completes_module_items_in_nested_modules() { |
230 | check_reference_completion( | 372 | assert_debug_snapshot_matches!( |
231 | "module_items_in_nested_modules", | 373 | do_reference_completion( |
232 | r" | 374 | r" |
233 | struct Foo; | 375 | struct Foo; |
234 | mod m { | 376 | mod m { |
235 | struct Bar; | 377 | struct Bar; |
236 | fn quux() { <|> } | 378 | fn quux() { <|> } |
237 | } | 379 | } |
238 | ", | 380 | " |
381 | ), | ||
382 | @r###"[ | ||
383 | CompletionItem { | ||
384 | label: "Bar", | ||
385 | source_range: [117; 117), | ||
386 | delete: [117; 117), | ||
387 | insert: "Bar", | ||
388 | kind: Struct, | ||
389 | }, | ||
390 | CompletionItem { | ||
391 | label: "quux", | ||
392 | source_range: [117; 117), | ||
393 | delete: [117; 117), | ||
394 | insert: "quux()$0", | ||
395 | kind: Function, | ||
396 | detail: "fn quux()", | ||
397 | }, | ||
398 | ]"### | ||
239 | ); | 399 | ); |
240 | } | 400 | } |
241 | 401 | ||
242 | #[test] | 402 | #[test] |
243 | fn completes_return_type() { | 403 | fn completes_return_type() { |
244 | check_reference_completion( | 404 | assert_debug_snapshot_matches!( |
245 | "return_type", | 405 | do_reference_completion( |
246 | r" | 406 | r" |
247 | struct Foo; | 407 | struct Foo; |
248 | fn x() -> <|> | 408 | fn x() -> <|> |
249 | ", | 409 | " |
250 | ) | 410 | ), |
411 | @r###"[ | ||
412 | CompletionItem { | ||
413 | label: "Foo", | ||
414 | source_range: [55; 55), | ||
415 | delete: [55; 55), | ||
416 | insert: "Foo", | ||
417 | kind: Struct, | ||
418 | }, | ||
419 | CompletionItem { | ||
420 | label: "x", | ||
421 | source_range: [55; 55), | ||
422 | delete: [55; 55), | ||
423 | insert: "x()$0", | ||
424 | kind: Function, | ||
425 | detail: "fn x()", | ||
426 | }, | ||
427 | ]"### | ||
428 | ); | ||
251 | } | 429 | } |
252 | 430 | ||
253 | #[test] | 431 | #[test] |
254 | fn dont_show_both_completions_for_shadowing() { | 432 | fn dont_show_both_completions_for_shadowing() { |
255 | check_reference_completion( | 433 | assert_debug_snapshot_matches!( |
256 | "dont_show_both_completions_for_shadowing", | 434 | do_reference_completion( |
257 | r" | 435 | r" |
258 | fn foo() { | 436 | fn foo() { |
259 | let bar = 92; | 437 | let bar = 92; |
260 | { | 438 | { |
261 | let bar = 62; | 439 | let bar = 62; |
262 | <|> | 440 | <|> |
441 | } | ||
263 | } | 442 | } |
264 | } | 443 | " |
265 | ", | 444 | ), |
266 | ) | 445 | @r###"[ |
446 | CompletionItem { | ||
447 | label: "bar", | ||
448 | source_range: [146; 146), | ||
449 | delete: [146; 146), | ||
450 | insert: "bar", | ||
451 | kind: Binding, | ||
452 | detail: "i32", | ||
453 | }, | ||
454 | CompletionItem { | ||
455 | label: "foo", | ||
456 | source_range: [146; 146), | ||
457 | delete: [146; 146), | ||
458 | insert: "foo()$0", | ||
459 | kind: Function, | ||
460 | detail: "fn foo()", | ||
461 | }, | ||
462 | ]"### | ||
463 | ); | ||
267 | } | 464 | } |
268 | 465 | ||
269 | #[test] | 466 | #[test] |
270 | fn completes_self_in_methods() { | 467 | fn completes_self_in_methods() { |
271 | check_reference_completion("self_in_methods", r"impl S { fn foo(&self) { <|> } }") | 468 | assert_debug_snapshot_matches!( |
469 | do_reference_completion(r"impl S { fn foo(&self) { <|> } }"), | ||
470 | @r#"[ | ||
471 | CompletionItem { | ||
472 | label: "Self", | ||
473 | source_range: [25; 25), | ||
474 | delete: [25; 25), | ||
475 | insert: "Self", | ||
476 | kind: TypeParam, | ||
477 | }, | ||
478 | CompletionItem { | ||
479 | label: "self", | ||
480 | source_range: [25; 25), | ||
481 | delete: [25; 25), | ||
482 | insert: "self", | ||
483 | kind: Binding, | ||
484 | detail: "&{unknown}", | ||
485 | }, | ||
486 | ]"# | ||
487 | ); | ||
272 | } | 488 | } |
273 | 489 | ||
274 | #[test] | 490 | #[test] |
275 | fn completes_prelude() { | 491 | fn completes_prelude() { |
276 | check_reference_completion( | 492 | assert_debug_snapshot_matches!( |
277 | "completes_prelude", | 493 | do_reference_completion( |
278 | " | 494 | " |
279 | //- /main.rs | 495 | //- /main.rs |
280 | fn foo() { let x: <|> } | 496 | fn foo() { let x: <|> } |
281 | 497 | ||
282 | //- /std/lib.rs | 498 | //- /std/lib.rs |
283 | #[prelude_import] | 499 | #[prelude_import] |
284 | use prelude::*; | 500 | use prelude::*; |
285 | 501 | ||
286 | mod prelude { | 502 | mod prelude { |
287 | struct Option; | 503 | struct Option; |
288 | } | 504 | } |
289 | ", | 505 | " |
506 | ), | ||
507 | @r#"[ | ||
508 | CompletionItem { | ||
509 | label: "Option", | ||
510 | source_range: [18; 18), | ||
511 | delete: [18; 18), | ||
512 | insert: "Option", | ||
513 | kind: Struct, | ||
514 | }, | ||
515 | CompletionItem { | ||
516 | label: "foo", | ||
517 | source_range: [18; 18), | ||
518 | delete: [18; 18), | ||
519 | insert: "foo()$0", | ||
520 | kind: Function, | ||
521 | detail: "fn foo()", | ||
522 | }, | ||
523 | CompletionItem { | ||
524 | label: "std", | ||
525 | source_range: [18; 18), | ||
526 | delete: [18; 18), | ||
527 | insert: "std", | ||
528 | kind: Module, | ||
529 | }, | ||
530 | ]"# | ||
290 | ); | 531 | ); |
291 | } | 532 | } |
292 | } | 533 | } |
diff --git a/crates/ra_ide_api/src/completion/complete_snippet.rs b/crates/ra_ide_api/src/completion/complete_snippet.rs index d2d364b57..a35f31511 100644 --- a/crates/ra_ide_api/src/completion/complete_snippet.rs +++ b/crates/ra_ide_api/src/completion/complete_snippet.rs | |||
@@ -39,39 +39,76 @@ fn ${1:feature}() { | |||
39 | 39 | ||
40 | #[cfg(test)] | 40 | #[cfg(test)] |
41 | mod tests { | 41 | mod tests { |
42 | use crate::completion::{check_completion, CompletionKind}; | 42 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; |
43 | use insta::assert_debug_snapshot_matches; | ||
43 | 44 | ||
44 | fn check_snippet_completion(name: &str, code: &str) { | 45 | fn do_snippet_completion(code: &str) -> Vec<CompletionItem> { |
45 | check_completion(name, code, CompletionKind::Snippet); | 46 | do_completion(code, CompletionKind::Snippet) |
46 | } | 47 | } |
47 | 48 | ||
48 | #[test] | 49 | #[test] |
49 | fn completes_snippets_in_expressions() { | 50 | fn completes_snippets_in_expressions() { |
50 | check_snippet_completion("snippets_in_expressions", r"fn foo(x: i32) { <|> }"); | 51 | assert_debug_snapshot_matches!( |
52 | do_snippet_completion(r"fn foo(x: i32) { <|> }"), | ||
53 | @r#"[ | ||
54 | CompletionItem { | ||
55 | label: "pd", | ||
56 | source_range: [17; 17), | ||
57 | delete: [17; 17), | ||
58 | insert: "eprintln!(\"$0 = {:?}\", $0);", | ||
59 | kind: Snippet, | ||
60 | }, | ||
61 | CompletionItem { | ||
62 | label: "ppd", | ||
63 | source_range: [17; 17), | ||
64 | delete: [17; 17), | ||
65 | insert: "eprintln!(\"$0 = {:#?}\", $0);", | ||
66 | kind: Snippet, | ||
67 | }, | ||
68 | ]"# | ||
69 | ); | ||
51 | } | 70 | } |
52 | 71 | ||
53 | #[test] | 72 | #[test] |
54 | fn should_not_complete_snippets_in_path() { | 73 | fn should_not_complete_snippets_in_path() { |
55 | check_snippet_completion( | 74 | assert_debug_snapshot_matches!( |
56 | "should_not_complete_snippets_in_path", | 75 | do_snippet_completion(r"fn foo(x: i32) { ::foo<|> }"), |
57 | r"fn foo(x: i32) { ::foo<|> }", | 76 | @r#"[]"# |
58 | ); | 77 | ); |
59 | check_snippet_completion( | 78 | assert_debug_snapshot_matches!( |
60 | "should_not_complete_snippets_in_path2", | 79 | do_snippet_completion(r"fn foo(x: i32) { ::<|> }"), |
61 | r"fn foo(x: i32) { ::<|> }", | 80 | @r#"[]"# |
62 | ); | 81 | ); |
63 | } | 82 | } |
64 | 83 | ||
65 | #[test] | 84 | #[test] |
66 | fn completes_snippets_in_items() { | 85 | fn completes_snippets_in_items() { |
67 | check_snippet_completion( | 86 | assert_debug_snapshot_matches!( |
68 | "snippets_in_items", | 87 | do_snippet_completion( |
69 | r" | 88 | r" |
70 | #[cfg(test)] | 89 | #[cfg(test)] |
71 | mod tests { | 90 | mod tests { |
72 | <|> | 91 | <|> |
73 | } | 92 | } |
74 | ", | 93 | " |
94 | ), | ||
95 | @r###"[ | ||
96 | CompletionItem { | ||
97 | label: "Test function", | ||
98 | source_range: [78; 78), | ||
99 | delete: [78; 78), | ||
100 | insert: "#[test]\nfn ${1:feature}() {\n $0\n}", | ||
101 | kind: Snippet, | ||
102 | lookup: "tfn", | ||
103 | }, | ||
104 | CompletionItem { | ||
105 | label: "pub(crate)", | ||
106 | source_range: [78; 78), | ||
107 | delete: [78; 78), | ||
108 | insert: "pub(crate) $0", | ||
109 | kind: Snippet, | ||
110 | }, | ||
111 | ]"### | ||
75 | ); | 112 | ); |
76 | } | 113 | } |
77 | } | 114 | } |
diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index f78c4c877..d787bb69e 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs | |||
@@ -299,10 +299,3 @@ pub(crate) fn do_completion(code: &str, kind: CompletionKind) -> Vec<CompletionI | |||
299 | kind_completions.sort_by_key(|c| c.label.clone()); | 299 | kind_completions.sort_by_key(|c| c.label.clone()); |
300 | kind_completions | 300 | kind_completions |
301 | } | 301 | } |
302 | |||
303 | #[cfg(test)] | ||
304 | pub(crate) fn check_completion(test_name: &str, code: &str, kind: CompletionKind) { | ||
305 | use insta::assert_debug_snapshot_matches; | ||
306 | let kind_completions = do_completion(code, kind); | ||
307 | assert_debug_snapshot_matches!(test_name, kind_completions); | ||
308 | } | ||
diff --git a/crates/ra_ide_api/src/completion/presentation.rs b/crates/ra_ide_api/src/completion/presentation.rs index 5cf55a496..6878008d3 100644 --- a/crates/ra_ide_api/src/completion/presentation.rs +++ b/crates/ra_ide_api/src/completion/presentation.rs | |||
@@ -182,80 +182,169 @@ impl Completions { | |||
182 | 182 | ||
183 | #[cfg(test)] | 183 | #[cfg(test)] |
184 | mod tests { | 184 | mod tests { |
185 | use crate::completion::{do_completion, CompletionItem, CompletionKind}; | ||
186 | use insta::assert_debug_snapshot_matches; | ||
185 | use test_utils::covers; | 187 | use test_utils::covers; |
186 | 188 | ||
187 | use crate::completion::{check_completion, CompletionKind}; | 189 | fn do_reference_completion(code: &str) -> Vec<CompletionItem> { |
188 | 190 | do_completion(code, CompletionKind::Reference) | |
189 | fn check_reference_completion(code: &str, expected_completions: &str) { | ||
190 | check_completion(code, expected_completions, CompletionKind::Reference); | ||
191 | } | 191 | } |
192 | 192 | ||
193 | #[test] | 193 | #[test] |
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 | check_reference_completion( | 196 | assert_debug_snapshot_matches!( |
197 | "inserts_parens_for_function_calls1", | 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 | ), | ||
203 | @r###"[ | ||
204 | CompletionItem { | ||
205 | label: "main", | ||
206 | source_range: [61; 64), | ||
207 | delete: [61; 64), | ||
208 | insert: "main()$0", | ||
209 | kind: Function, | ||
210 | detail: "fn main()", | ||
211 | }, | ||
212 | CompletionItem { | ||
213 | label: "no_args", | ||
214 | source_range: [61; 64), | ||
215 | delete: [61; 64), | ||
216 | insert: "no_args()$0", | ||
217 | kind: Function, | ||
218 | detail: "fn no_args()", | ||
219 | }, | ||
220 | ]"### | ||
202 | ); | 221 | ); |
203 | check_reference_completion( | 222 | assert_debug_snapshot_matches!( |
204 | "inserts_parens_for_function_calls2", | 223 | do_reference_completion( |
205 | r" | 224 | r" |
206 | fn with_args(x: i32, y: String) {} | 225 | fn with_args(x: i32, y: String) {} |
207 | fn main() { with_<|> } | 226 | fn main() { with_<|> } |
208 | ", | 227 | " |
228 | ), | ||
229 | @r###"[ | ||
230 | CompletionItem { | ||
231 | label: "main", | ||
232 | source_range: [80; 85), | ||
233 | delete: [80; 85), | ||
234 | insert: "main()$0", | ||
235 | kind: Function, | ||
236 | detail: "fn main()", | ||
237 | }, | ||
238 | CompletionItem { | ||
239 | label: "with_args", | ||
240 | source_range: [80; 85), | ||
241 | delete: [80; 85), | ||
242 | insert: "with_args($0)", | ||
243 | kind: Function, | ||
244 | detail: "fn with_args(x: i32, y: String)", | ||
245 | }, | ||
246 | ]"### | ||
247 | ); | ||
248 | assert_debug_snapshot_matches!( | ||
249 | do_reference_completion( | ||
250 | r" | ||
251 | struct S {} | ||
252 | impl S { | ||
253 | fn foo(&self) {} | ||
254 | } | ||
255 | fn bar(s: &S) { | ||
256 | s.f<|> | ||
257 | } | ||
258 | " | ||
259 | ), | ||
260 | @r###"[ | ||
261 | CompletionItem { | ||
262 | label: "foo", | ||
263 | source_range: [163; 164), | ||
264 | delete: [163; 164), | ||
265 | insert: "foo()$0", | ||
266 | kind: Method, | ||
267 | detail: "fn foo(&self)", | ||
268 | }, | ||
269 | ]"### | ||
209 | ); | 270 | ); |
210 | check_reference_completion( | ||
211 | "inserts_parens_for_function_calls3", | ||
212 | r" | ||
213 | struct S {} | ||
214 | impl S { | ||
215 | fn foo(&self) {} | ||
216 | } | ||
217 | fn bar(s: &S) { | ||
218 | s.f<|> | ||
219 | } | ||
220 | ", | ||
221 | ) | ||
222 | } | 271 | } |
223 | 272 | ||
224 | #[test] | 273 | #[test] |
225 | fn dont_render_function_parens_in_use_item() { | 274 | fn dont_render_function_parens_in_use_item() { |
226 | check_reference_completion( | 275 | assert_debug_snapshot_matches!( |
227 | "dont_render_function_parens_in_use_item", | 276 | do_reference_completion( |
228 | " | 277 | " |
229 | //- /lib.rs | 278 | //- /lib.rs |
230 | mod m { pub fn foo() {} } | 279 | mod m { pub fn foo() {} } |
231 | use crate::m::f<|>; | 280 | use crate::m::f<|>; |
232 | ", | 281 | " |
233 | ) | 282 | ), |
283 | @r#"[ | ||
284 | CompletionItem { | ||
285 | label: "foo", | ||
286 | source_range: [40; 41), | ||
287 | delete: [40; 41), | ||
288 | insert: "foo", | ||
289 | kind: Function, | ||
290 | detail: "pub fn foo()", | ||
291 | }, | ||
292 | ]"# | ||
293 | ); | ||
234 | } | 294 | } |
235 | 295 | ||
236 | #[test] | 296 | #[test] |
237 | fn dont_render_function_parens_if_already_call() { | 297 | fn dont_render_function_parens_if_already_call() { |
238 | check_reference_completion( | 298 | assert_debug_snapshot_matches!( |
239 | "dont_render_function_parens_if_already_call", | 299 | do_reference_completion( |
240 | " | 300 | " |
241 | //- /lib.rs | 301 | //- /lib.rs |
242 | fn frobnicate() {} | 302 | fn frobnicate() {} |
243 | fn main() { | 303 | fn main() { |
244 | frob<|>(); | 304 | frob<|>(); |
245 | } | 305 | } |
246 | ", | 306 | " |
307 | ), | ||
308 | @r#"[ | ||
309 | CompletionItem { | ||
310 | label: "frobnicate", | ||
311 | source_range: [35; 39), | ||
312 | delete: [35; 39), | ||
313 | insert: "frobnicate", | ||
314 | kind: Function, | ||
315 | detail: "fn frobnicate()", | ||
316 | }, | ||
317 | CompletionItem { | ||
318 | label: "main", | ||
319 | source_range: [35; 39), | ||
320 | delete: [35; 39), | ||
321 | insert: "main", | ||
322 | kind: Function, | ||
323 | detail: "fn main()", | ||
324 | }, | ||
325 | ]"# | ||
326 | ); | ||
327 | assert_debug_snapshot_matches!( | ||
328 | do_reference_completion( | ||
329 | " | ||
330 | //- /lib.rs | ||
331 | struct Foo {} | ||
332 | impl Foo { fn new() -> Foo {} } | ||
333 | fn main() { | ||
334 | Foo::ne<|>(); | ||
335 | } | ||
336 | " | ||
337 | ), | ||
338 | @r#"[ | ||
339 | CompletionItem { | ||
340 | label: "new", | ||
341 | source_range: [67; 69), | ||
342 | delete: [67; 69), | ||
343 | insert: "new", | ||
344 | kind: Function, | ||
345 | detail: "fn new() -> Foo", | ||
346 | }, | ||
347 | ]"# | ||
247 | ); | 348 | ); |
248 | check_reference_completion( | ||
249 | "dont_render_function_parens_if_already_call_assoc_fn", | ||
250 | " | ||
251 | //- /lib.rs | ||
252 | struct Foo {} | ||
253 | impl Foo { fn new() -> Foo {} } | ||
254 | fn main() { | ||
255 | Foo::ne<|>(); | ||
256 | } | ||
257 | ", | ||
258 | ) | ||
259 | } | 349 | } |
260 | |||
261 | } | 350 | } |
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap deleted file mode 100644 index e9b717a45..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.119822026Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "quux", | ||
10 | source_range: [83; 83), | ||
11 | delete: [83; 83), | ||
12 | insert: "quux()$0", | ||
13 | kind: Function, | ||
14 | detail: "fn quux()", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "x", | ||
18 | source_range: [83; 83), | ||
19 | delete: [83; 83), | ||
20 | insert: "x", | ||
21 | kind: Binding, | ||
22 | }, | ||
23 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap deleted file mode 100644 index f94477b43..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap +++ /dev/null | |||
@@ -1,31 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-07-23T16:11:48.828805910Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "a", | ||
10 | source_range: [214; 214), | ||
11 | delete: [214; 214), | ||
12 | insert: "a", | ||
13 | kind: Binding, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "b", | ||
17 | source_range: [214; 214), | ||
18 | delete: [214; 214), | ||
19 | insert: "b", | ||
20 | kind: Binding, | ||
21 | detail: "i32", | ||
22 | }, | ||
23 | CompletionItem { | ||
24 | label: "quux", | ||
25 | source_range: [214; 214), | ||
26 | delete: [214; 214), | ||
27 | insert: "quux()$0", | ||
28 | kind: Function, | ||
29 | detail: "fn quux()", | ||
30 | }, | ||
31 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap deleted file mode 100644 index 590e2a820..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap +++ /dev/null | |||
@@ -1,32 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-07-23T16:11:48.828811567Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "quux", | ||
10 | source_range: [79; 79), | ||
11 | delete: [79; 79), | ||
12 | insert: "quux($0)", | ||
13 | kind: Function, | ||
14 | detail: "fn quux(x: i32)", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "x", | ||
18 | source_range: [79; 79), | ||
19 | delete: [79; 79), | ||
20 | insert: "x", | ||
21 | kind: Binding, | ||
22 | detail: "i32", | ||
23 | }, | ||
24 | CompletionItem { | ||
25 | label: "y", | ||
26 | source_range: [79; 79), | ||
27 | delete: [79; 79), | ||
28 | insert: "y", | ||
29 | kind: Binding, | ||
30 | detail: "i32", | ||
31 | }, | ||
32 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap deleted file mode 100644 index b339c6c5f..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.139262926Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "Option", | ||
10 | source_range: [18; 18), | ||
11 | delete: [18; 18), | ||
12 | insert: "Option", | ||
13 | kind: Struct, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "foo", | ||
17 | source_range: [18; 18), | ||
18 | delete: [18; 18), | ||
19 | insert: "foo()$0", | ||
20 | kind: Function, | ||
21 | detail: "fn foo()", | ||
22 | }, | ||
23 | CompletionItem { | ||
24 | label: "std", | ||
25 | source_range: [18; 18), | ||
26 | delete: [18; 18), | ||
27 | insert: "std", | ||
28 | kind: Module, | ||
29 | }, | ||
30 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap deleted file mode 100644 index 46bea2ccd..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call.snap +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.158296242Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "frobnicate", | ||
10 | source_range: [35; 39), | ||
11 | delete: [35; 39), | ||
12 | insert: "frobnicate", | ||
13 | kind: Function, | ||
14 | detail: "fn frobnicate()", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "main", | ||
18 | source_range: [35; 39), | ||
19 | delete: [35; 39), | ||
20 | insert: "main", | ||
21 | kind: Function, | ||
22 | detail: "fn main()", | ||
23 | }, | ||
24 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap deleted file mode 100644 index b09a6745e..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_if_already_call_assoc_fn.snap +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:44:10.920136527Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "new", | ||
10 | source_range: [67; 69), | ||
11 | delete: [67; 69), | ||
12 | insert: "new", | ||
13 | kind: Function, | ||
14 | detail: "fn new() -> Foo", | ||
15 | }, | ||
16 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap deleted file mode 100644 index 84ccc8160..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_render_function_parens_in_use_item.snap +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.154795561Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "foo", | ||
10 | source_range: [40; 41), | ||
11 | delete: [40; 41), | ||
12 | insert: "foo", | ||
13 | kind: Function, | ||
14 | detail: "pub fn foo()", | ||
15 | }, | ||
16 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap deleted file mode 100644 index 158a2e5b9..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-07-23T16:11:48.860949870Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "bar", | ||
10 | source_range: [126; 126), | ||
11 | delete: [126; 126), | ||
12 | insert: "bar", | ||
13 | kind: Binding, | ||
14 | detail: "i32", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "foo", | ||
18 | source_range: [126; 126), | ||
19 | delete: [126; 126), | ||
20 | insert: "foo()$0", | ||
21 | kind: Function, | ||
22 | detail: "fn foo()", | ||
23 | }, | ||
24 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap deleted file mode 100644 index b9449a76c..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap +++ /dev/null | |||
@@ -1,15 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.123197049Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "other_crate", | ||
10 | source_range: [4; 4), | ||
11 | delete: [4; 4), | ||
12 | insert: "other_crate", | ||
13 | kind: Module, | ||
14 | }, | ||
15 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap deleted file mode 100644 index eb1a4151a..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.123825399Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "T", | ||
10 | source_range: [44; 44), | ||
11 | delete: [44; 44), | ||
12 | insert: "T", | ||
13 | kind: TypeParam, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "quux", | ||
17 | source_range: [44; 44), | ||
18 | delete: [44; 44), | ||
19 | insert: "quux()$0", | ||
20 | kind: Function, | ||
21 | detail: "fn quux<T>()", | ||
22 | }, | ||
23 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap deleted file mode 100644 index 52f08267f..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.130778739Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "T", | ||
10 | source_range: [46; 46), | ||
11 | delete: [46; 46), | ||
12 | insert: "T", | ||
13 | kind: TypeParam, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "X", | ||
17 | source_range: [46; 46), | ||
18 | delete: [46; 46), | ||
19 | insert: "X", | ||
20 | kind: Struct, | ||
21 | }, | ||
22 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap deleted file mode 100644 index c795b9aae..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls1.snap +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.156115632Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "main", | ||
10 | source_range: [53; 56), | ||
11 | delete: [53; 56), | ||
12 | insert: "main()$0", | ||
13 | kind: Function, | ||
14 | detail: "fn main()", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "no_args", | ||
18 | source_range: [53; 56), | ||
19 | delete: [53; 56), | ||
20 | insert: "no_args()$0", | ||
21 | kind: Function, | ||
22 | detail: "fn no_args()", | ||
23 | }, | ||
24 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap deleted file mode 100644 index b49a838e0..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls2.snap +++ /dev/null | |||
@@ -1,24 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:44:10.916806744Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "main", | ||
10 | source_range: [72; 77), | ||
11 | delete: [72; 77), | ||
12 | insert: "main()$0", | ||
13 | kind: Function, | ||
14 | detail: "fn main()", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "with_args", | ||
18 | source_range: [72; 77), | ||
19 | delete: [72; 77), | ||
20 | insert: "with_args($0)", | ||
21 | kind: Function, | ||
22 | detail: "fn with_args(x: i32, y: String)", | ||
23 | }, | ||
24 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap deleted file mode 100644 index b62cb7aa1..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__inserts_parens_for_function_calls3.snap +++ /dev/null | |||
@@ -1,16 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:44:40.543731193Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "foo", | ||
10 | source_range: [139; 140), | ||
11 | delete: [139; 140), | ||
12 | insert: "foo()$0", | ||
13 | kind: Method, | ||
14 | detail: "fn foo(&self)", | ||
15 | }, | ||
16 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap deleted file mode 100644 index cee4898c3..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap +++ /dev/null | |||
@@ -1,30 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.133106898Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "Baz", | ||
10 | source_range: [89; 89), | ||
11 | delete: [89; 89), | ||
12 | insert: "Baz", | ||
13 | kind: Enum, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "Foo", | ||
17 | source_range: [89; 89), | ||
18 | delete: [89; 89), | ||
19 | insert: "Foo", | ||
20 | kind: Struct, | ||
21 | }, | ||
22 | CompletionItem { | ||
23 | label: "quux", | ||
24 | source_range: [89; 89), | ||
25 | delete: [89; 89), | ||
26 | insert: "quux()$0", | ||
27 | kind: Function, | ||
28 | detail: "fn quux()", | ||
29 | }, | ||
30 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap deleted file mode 100644 index ce18e5bb7..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.134417551Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "Bar", | ||
10 | source_range: [101; 101), | ||
11 | delete: [101; 101), | ||
12 | insert: "Bar", | ||
13 | kind: Struct, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "quux", | ||
17 | source_range: [101; 101), | ||
18 | delete: [101; 101), | ||
19 | insert: "quux()$0", | ||
20 | kind: Function, | ||
21 | detail: "fn quux()", | ||
22 | }, | ||
23 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap deleted file mode 100644 index 16dd18431..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.140648630Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "Foo", | ||
10 | source_range: [47; 47), | ||
11 | delete: [47; 47), | ||
12 | insert: "Foo", | ||
13 | kind: Struct, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "x", | ||
17 | source_range: [47; 47), | ||
18 | delete: [47; 47), | ||
19 | insert: "x()$0", | ||
20 | kind: Function, | ||
21 | detail: "fn x()", | ||
22 | }, | ||
23 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap deleted file mode 100644 index b7bcbe864..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-07-23T16:11:48.859812318Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "Self", | ||
10 | source_range: [25; 25), | ||
11 | delete: [25; 25), | ||
12 | insert: "Self", | ||
13 | kind: TypeParam, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "self", | ||
17 | source_range: [25; 25), | ||
18 | delete: [25; 25), | ||
19 | insert: "self", | ||
20 | kind: Binding, | ||
21 | detail: "&{unknown}", | ||
22 | }, | ||
23 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap deleted file mode 100644 index cb3278edf..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path.snap +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | Created: 2019-01-23T05:19:36.475253+00:00 | ||
2 | Creator: [email protected] | ||
3 | Source: crates/ra_ide_api/src/completion/completion_item.rs | ||
4 | |||
5 | [] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap deleted file mode 100644 index 62c8e3de9..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__should_not_complete_snippets_in_path2.snap +++ /dev/null | |||
@@ -1,5 +0,0 @@ | |||
1 | Created: 2019-01-23T05:19:36.476869+00:00 | ||
2 | Creator: [email protected] | ||
3 | Source: crates/ra_ide_api/src/completion/completion_item.rs | ||
4 | |||
5 | [] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap deleted file mode 100644 index 6f41bf76f..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_expressions.snap +++ /dev/null | |||
@@ -1,22 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.141901047Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "pd", | ||
10 | source_range: [17; 17), | ||
11 | delete: [17; 17), | ||
12 | insert: "eprintln!(\"$0 = {:?}\", $0);", | ||
13 | kind: Snippet, | ||
14 | }, | ||
15 | CompletionItem { | ||
16 | label: "ppd", | ||
17 | source_range: [17; 17), | ||
18 | delete: [17; 17), | ||
19 | insert: "eprintln!(\"$0 = {:#?}\", $0);", | ||
20 | kind: Snippet, | ||
21 | }, | ||
22 | ] | ||
diff --git a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap b/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap deleted file mode 100644 index 1eb0adebe..000000000 --- a/crates/ra_ide_api/src/completion/snapshots/completion_item__snippets_in_items.snap +++ /dev/null | |||
@@ -1,23 +0,0 @@ | |||
1 | --- | ||
2 | created: "2019-05-23T22:23:35.149234118Z" | ||
3 | creator: [email protected] | ||
4 | source: crates/ra_ide_api/src/completion/completion_item.rs | ||
5 | expression: kind_completions | ||
6 | --- | ||
7 | [ | ||
8 | CompletionItem { | ||
9 | label: "Test function", | ||
10 | source_range: [66; 66), | ||
11 | delete: [66; 66), | ||
12 | insert: "#[test]\nfn ${1:feature}() {\n $0\n}", | ||
13 | kind: Snippet, | ||
14 | lookup: "tfn", | ||
15 | }, | ||
16 | CompletionItem { | ||
17 | label: "pub(crate)", | ||
18 | source_range: [66; 66), | ||
19 | delete: [66; 66), | ||
20 | insert: "pub(crate) $0", | ||
21 | kind: Snippet, | ||
22 | }, | ||
23 | ] | ||