aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_ide_api/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_ide_api/src')
-rw-r--r--crates/ra_ide_api/src/completion/complete_scope.rs465
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_for.snap23
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_if_let.snap31
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__bindings_from_let.snap32
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__completes_prelude.snap30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__dont_show_both_completions_for_shadowing.snap24
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__extern_prelude.snap15
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params.snap23
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__generic_params_in_struct.snap22
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items.snap30
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__module_items_in_nested_modules.snap23
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__return_type.snap23
-rw-r--r--crates/ra_ide_api/src/completion/snapshots/completion_item__self_in_methods.snap23
-rw-r--r--crates/ra_ide_api/src/references.rs66
14 files changed, 396 insertions, 434 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..1baa5227a 100644
--- a/crates/ra_ide_api/src/completion/complete_scope.rs
+++ b/crates/ra_ide_api/src/completion/complete_scope.rs
@@ -121,172 +121,431 @@ impl ImportResolver {
121 121
122#[cfg(test)] 122#[cfg(test)]
123mod tests { 123mod 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 ⋮[
145 ⋮ CompletionItem {
146 ⋮ label: "quux",
147 ⋮ source_range: [91; 91),
148 ⋮ delete: [91; 91),
149 ⋮ insert: "quux($0)",
150 ⋮ kind: Function,
151 ⋮ detail: "fn quux(x: i32)",
152 ⋮ },
153 ⋮ CompletionItem {
154 ⋮ label: "x",
155 ⋮ source_range: [91; 91),
156 ⋮ delete: [91; 91),
157 ⋮ insert: "x",
158 ⋮ kind: Binding,
159 ⋮ detail: "i32",
160 ⋮ },
161 ⋮ CompletionItem {
162 ⋮ label: "y",
163 ⋮ source_range: [91; 91),
164 ⋮ delete: [91; 91),
165 ⋮ insert: "y",
166 ⋮ kind: Binding,
167 ⋮ detail: "i32",
168 ⋮ },
169 ⋮]
170 "###
141 ); 171 );
142 } 172 }
143 173
144 #[test] 174 #[test]
145 fn completes_bindings_from_if_let() { 175 fn completes_bindings_from_if_let() {
146 check_reference_completion( 176 assert_debug_snapshot_matches!(
147 "bindings_from_if_let", 177 do_reference_completion(
148 r" 178 r"
149 fn quux() { 179 fn quux() {
150 if let Some(x) = foo() { 180 if let Some(x) = foo() {
151 let y = 92; 181 let y = 92;
152 }; 182 };
153 if let Some(a) = bar() { 183 if let Some(a) = bar() {
154 let b = 62; 184 let b = 62;
155 1 + <|> 185 1 + <|>
186 }
156 } 187 }
157 } 188 "
158 ", 189 ),
190@r###"
191 ⋮[
192 ⋮ CompletionItem {
193 ⋮ label: "a",
194 ⋮ source_range: [242; 242),
195 ⋮ delete: [242; 242),
196 ⋮ insert: "a",
197 ⋮ kind: Binding,
198 ⋮ },
199 ⋮ CompletionItem {
200 ⋮ label: "b",
201 ⋮ source_range: [242; 242),
202 ⋮ delete: [242; 242),
203 ⋮ insert: "b",
204 ⋮ kind: Binding,
205 ⋮ detail: "i32",
206 ⋮ },
207 ⋮ CompletionItem {
208 ⋮ label: "quux",
209 ⋮ source_range: [242; 242),
210 ⋮ delete: [242; 242),
211 ⋮ insert: "quux()$0",
212 ⋮ kind: Function,
213 ⋮ detail: "fn quux()",
214 ⋮ },
215 ⋮]
216 "###
159 ); 217 );
160 } 218 }
161 219
162 #[test] 220 #[test]
163 fn completes_bindings_from_for() { 221 fn completes_bindings_from_for() {
164 check_reference_completion( 222 assert_debug_snapshot_matches!(
165 "bindings_from_for", 223 do_reference_completion(
166 r" 224 r"
167 fn quux() { 225 fn quux() {
168 for x in &[1, 2, 3] { 226 for x in &[1, 2, 3] {
169 <|> 227 <|>
228 }
170 } 229 }
171 } 230 "
172 ", 231 ),
232@r###"
233 ⋮[
234 ⋮ CompletionItem {
235 ⋮ label: "quux",
236 ⋮ source_range: [95; 95),
237 ⋮ delete: [95; 95),
238 ⋮ insert: "quux()$0",
239 ⋮ kind: Function,
240 ⋮ detail: "fn quux()",
241 ⋮ },
242 ⋮ CompletionItem {
243 ⋮ label: "x",
244 ⋮ source_range: [95; 95),
245 ⋮ delete: [95; 95),
246 ⋮ insert: "x",
247 ⋮ kind: Binding,
248 ⋮ },
249 ⋮]
250 "###
173 ); 251 );
174 } 252 }
175 253
176 #[test] 254 #[test]
177 fn completes_generic_params() { 255 fn completes_generic_params() {
178 check_reference_completion( 256 assert_debug_snapshot_matches!(
179 "generic_params", 257 do_reference_completion(
180 r" 258 r"
181 fn quux<T>() { 259 fn quux<T>() {
182 <|> 260 <|>
183 } 261 }
184 ", 262 "
263 ),
264@r###"
265 ⋮[
266 ⋮ CompletionItem {
267 ⋮ label: "T",
268 ⋮ source_range: [52; 52),
269 ⋮ delete: [52; 52),
270 ⋮ insert: "T",
271 ⋮ kind: TypeParam,
272 ⋮ },
273 ⋮ CompletionItem {
274 ⋮ label: "quux",
275 ⋮ source_range: [52; 52),
276 ⋮ delete: [52; 52),
277 ⋮ insert: "quux()$0",
278 ⋮ kind: Function,
279 ⋮ detail: "fn quux<T>()",
280 ⋮ },
281 ⋮]
282 "###
185 ); 283 );
186 } 284 }
187 285
188 #[test] 286 #[test]
189 fn completes_generic_params_in_struct() { 287 fn completes_generic_params_in_struct() {
190 check_reference_completion( 288 assert_debug_snapshot_matches!(
191 "generic_params_in_struct", 289 do_reference_completion(
192 r" 290 r"
193 struct X<T> { 291 struct X<T> {
194 x: <|> 292 x: <|>
195 } 293 }
196 ", 294 "
295 ),
296@r###"
297 ⋮[
298 ⋮ CompletionItem {
299 ⋮ label: "T",
300 ⋮ source_range: [54; 54),
301 ⋮ delete: [54; 54),
302 ⋮ insert: "T",
303 ⋮ kind: TypeParam,
304 ⋮ },
305 ⋮ CompletionItem {
306 ⋮ label: "X",
307 ⋮ source_range: [54; 54),
308 ⋮ delete: [54; 54),
309 ⋮ insert: "X",
310 ⋮ kind: Struct,
311 ⋮ },
312 ⋮]
313 "###
197 ); 314 );
198 } 315 }
199 316
200 #[test] 317 #[test]
201 fn completes_module_items() { 318 fn completes_module_items() {
202 check_reference_completion( 319 assert_debug_snapshot_matches!(
203 "module_items", 320 do_reference_completion(
204 r" 321 r"
205 struct Foo; 322 struct Foo;
206 enum Baz {} 323 enum Baz {}
207 fn quux() { 324 fn quux() {
208 <|> 325 <|>
209 } 326 }
210 ", 327 "
328 ),
329@r###"
330 ⋮[
331 ⋮ CompletionItem {
332 ⋮ label: "Baz",
333 ⋮ source_range: [105; 105),
334 ⋮ delete: [105; 105),
335 ⋮ insert: "Baz",
336 ⋮ kind: Enum,
337 ⋮ },
338 ⋮ CompletionItem {
339 ⋮ label: "Foo",
340 ⋮ source_range: [105; 105),
341 ⋮ delete: [105; 105),
342 ⋮ insert: "Foo",
343 ⋮ kind: Struct,
344 ⋮ },
345 ⋮ CompletionItem {
346 ⋮ label: "quux",
347 ⋮ source_range: [105; 105),
348 ⋮ delete: [105; 105),
349 ⋮ insert: "quux()$0",
350 ⋮ kind: Function,
351 ⋮ detail: "fn quux()",
352 ⋮ },
353 ⋮]
354 "###
211 ); 355 );
212 } 356 }
213 357
214 #[test] 358 #[test]
215 fn completes_extern_prelude() { 359 fn completes_extern_prelude() {
216 check_reference_completion( 360 assert_debug_snapshot_matches!(
217 "extern_prelude", 361 do_reference_completion(
218 r" 362 r"
219 //- /lib.rs 363 //- /lib.rs
220 use <|>; 364 use <|>;
221 365
222 //- /other_crate/lib.rs 366 //- /other_crate/lib.rs
223 // nothing here 367 // nothing here
224 ", 368 "
369 ),
370@r#"[
371 CompletionItem {
372 label: "other_crate",
373 source_range: [4; 4),
374 delete: [4; 4),
375 insert: "other_crate",
376 kind: Module,
377 },
378]"#
225 ); 379 );
226 } 380 }
227 381
228 #[test] 382 #[test]
229 fn completes_module_items_in_nested_modules() { 383 fn completes_module_items_in_nested_modules() {
230 check_reference_completion( 384 assert_debug_snapshot_matches!(
231 "module_items_in_nested_modules", 385 do_reference_completion(
232 r" 386 r"
233 struct Foo; 387 struct Foo;
234 mod m { 388 mod m {
235 struct Bar; 389 struct Bar;
236 fn quux() { <|> } 390 fn quux() { <|> }
237 } 391 }
238 ", 392 "
393 ),
394@r###"
395 ⋮[
396 ⋮ CompletionItem {
397 ⋮ label: "Bar",
398 ⋮ source_range: [117; 117),
399 ⋮ delete: [117; 117),
400 ⋮ insert: "Bar",
401 ⋮ kind: Struct,
402 ⋮ },
403 ⋮ CompletionItem {
404 ⋮ label: "quux",
405 ⋮ source_range: [117; 117),
406 ⋮ delete: [117; 117),
407 ⋮ insert: "quux()$0",
408 ⋮ kind: Function,
409 ⋮ detail: "fn quux()",
410 ⋮ },
411 ⋮]
412 "###
239 ); 413 );
240 } 414 }
241 415
242 #[test] 416 #[test]
243 fn completes_return_type() { 417 fn completes_return_type() {
244 check_reference_completion( 418 assert_debug_snapshot_matches!(
245 "return_type", 419 do_reference_completion(
246 r" 420 r"
247 struct Foo; 421 struct Foo;
248 fn x() -> <|> 422 fn x() -> <|>
249 ", 423 "
250 ) 424 ),
425@r###"
426 ⋮[
427 ⋮ CompletionItem {
428 ⋮ label: "Foo",
429 ⋮ source_range: [55; 55),
430 ⋮ delete: [55; 55),
431 ⋮ insert: "Foo",
432 ⋮ kind: Struct,
433 ⋮ },
434 ⋮ CompletionItem {
435 ⋮ label: "x",
436 ⋮ source_range: [55; 55),
437 ⋮ delete: [55; 55),
438 ⋮ insert: "x()$0",
439 ⋮ kind: Function,
440 ⋮ detail: "fn x()",
441 ⋮ },
442 ⋮]
443 "###
444 );
251 } 445 }
252 446
253 #[test] 447 #[test]
254 fn dont_show_both_completions_for_shadowing() { 448 fn dont_show_both_completions_for_shadowing() {
255 check_reference_completion( 449 assert_debug_snapshot_matches!(
256 "dont_show_both_completions_for_shadowing", 450 do_reference_completion(
257 r" 451 r"
258 fn foo() { 452 fn foo() {
259 let bar = 92; 453 let bar = 92;
260 { 454 {
261 let bar = 62; 455 let bar = 62;
262 <|> 456 <|>
457 }
263 } 458 }
264 } 459 "
265 ", 460 ),
266 ) 461@r###"
462 ⋮[
463 ⋮ CompletionItem {
464 ⋮ label: "bar",
465 ⋮ source_range: [146; 146),
466 ⋮ delete: [146; 146),
467 ⋮ insert: "bar",
468 ⋮ kind: Binding,
469 ⋮ detail: "i32",
470 ⋮ },
471 ⋮ CompletionItem {
472 ⋮ label: "foo",
473 ⋮ source_range: [146; 146),
474 ⋮ delete: [146; 146),
475 ⋮ insert: "foo()$0",
476 ⋮ kind: Function,
477 ⋮ detail: "fn foo()",
478 ⋮ },
479 ⋮]
480 "###
481 );
267 } 482 }
268 483
269 #[test] 484 #[test]
270 fn completes_self_in_methods() { 485 fn completes_self_in_methods() {
271 check_reference_completion("self_in_methods", r"impl S { fn foo(&self) { <|> } }") 486 assert_debug_snapshot_matches!(
487 do_reference_completion(r"impl S { fn foo(&self) { <|> } }"),
488@r#"[
489 CompletionItem {
490 label: "Self",
491 source_range: [25; 25),
492 delete: [25; 25),
493 insert: "Self",
494 kind: TypeParam,
495 },
496 CompletionItem {
497 label: "self",
498 source_range: [25; 25),
499 delete: [25; 25),
500 insert: "self",
501 kind: Binding,
502 detail: "&{unknown}",
503 },
504]"#
505 );
272 } 506 }
273 507
274 #[test] 508 #[test]
275 fn completes_prelude() { 509 fn completes_prelude() {
276 check_reference_completion( 510 assert_debug_snapshot_matches!(
277 "completes_prelude", 511 do_reference_completion(
278 " 512 "
279 //- /main.rs 513 //- /main.rs
280 fn foo() { let x: <|> } 514 fn foo() { let x: <|> }
281 515
282 //- /std/lib.rs 516 //- /std/lib.rs
283 #[prelude_import] 517 #[prelude_import]
284 use prelude::*; 518 use prelude::*;
285 519
286 mod prelude { 520 mod prelude {
287 struct Option; 521 struct Option;
288 } 522 }
289 ", 523 "
524 ),
525@r#"[
526 CompletionItem {
527 label: "Option",
528 source_range: [18; 18),
529 delete: [18; 18),
530 insert: "Option",
531 kind: Struct,
532 },
533 CompletionItem {
534 label: "foo",
535 source_range: [18; 18),
536 delete: [18; 18),
537 insert: "foo()$0",
538 kind: Function,
539 detail: "fn foo()",
540 },
541 CompletionItem {
542 label: "std",
543 source_range: [18; 18),
544 delete: [18; 18),
545 insert: "std",
546 kind: Module,
547 },
548]"#
290 ); 549 );
291 } 550 }
292} 551}
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---
2created: "2019-05-23T22:23:35.119822026Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-07-23T16:11:48.828805910Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-07-23T16:11:48.828811567Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-05-23T22:23:35.139262926Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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_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---
2created: "2019-07-23T16:11:48.860949870Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-05-23T22:23:35.123197049Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-05-23T22:23:35.123825399Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-05-23T22:23:35.130778739Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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__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---
2created: "2019-05-23T22:23:35.133106898Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-05-23T22:23:35.134417551Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-05-23T22:23:35.140648630Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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---
2created: "2019-07-23T16:11:48.859812318Z"
3creator: [email protected]
4source: crates/ra_ide_api/src/completion/completion_item.rs
5expression: 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/references.rs b/crates/ra_ide_api/src/references.rs
index a75a0eb4f..9b9f75af0 100644
--- a/crates/ra_ide_api/src/references.rs
+++ b/crates/ra_ide_api/src/references.rs
@@ -357,38 +357,40 @@ mod tests {
357 let new_name = "foo2"; 357 let new_name = "foo2";
358 let source_change = analysis.rename(position, new_name).unwrap(); 358 let source_change = analysis.rename(position, new_name).unwrap();
359 assert_debug_snapshot_matches!(&source_change, 359 assert_debug_snapshot_matches!(&source_change,
360@r#"Some( 360@r###"
361 SourceChange { 361 ⋮Some(
362 label: "rename", 362 ⋮ SourceChange {
363 source_file_edits: [ 363 ⋮ label: "rename",
364 SourceFileEdit { 364 ⋮ source_file_edits: [
365 file_id: FileId( 365 ⋮ SourceFileEdit {
366 1, 366 ⋮ file_id: FileId(
367 ), 367 ⋮ 1,
368 edit: TextEdit { 368 ⋮ ),
369 atoms: [ 369 ⋮ edit: TextEdit {
370 AtomTextEdit { 370 ⋮ atoms: [
371 delete: [4; 7), 371 ⋮ AtomTextEdit {
372 insert: "foo2", 372 ⋮ delete: [4; 7),
373 }, 373 ⋮ insert: "foo2",
374 ], 374 ⋮ },
375 }, 375 ⋮ ],
376 }, 376 ⋮ },
377 ], 377 ⋮ },
378 file_system_edits: [ 378 ⋮ ],
379 MoveFile { 379 ⋮ file_system_edits: [
380 src: FileId( 380 ⋮ MoveFile {
381 2, 381 ⋮ src: FileId(
382 ), 382 ⋮ 2,
383 dst_source_root: SourceRootId( 383 ⋮ ),
384 0, 384 ⋮ dst_source_root: SourceRootId(
385 ), 385 ⋮ 0,
386 dst_path: "foo2/mod.rs", 386 ⋮ ),
387 }, 387 ⋮ dst_path: "foo2/mod.rs",
388 ], 388 ⋮ },
389 cursor_position: None, 389 ⋮ ],
390 }, 390 ⋮ cursor_position: None,
391)"#); 391 ⋮ },
392 ⋮)
393 "###);
392 } 394 }
393 395
394 fn test_rename(text: &str, new_name: &str, expected: &str) { 396 fn test_rename(text: &str, new_name: &str, expected: &str) {