diff options
Diffstat (limited to 'crates/completion/src/completions/unqualified_path.rs')
-rw-r--r-- | crates/completion/src/completions/unqualified_path.rs | 82 |
1 files changed, 41 insertions, 41 deletions
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs index 2da21b5c2..12cdb869d 100644 --- a/crates/completion/src/completions/unqualified_path.rs +++ b/crates/completion/src/completions/unqualified_path.rs | |||
@@ -85,7 +85,7 @@ fn complete_enum_variants(acc: &mut Completions, ctx: &CompletionContext, ty: &T | |||
85 | // | 85 | // |
86 | // ``` | 86 | // ``` |
87 | // fn main() { | 87 | // fn main() { |
88 | // pda<|> | 88 | // pda$0 |
89 | // } | 89 | // } |
90 | // # pub mod std { pub mod marker { pub struct PhantomData { } } } | 90 | // # pub mod std { pub mod marker { pub struct PhantomData { } } } |
91 | // ``` | 91 | // ``` |
@@ -212,7 +212,7 @@ mod tests { | |||
212 | mark::check!(self_fulfilling_completion); | 212 | mark::check!(self_fulfilling_completion); |
213 | check( | 213 | check( |
214 | r#" | 214 | r#" |
215 | use foo<|> | 215 | use foo$0 |
216 | use std::collections; | 216 | use std::collections; |
217 | "#, | 217 | "#, |
218 | expect![[r#" | 218 | expect![[r#" |
@@ -229,7 +229,7 @@ enum Enum { A, B } | |||
229 | fn quux(x: Option<Enum>) { | 229 | fn quux(x: Option<Enum>) { |
230 | match x { | 230 | match x { |
231 | None => (), | 231 | None => (), |
232 | Some(en<|> @ Enum::A) => (), | 232 | Some(en$0 @ Enum::A) => (), |
233 | } | 233 | } |
234 | } | 234 | } |
235 | "#, | 235 | "#, |
@@ -245,7 +245,7 @@ enum Enum { A, B } | |||
245 | fn quux(x: Option<Enum>) { | 245 | fn quux(x: Option<Enum>) { |
246 | match x { | 246 | match x { |
247 | None => (), | 247 | None => (), |
248 | Some(ref en<|>) => (), | 248 | Some(ref en$0) => (), |
249 | } | 249 | } |
250 | } | 250 | } |
251 | "#, | 251 | "#, |
@@ -261,7 +261,7 @@ enum Enum { A, B } | |||
261 | fn quux(x: Option<Enum>) { | 261 | fn quux(x: Option<Enum>) { |
262 | match x { | 262 | match x { |
263 | None => (), | 263 | None => (), |
264 | Some(En<|>) => (), | 264 | Some(En$0) => (), |
265 | } | 265 | } |
266 | } | 266 | } |
267 | "#, | 267 | "#, |
@@ -277,7 +277,7 @@ fn quux(x: Option<Enum>) { | |||
277 | r#" | 277 | r#" |
278 | fn quux(x: i32) { | 278 | fn quux(x: i32) { |
279 | let y = 92; | 279 | let y = 92; |
280 | 1 + <|>; | 280 | 1 + $0; |
281 | let z = (); | 281 | let z = (); |
282 | } | 282 | } |
283 | "#, | 283 | "#, |
@@ -299,7 +299,7 @@ fn quux() { | |||
299 | }; | 299 | }; |
300 | if let Some(a) = bar() { | 300 | if let Some(a) = bar() { |
301 | let b = 62; | 301 | let b = 62; |
302 | 1 + <|> | 302 | 1 + $0 |
303 | } | 303 | } |
304 | } | 304 | } |
305 | "#, | 305 | "#, |
@@ -316,7 +316,7 @@ fn quux() { | |||
316 | check( | 316 | check( |
317 | r#" | 317 | r#" |
318 | fn quux() { | 318 | fn quux() { |
319 | for x in &[1, 2, 3] { <|> } | 319 | for x in &[1, 2, 3] { $0 } |
320 | } | 320 | } |
321 | "#, | 321 | "#, |
322 | expect![[r#" | 322 | expect![[r#" |
@@ -334,7 +334,7 @@ fn quux() { | |||
334 | r#" | 334 | r#" |
335 | fn main() { | 335 | fn main() { |
336 | let wherewolf = 92; | 336 | let wherewolf = 92; |
337 | drop(where<|>) | 337 | drop(where$0) |
338 | } | 338 | } |
339 | "#, | 339 | "#, |
340 | r#" | 340 | r#" |
@@ -349,7 +349,7 @@ fn main() { | |||
349 | #[test] | 349 | #[test] |
350 | fn completes_generic_params() { | 350 | fn completes_generic_params() { |
351 | check( | 351 | check( |
352 | r#"fn quux<T>() { <|> }"#, | 352 | r#"fn quux<T>() { $0 }"#, |
353 | expect![[r#" | 353 | expect![[r#" |
354 | tp T | 354 | tp T |
355 | fn quux() fn quux<T>() | 355 | fn quux() fn quux<T>() |
@@ -360,7 +360,7 @@ fn main() { | |||
360 | #[test] | 360 | #[test] |
361 | fn completes_generic_params_in_struct() { | 361 | fn completes_generic_params_in_struct() { |
362 | check( | 362 | check( |
363 | r#"struct S<T> { x: <|>}"#, | 363 | r#"struct S<T> { x: $0}"#, |
364 | expect![[r#" | 364 | expect![[r#" |
365 | tp Self | 365 | tp Self |
366 | tp T | 366 | tp T |
@@ -372,7 +372,7 @@ fn main() { | |||
372 | #[test] | 372 | #[test] |
373 | fn completes_self_in_enum() { | 373 | fn completes_self_in_enum() { |
374 | check( | 374 | check( |
375 | r#"enum X { Y(<|>) }"#, | 375 | r#"enum X { Y($0) }"#, |
376 | expect![[r#" | 376 | expect![[r#" |
377 | tp Self | 377 | tp Self |
378 | en X | 378 | en X |
@@ -386,7 +386,7 @@ fn main() { | |||
386 | r#" | 386 | r#" |
387 | struct S; | 387 | struct S; |
388 | enum E {} | 388 | enum E {} |
389 | fn quux() { <|> } | 389 | fn quux() { $0 } |
390 | "#, | 390 | "#, |
391 | expect![[r#" | 391 | expect![[r#" |
392 | st S | 392 | st S |
@@ -403,7 +403,7 @@ fn quux() { <|> } | |||
403 | "_alpha", | 403 | "_alpha", |
404 | r#" | 404 | r#" |
405 | fn main() { | 405 | fn main() { |
406 | _<|> | 406 | _$0 |
407 | } | 407 | } |
408 | fn _alpha() {} | 408 | fn _alpha() {} |
409 | "#, | 409 | "#, |
@@ -421,7 +421,7 @@ fn _alpha() {} | |||
421 | check( | 421 | check( |
422 | r#" | 422 | r#" |
423 | //- /lib.rs crate:main deps:other_crate | 423 | //- /lib.rs crate:main deps:other_crate |
424 | use <|>; | 424 | use $0; |
425 | 425 | ||
426 | //- /other_crate/lib.rs crate:other_crate | 426 | //- /other_crate/lib.rs crate:other_crate |
427 | // nothing here | 427 | // nothing here |
@@ -439,7 +439,7 @@ use <|>; | |||
439 | struct Foo; | 439 | struct Foo; |
440 | mod m { | 440 | mod m { |
441 | struct Bar; | 441 | struct Bar; |
442 | fn quux() { <|> } | 442 | fn quux() { $0 } |
443 | } | 443 | } |
444 | "#, | 444 | "#, |
445 | expect![[r#" | 445 | expect![[r#" |
@@ -454,7 +454,7 @@ mod m { | |||
454 | check( | 454 | check( |
455 | r#" | 455 | r#" |
456 | struct Foo; | 456 | struct Foo; |
457 | fn x() -> <|> | 457 | fn x() -> $0 |
458 | "#, | 458 | "#, |
459 | expect![[r#" | 459 | expect![[r#" |
460 | st Foo | 460 | st Foo |
@@ -471,7 +471,7 @@ fn foo() { | |||
471 | let bar = 92; | 471 | let bar = 92; |
472 | { | 472 | { |
473 | let bar = 62; | 473 | let bar = 62; |
474 | drop(<|>) | 474 | drop($0) |
475 | } | 475 | } |
476 | } | 476 | } |
477 | "#, | 477 | "#, |
@@ -487,7 +487,7 @@ fn foo() { | |||
487 | #[test] | 487 | #[test] |
488 | fn completes_self_in_methods() { | 488 | fn completes_self_in_methods() { |
489 | check( | 489 | check( |
490 | r#"impl S { fn foo(&self) { <|> } }"#, | 490 | r#"impl S { fn foo(&self) { $0 } }"#, |
491 | expect![[r#" | 491 | expect![[r#" |
492 | bn self &{unknown} | 492 | bn self &{unknown} |
493 | tp Self | 493 | tp Self |
@@ -500,7 +500,7 @@ fn foo() { | |||
500 | check( | 500 | check( |
501 | r#" | 501 | r#" |
502 | //- /main.rs crate:main deps:std | 502 | //- /main.rs crate:main deps:std |
503 | fn foo() { let x: <|> } | 503 | fn foo() { let x: $0 } |
504 | 504 | ||
505 | //- /std/lib.rs crate:std | 505 | //- /std/lib.rs crate:std |
506 | #[prelude_import] | 506 | #[prelude_import] |
@@ -521,7 +521,7 @@ mod prelude { struct Option; } | |||
521 | check( | 521 | check( |
522 | r#" | 522 | r#" |
523 | //- /main.rs crate:main deps:core,std | 523 | //- /main.rs crate:main deps:core,std |
524 | fn foo() { let x: <|> } | 524 | fn foo() { let x: $0 } |
525 | 525 | ||
526 | //- /core/lib.rs crate:core | 526 | //- /core/lib.rs crate:core |
527 | #[prelude_import] | 527 | #[prelude_import] |
@@ -562,7 +562,7 @@ mod m2 { | |||
562 | macro_rules! baz { () => {} } | 562 | macro_rules! baz { () => {} } |
563 | } | 563 | } |
564 | 564 | ||
565 | fn main() { let v = <|> } | 565 | fn main() { let v = $0 } |
566 | "#, | 566 | "#, |
567 | expect![[r##" | 567 | expect![[r##" |
568 | md m1 | 568 | md m1 |
@@ -581,7 +581,7 @@ fn main() { let v = <|> } | |||
581 | check( | 581 | check( |
582 | r#" | 582 | r#" |
583 | macro_rules! foo { () => {} } | 583 | macro_rules! foo { () => {} } |
584 | fn foo() { <|> } | 584 | fn foo() { $0 } |
585 | "#, | 585 | "#, |
586 | expect![[r#" | 586 | expect![[r#" |
587 | fn foo() fn foo() | 587 | fn foo() fn foo() |
@@ -595,7 +595,7 @@ fn foo() { <|> } | |||
595 | check( | 595 | check( |
596 | r#" | 596 | r#" |
597 | macro_rules! foo { () => {} } | 597 | macro_rules! foo { () => {} } |
598 | fn main() { let x: <|> } | 598 | fn main() { let x: $0 } |
599 | "#, | 599 | "#, |
600 | expect![[r#" | 600 | expect![[r#" |
601 | fn main() fn main() | 601 | fn main() fn main() |
@@ -609,7 +609,7 @@ fn main() { let x: <|> } | |||
609 | check( | 609 | check( |
610 | r#" | 610 | r#" |
611 | macro_rules! foo { () => {} } | 611 | macro_rules! foo { () => {} } |
612 | fn main() { <|> } | 612 | fn main() { $0 } |
613 | "#, | 613 | "#, |
614 | expect![[r#" | 614 | expect![[r#" |
615 | fn main() fn main() | 615 | fn main() fn main() |
@@ -623,7 +623,7 @@ fn main() { <|> } | |||
623 | check( | 623 | check( |
624 | r#" | 624 | r#" |
625 | fn main() { | 625 | fn main() { |
626 | return f<|>; | 626 | return f$0; |
627 | fn frobnicate() {} | 627 | fn frobnicate() {} |
628 | } | 628 | } |
629 | "#, | 629 | "#, |
@@ -641,7 +641,7 @@ fn main() { | |||
641 | macro_rules! m { ($e:expr) => { $e } } | 641 | macro_rules! m { ($e:expr) => { $e } } |
642 | fn quux(x: i32) { | 642 | fn quux(x: i32) { |
643 | let y = 92; | 643 | let y = 92; |
644 | m!(<|>); | 644 | m!($0); |
645 | } | 645 | } |
646 | "#, | 646 | "#, |
647 | expect![[r#" | 647 | expect![[r#" |
@@ -660,7 +660,7 @@ fn quux(x: i32) { | |||
660 | macro_rules! m { ($e:expr) => { $e } } | 660 | macro_rules! m { ($e:expr) => { $e } } |
661 | fn quux(x: i32) { | 661 | fn quux(x: i32) { |
662 | let y = 92; | 662 | let y = 92; |
663 | m!(x<|>); | 663 | m!(x$0); |
664 | } | 664 | } |
665 | ", | 665 | ", |
666 | expect![[r#" | 666 | expect![[r#" |
@@ -679,7 +679,7 @@ fn quux(x: i32) { | |||
679 | macro_rules! m { ($e:expr) => { $e } } | 679 | macro_rules! m { ($e:expr) => { $e } } |
680 | fn quux(x: i32) { | 680 | fn quux(x: i32) { |
681 | let y = 92; | 681 | let y = 92; |
682 | m!(x<|> | 682 | m!(x$0 |
683 | } | 683 | } |
684 | "#, | 684 | "#, |
685 | expect![[r#" | 685 | expect![[r#" |
@@ -697,7 +697,7 @@ fn quux(x: i32) { | |||
697 | r#" | 697 | r#" |
698 | use spam::Quux; | 698 | use spam::Quux; |
699 | 699 | ||
700 | fn main() { <|> } | 700 | fn main() { $0 } |
701 | "#, | 701 | "#, |
702 | expect![[r#" | 702 | expect![[r#" |
703 | fn main() fn main() | 703 | fn main() fn main() |
@@ -714,7 +714,7 @@ enum Foo { Bar, Baz, Quux } | |||
714 | 714 | ||
715 | fn main() { | 715 | fn main() { |
716 | let foo = Foo::Quux; | 716 | let foo = Foo::Quux; |
717 | match foo { Qu<|> } | 717 | match foo { Qu$0 } |
718 | } | 718 | } |
719 | "#, | 719 | "#, |
720 | expect![[r#" | 720 | expect![[r#" |
@@ -734,7 +734,7 @@ enum Foo { Bar, Baz, Quux } | |||
734 | 734 | ||
735 | fn main() { | 735 | fn main() { |
736 | let foo = Foo::Quux; | 736 | let foo = Foo::Quux; |
737 | match &foo { Qu<|> } | 737 | match &foo { Qu$0 } |
738 | } | 738 | } |
739 | "#, | 739 | "#, |
740 | expect![[r#" | 740 | expect![[r#" |
@@ -754,7 +754,7 @@ enum Foo { Bar, Baz, Quux } | |||
754 | 754 | ||
755 | fn main() { | 755 | fn main() { |
756 | let foo = Foo::Quux; | 756 | let foo = Foo::Quux; |
757 | if let Qu<|> = foo { } | 757 | if let Qu$0 = foo { } |
758 | } | 758 | } |
759 | "#, | 759 | "#, |
760 | expect![[r#" | 760 | expect![[r#" |
@@ -771,7 +771,7 @@ fn main() { | |||
771 | check( | 771 | check( |
772 | r#" | 772 | r#" |
773 | enum Foo { Bar, Baz, Quux } | 773 | enum Foo { Bar, Baz, Quux } |
774 | fn main() { let foo: Foo = Q<|> } | 774 | fn main() { let foo: Foo = Q$0 } |
775 | "#, | 775 | "#, |
776 | expect![[r#" | 776 | expect![[r#" |
777 | ev Foo::Bar () | 777 | ev Foo::Bar () |
@@ -788,7 +788,7 @@ fn main() { let foo: Foo = Q<|> } | |||
788 | check( | 788 | check( |
789 | r#" | 789 | r#" |
790 | mod m { pub enum E { V } } | 790 | mod m { pub enum E { V } } |
791 | fn f() -> m::E { V<|> } | 791 | fn f() -> m::E { V$0 } |
792 | "#, | 792 | "#, |
793 | expect![[r#" | 793 | expect![[r#" |
794 | ev m::E::V () | 794 | ev m::E::V () |
@@ -803,7 +803,7 @@ fn f() -> m::E { V<|> } | |||
803 | check( | 803 | check( |
804 | r#" | 804 | r#" |
805 | struct Foo; | 805 | struct Foo; |
806 | #[<|>] | 806 | #[$0] |
807 | fn f() {} | 807 | fn f() {} |
808 | "#, | 808 | "#, |
809 | expect![[""]], | 809 | expect![[""]], |
@@ -817,7 +817,7 @@ fn f() {} | |||
817 | trait MyTrait {} | 817 | trait MyTrait {} |
818 | struct MyStruct {} | 818 | struct MyStruct {} |
819 | 819 | ||
820 | impl My<|> | 820 | impl My$0 |
821 | "#, | 821 | "#, |
822 | expect![[r#" | 822 | expect![[r#" |
823 | tp Self | 823 | tp Self |
@@ -840,7 +840,7 @@ pub mod io { | |||
840 | 840 | ||
841 | //- /main.rs crate:main deps:dep | 841 | //- /main.rs crate:main deps:dep |
842 | fn main() { | 842 | fn main() { |
843 | stdi<|> | 843 | stdi$0 |
844 | } | 844 | } |
845 | "#, | 845 | "#, |
846 | r#" | 846 | r#" |
@@ -868,7 +868,7 @@ macro_rules! macro_with_curlies { | |||
868 | 868 | ||
869 | //- /main.rs crate:main deps:dep | 869 | //- /main.rs crate:main deps:dep |
870 | fn main() { | 870 | fn main() { |
871 | curli<|> | 871 | curli$0 |
872 | } | 872 | } |
873 | "#, | 873 | "#, |
874 | r#" | 874 | r#" |
@@ -898,7 +898,7 @@ pub mod some_module { | |||
898 | use dep::{FirstStruct, some_module::SecondStruct}; | 898 | use dep::{FirstStruct, some_module::SecondStruct}; |
899 | 899 | ||
900 | fn main() { | 900 | fn main() { |
901 | this<|> | 901 | this$0 |
902 | } | 902 | } |
903 | "#, | 903 | "#, |
904 | r#" | 904 | r#" |
@@ -936,7 +936,7 @@ pub mod some_module { | |||
936 | use dep::{FirstStruct, some_module::SecondStruct}; | 936 | use dep::{FirstStruct, some_module::SecondStruct}; |
937 | 937 | ||
938 | fn main() { | 938 | fn main() { |
939 | hir<|> | 939 | hir$0 |
940 | } | 940 | } |
941 | "#, | 941 | "#, |
942 | expect![[r#" | 942 | expect![[r#" |