diff options
Diffstat (limited to 'crates/ide/src/hover.rs')
-rw-r--r-- | crates/ide/src/hover.rs | 290 |
1 files changed, 135 insertions, 155 deletions
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index f2ad95cb6..317b6f011 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -1,6 +1,6 @@ | |||
1 | use hir::{ | 1 | use hir::{ |
2 | Adt, AsAssocItem, AssocItemContainer, FieldSource, HasAttrs, HasSource, HirDisplay, Module, | 2 | Adt, AsAssocItem, AssocItemContainer, FieldSource, GenericParam, HasAttrs, HasSource, |
3 | ModuleDef, ModuleSource, Semantics, | 3 | HirDisplay, Module, ModuleDef, ModuleSource, Semantics, |
4 | }; | 4 | }; |
5 | use ide_db::base_db::SourceDatabase; | 5 | use ide_db::base_db::SourceDatabase; |
6 | use ide_db::{ | 6 | use ide_db::{ |
@@ -17,7 +17,7 @@ use crate::{ | |||
17 | doc_links::{remove_links, rewrite_links}, | 17 | doc_links::{remove_links, rewrite_links}, |
18 | markdown_remove::remove_markdown, | 18 | markdown_remove::remove_markdown, |
19 | markup::Markup, | 19 | markup::Markup, |
20 | runnables::runnable, | 20 | runnables::{runnable_fn, runnable_mod}, |
21 | FileId, FilePosition, NavigationTarget, RangeInfo, Runnable, | 21 | FileId, FilePosition, NavigationTarget, RangeInfo, Runnable, |
22 | }; | 22 | }; |
23 | 23 | ||
@@ -31,19 +31,6 @@ pub struct HoverConfig { | |||
31 | pub markdown: bool, | 31 | pub markdown: bool, |
32 | } | 32 | } |
33 | 33 | ||
34 | impl Default for HoverConfig { | ||
35 | fn default() -> Self { | ||
36 | Self { | ||
37 | implementations: true, | ||
38 | run: true, | ||
39 | debug: true, | ||
40 | goto_type_def: true, | ||
41 | links_in_hover: true, | ||
42 | markdown: true, | ||
43 | } | ||
44 | } | ||
45 | } | ||
46 | |||
47 | impl HoverConfig { | 34 | impl HoverConfig { |
48 | pub const NO_ACTIONS: Self = Self { | 35 | pub const NO_ACTIONS: Self = Self { |
49 | implementations: false, | 36 | implementations: false, |
@@ -188,12 +175,7 @@ fn show_implementations_action(db: &RootDatabase, def: Definition) -> Option<Hov | |||
188 | Definition::SelfType(it) => it.target_ty(db).as_adt(), | 175 | Definition::SelfType(it) => it.target_ty(db).as_adt(), |
189 | _ => None, | 176 | _ => None, |
190 | }?; | 177 | }?; |
191 | match adt { | 178 | adt.try_to_nav(db).map(to_action) |
192 | Adt::Struct(it) => it.try_to_nav(db), | ||
193 | Adt::Union(it) => it.try_to_nav(db), | ||
194 | Adt::Enum(it) => it.try_to_nav(db), | ||
195 | } | ||
196 | .map(to_action) | ||
197 | } | 179 | } |
198 | 180 | ||
199 | fn runnable_action( | 181 | fn runnable_action( |
@@ -204,22 +186,20 @@ fn runnable_action( | |||
204 | match def { | 186 | match def { |
205 | Definition::ModuleDef(it) => match it { | 187 | Definition::ModuleDef(it) => match it { |
206 | ModuleDef::Module(it) => match it.definition_source(sema.db).value { | 188 | ModuleDef::Module(it) => match it.definition_source(sema.db).value { |
207 | ModuleSource::Module(it) => runnable(&sema, it.syntax().clone(), file_id) | 189 | ModuleSource::Module(it) => { |
208 | .map(|it| HoverAction::Runnable(it)), | 190 | runnable_mod(&sema, it).map(|it| HoverAction::Runnable(it)) |
191 | } | ||
209 | _ => None, | 192 | _ => None, |
210 | }, | 193 | }, |
211 | ModuleDef::Function(it) => { | 194 | ModuleDef::Function(func) => { |
212 | #[allow(deprecated)] | 195 | let src = func.source(sema.db)?; |
213 | let src = it.source(sema.db)?; | ||
214 | if src.file_id != file_id.into() { | 196 | if src.file_id != file_id.into() { |
215 | mark::hit!(hover_macro_generated_struct_fn_doc_comment); | 197 | mark::hit!(hover_macro_generated_struct_fn_doc_comment); |
216 | mark::hit!(hover_macro_generated_struct_fn_doc_attr); | 198 | mark::hit!(hover_macro_generated_struct_fn_doc_attr); |
217 | |||
218 | return None; | 199 | return None; |
219 | } | 200 | } |
220 | 201 | ||
221 | runnable(&sema, src.value.syntax().clone(), file_id) | 202 | runnable_fn(&sema, func).map(HoverAction::Runnable) |
222 | .map(|it| HoverAction::Runnable(it)) | ||
223 | } | 203 | } |
224 | _ => None, | 204 | _ => None, |
225 | }, | 205 | }, |
@@ -235,12 +215,12 @@ fn goto_type_action(db: &RootDatabase, def: Definition) -> Option<HoverAction> { | |||
235 | } | 215 | } |
236 | }; | 216 | }; |
237 | 217 | ||
238 | if let Definition::TypeParam(it) = def { | 218 | if let Definition::GenericParam(GenericParam::TypeParam(it)) = def { |
239 | it.trait_bounds(db).into_iter().for_each(|it| push_new_def(it.into())); | 219 | it.trait_bounds(db).into_iter().for_each(|it| push_new_def(it.into())); |
240 | } else { | 220 | } else { |
241 | let ty = match def { | 221 | let ty = match def { |
242 | Definition::Local(it) => it.ty(db), | 222 | Definition::Local(it) => it.ty(db), |
243 | Definition::ConstParam(it) => it.ty(db), | 223 | Definition::GenericParam(GenericParam::ConstParam(it)) => it.ty(db), |
244 | _ => return None, | 224 | _ => return None, |
245 | }; | 225 | }; |
246 | 226 | ||
@@ -335,7 +315,6 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
335 | from_def_source_labeled(db, it, Some(label), mod_path) | 315 | from_def_source_labeled(db, it, Some(label), mod_path) |
336 | } | 316 | } |
337 | Definition::Field(def) => { | 317 | Definition::Field(def) => { |
338 | #[allow(deprecated)] | ||
339 | let src = def.source(db)?.value; | 318 | let src = def.source(db)?.value; |
340 | if let FieldSource::Named(it) = src { | 319 | if let FieldSource::Named(it) = src { |
341 | from_def_source_labeled(db, def, it.short_label(), mod_path) | 320 | from_def_source_labeled(db, def, it.short_label(), mod_path) |
@@ -373,9 +352,11 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
373 | }) | 352 | }) |
374 | } | 353 | } |
375 | Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))), | 354 | Definition::Label(it) => Some(Markup::fenced_block(&it.name(db))), |
376 | Definition::LifetimeParam(it) => Some(Markup::fenced_block(&it.name(db))), | 355 | Definition::GenericParam(it) => match it { |
377 | Definition::TypeParam(type_param) => Some(Markup::fenced_block(&type_param.display(db))), | 356 | GenericParam::TypeParam(it) => Some(Markup::fenced_block(&it.display(db))), |
378 | Definition::ConstParam(it) => from_def_source(db, it, None), | 357 | GenericParam::LifetimeParam(it) => Some(Markup::fenced_block(&it.name(db))), |
358 | GenericParam::ConstParam(it) => from_def_source(db, it, None), | ||
359 | }, | ||
379 | }; | 360 | }; |
380 | 361 | ||
381 | fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup> | 362 | fn from_def_source<A, D>(db: &RootDatabase, def: D, mod_path: Option<String>) -> Option<Markup> |
@@ -383,7 +364,6 @@ fn hover_for_definition(db: &RootDatabase, def: Definition) -> Option<Markup> { | |||
383 | D: HasSource<Ast = A> + HasAttrs + Copy, | 364 | D: HasSource<Ast = A> + HasAttrs + Copy, |
384 | A: ShortLabel, | 365 | A: ShortLabel, |
385 | { | 366 | { |
386 | #[allow(deprecated)] | ||
387 | let short_label = def.source(db)?.value.short_label(); | 367 | let short_label = def.source(db)?.value.short_label(); |
388 | from_def_source_labeled(db, def, short_label, mod_path) | 368 | from_def_source_labeled(db, def, short_label, mod_path) |
389 | } | 369 | } |
@@ -474,7 +454,7 @@ mod tests { | |||
474 | pub fn foo() -> u32 { 1 } | 454 | pub fn foo() -> u32 { 1 } |
475 | 455 | ||
476 | fn main() { | 456 | fn main() { |
477 | let foo_test = foo()<|>; | 457 | let foo_test = foo()$0; |
478 | } | 458 | } |
479 | "#, | 459 | "#, |
480 | expect![[r#" | 460 | expect![[r#" |
@@ -493,7 +473,7 @@ fn main() { | |||
493 | pub fn foo() -> u32 { 1 } | 473 | pub fn foo() -> u32 { 1 } |
494 | 474 | ||
495 | fn main() { | 475 | fn main() { |
496 | let foo_test = foo()<|>; | 476 | let foo_test = foo()$0; |
497 | } | 477 | } |
498 | "#, | 478 | "#, |
499 | expect![[r#" | 479 | expect![[r#" |
@@ -523,7 +503,7 @@ fn main() { | |||
523 | Option::Some(*memo + value) | 503 | Option::Some(*memo + value) |
524 | }; | 504 | }; |
525 | let number = 5u32; | 505 | let number = 5u32; |
526 | let mut iter<|> = scan(OtherStruct { i: num }, closure, number); | 506 | let mut iter$0 = scan(OtherStruct { i: num }, closure, number); |
527 | } | 507 | } |
528 | "#, | 508 | "#, |
529 | expect![[r#" | 509 | expect![[r#" |
@@ -543,7 +523,7 @@ fn main() { | |||
543 | r#" | 523 | r#" |
544 | pub fn foo() -> u32 { 1 } | 524 | pub fn foo() -> u32 { 1 } |
545 | 525 | ||
546 | fn main() { let foo_test = fo<|>o(); } | 526 | fn main() { let foo_test = fo$0o(); } |
547 | "#, | 527 | "#, |
548 | expect![[r#" | 528 | expect![[r#" |
549 | *foo* | 529 | *foo* |
@@ -575,7 +555,7 @@ mod a; | |||
575 | mod b; | 555 | mod b; |
576 | mod c; | 556 | mod c; |
577 | 557 | ||
578 | fn main() { let foo_test = fo<|>o(); } | 558 | fn main() { let foo_test = fo$0o(); } |
579 | "#, | 559 | "#, |
580 | expect![[r#" | 560 | expect![[r#" |
581 | *foo* | 561 | *foo* |
@@ -592,7 +572,7 @@ fn main() { let foo_test = fo<|>o(); } | |||
592 | r#" | 572 | r#" |
593 | pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } | 573 | pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } |
594 | 574 | ||
595 | fn main() { let foo_test = fo<|>o(); } | 575 | fn main() { let foo_test = fo$0o(); } |
596 | "#, | 576 | "#, |
597 | expect![[r#" | 577 | expect![[r#" |
598 | *foo* | 578 | *foo* |
@@ -612,7 +592,7 @@ fn main() { let foo_test = fo<|>o(); } | |||
612 | fn hover_shows_fn_signature_on_fn_name() { | 592 | fn hover_shows_fn_signature_on_fn_name() { |
613 | check( | 593 | check( |
614 | r#" | 594 | r#" |
615 | pub fn foo<|>(a: u32, b: u32) -> u32 {} | 595 | pub fn foo$0(a: u32, b: u32) -> u32 {} |
616 | 596 | ||
617 | fn main() { } | 597 | fn main() { } |
618 | "#, | 598 | "#, |
@@ -640,7 +620,7 @@ fn main() { } | |||
640 | /// # | 620 | /// # |
641 | /// foo(Path::new("hello, world!")) | 621 | /// foo(Path::new("hello, world!")) |
642 | /// ``` | 622 | /// ``` |
643 | pub fn foo<|>(_: &Path) {} | 623 | pub fn foo$0(_: &Path) {} |
644 | 624 | ||
645 | fn main() { } | 625 | fn main() { } |
646 | "#, | 626 | "#, |
@@ -673,7 +653,7 @@ fn main() { } | |||
673 | check( | 653 | check( |
674 | r##" | 654 | r##" |
675 | #[doc = r#"Raw string doc attr"#] | 655 | #[doc = r#"Raw string doc attr"#] |
676 | pub fn foo<|>(_: &Path) {} | 656 | pub fn foo$0(_: &Path) {} |
677 | 657 | ||
678 | fn main() { } | 658 | fn main() { } |
679 | "##, | 659 | "##, |
@@ -703,7 +683,7 @@ fn main() { } | |||
703 | struct Foo { field_a: u32 } | 683 | struct Foo { field_a: u32 } |
704 | 684 | ||
705 | fn main() { | 685 | fn main() { |
706 | let foo = Foo { field_a<|>: 0, }; | 686 | let foo = Foo { field_a$0: 0, }; |
707 | } | 687 | } |
708 | "#, | 688 | "#, |
709 | expect![[r#" | 689 | expect![[r#" |
@@ -722,7 +702,7 @@ fn main() { | |||
722 | // Hovering over the field in the definition | 702 | // Hovering over the field in the definition |
723 | check( | 703 | check( |
724 | r#" | 704 | r#" |
725 | struct Foo { field_a<|>: u32 } | 705 | struct Foo { field_a$0: u32 } |
726 | 706 | ||
727 | fn main() { | 707 | fn main() { |
728 | let foo = Foo { field_a: 0 }; | 708 | let foo = Foo { field_a: 0 }; |
@@ -745,7 +725,7 @@ fn main() { | |||
745 | #[test] | 725 | #[test] |
746 | fn hover_const_static() { | 726 | fn hover_const_static() { |
747 | check( | 727 | check( |
748 | r#"const foo<|>: u32 = 123;"#, | 728 | r#"const foo$0: u32 = 123;"#, |
749 | expect![[r#" | 729 | expect![[r#" |
750 | *foo* | 730 | *foo* |
751 | 731 | ||
@@ -759,7 +739,7 @@ fn main() { | |||
759 | "#]], | 739 | "#]], |
760 | ); | 740 | ); |
761 | check( | 741 | check( |
762 | r#"static foo<|>: u32 = 456;"#, | 742 | r#"static foo$0: u32 = 456;"#, |
763 | expect![[r#" | 743 | expect![[r#" |
764 | *foo* | 744 | *foo* |
765 | 745 | ||
@@ -781,7 +761,7 @@ fn main() { | |||
781 | struct Test<K, T = u8> { k: K, t: T } | 761 | struct Test<K, T = u8> { k: K, t: T } |
782 | 762 | ||
783 | fn main() { | 763 | fn main() { |
784 | let zz<|> = Test { t: 23u8, k: 33 }; | 764 | let zz$0 = Test { t: 23u8, k: 33 }; |
785 | }"#, | 765 | }"#, |
786 | expect![[r#" | 766 | expect![[r#" |
787 | *zz* | 767 | *zz* |
@@ -800,7 +780,7 @@ fn main() { | |||
800 | enum Option<T> { Some(T) } | 780 | enum Option<T> { Some(T) } |
801 | use Option::Some; | 781 | use Option::Some; |
802 | 782 | ||
803 | fn main() { So<|>me(12); } | 783 | fn main() { So$0me(12); } |
804 | "#, | 784 | "#, |
805 | expect![[r#" | 785 | expect![[r#" |
806 | *Some* | 786 | *Some* |
@@ -820,7 +800,7 @@ fn main() { So<|>me(12); } | |||
820 | enum Option<T> { Some(T) } | 800 | enum Option<T> { Some(T) } |
821 | use Option::Some; | 801 | use Option::Some; |
822 | 802 | ||
823 | fn main() { let b<|>ar = Some(12); } | 803 | fn main() { let b$0ar = Some(12); } |
824 | "#, | 804 | "#, |
825 | expect![[r#" | 805 | expect![[r#" |
826 | *bar* | 806 | *bar* |
@@ -838,7 +818,7 @@ fn main() { let b<|>ar = Some(12); } | |||
838 | r#" | 818 | r#" |
839 | enum Option<T> { | 819 | enum Option<T> { |
840 | /// The None variant | 820 | /// The None variant |
841 | Non<|>e | 821 | Non$0e |
842 | } | 822 | } |
843 | "#, | 823 | "#, |
844 | expect![[r#" | 824 | expect![[r#" |
@@ -865,7 +845,7 @@ enum Option<T> { | |||
865 | Some(T) | 845 | Some(T) |
866 | } | 846 | } |
867 | fn main() { | 847 | fn main() { |
868 | let s = Option::Som<|>e(12); | 848 | let s = Option::Som$0e(12); |
869 | } | 849 | } |
870 | "#, | 850 | "#, |
871 | expect![[r#" | 851 | expect![[r#" |
@@ -889,7 +869,7 @@ fn main() { | |||
889 | #[test] | 869 | #[test] |
890 | fn hover_for_local_variable() { | 870 | fn hover_for_local_variable() { |
891 | check( | 871 | check( |
892 | r#"fn func(foo: i32) { fo<|>o; }"#, | 872 | r#"fn func(foo: i32) { fo$0o; }"#, |
893 | expect![[r#" | 873 | expect![[r#" |
894 | *foo* | 874 | *foo* |
895 | 875 | ||
@@ -903,7 +883,7 @@ fn main() { | |||
903 | #[test] | 883 | #[test] |
904 | fn hover_for_local_variable_pat() { | 884 | fn hover_for_local_variable_pat() { |
905 | check( | 885 | check( |
906 | r#"fn func(fo<|>o: i32) {}"#, | 886 | r#"fn func(fo$0o: i32) {}"#, |
907 | expect![[r#" | 887 | expect![[r#" |
908 | *foo* | 888 | *foo* |
909 | 889 | ||
@@ -917,7 +897,7 @@ fn main() { | |||
917 | #[test] | 897 | #[test] |
918 | fn hover_local_var_edge() { | 898 | fn hover_local_var_edge() { |
919 | check( | 899 | check( |
920 | r#"fn func(foo: i32) { if true { <|>foo; }; }"#, | 900 | r#"fn func(foo: i32) { if true { $0foo; }; }"#, |
921 | expect![[r#" | 901 | expect![[r#" |
922 | *foo* | 902 | *foo* |
923 | 903 | ||
@@ -931,7 +911,7 @@ fn main() { | |||
931 | #[test] | 911 | #[test] |
932 | fn hover_for_param_edge() { | 912 | fn hover_for_param_edge() { |
933 | check( | 913 | check( |
934 | r#"fn func(<|>foo: i32) {}"#, | 914 | r#"fn func($0foo: i32) {}"#, |
935 | expect![[r#" | 915 | expect![[r#" |
936 | *foo* | 916 | *foo* |
937 | 917 | ||
@@ -951,7 +931,7 @@ fn main() { | |||
951 | trait DerefMut { | 931 | trait DerefMut { |
952 | type Target: ?Sized; | 932 | type Target: ?Sized; |
953 | } | 933 | } |
954 | fn f(_x<|>: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#, | 934 | fn f(_x$0: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#, |
955 | expect![[r#" | 935 | expect![[r#" |
956 | *_x* | 936 | *_x* |
957 | 937 | ||
@@ -972,7 +952,7 @@ impl Thing { | |||
972 | fn new() -> Thing { Thing { x: 0 } } | 952 | fn new() -> Thing { Thing { x: 0 } } |
973 | } | 953 | } |
974 | 954 | ||
975 | fn main() { let foo_<|>test = Thing::new(); } | 955 | fn main() { let foo_$0test = Thing::new(); } |
976 | "#, | 956 | "#, |
977 | expect![[r#" | 957 | expect![[r#" |
978 | *foo_test* | 958 | *foo_test* |
@@ -996,7 +976,7 @@ mod wrapper { | |||
996 | } | 976 | } |
997 | } | 977 | } |
998 | 978 | ||
999 | fn main() { let foo_test = wrapper::Thing::new<|>(); } | 979 | fn main() { let foo_test = wrapper::Thing::new$0(); } |
1000 | "#, | 980 | "#, |
1001 | expect![[r#" | 981 | expect![[r#" |
1002 | *new* | 982 | *new* |
@@ -1023,7 +1003,7 @@ impl X { | |||
1023 | 1003 | ||
1024 | fn main() { | 1004 | fn main() { |
1025 | match 1 { | 1005 | match 1 { |
1026 | X::C<|> => {}, | 1006 | X::C$0 => {}, |
1027 | 2 => {}, | 1007 | 2 => {}, |
1028 | _ => {} | 1008 | _ => {} |
1029 | }; | 1009 | }; |
@@ -1049,7 +1029,7 @@ fn main() { | |||
1049 | r#" | 1029 | r#" |
1050 | struct Thing { x: u32 } | 1030 | struct Thing { x: u32 } |
1051 | impl Thing { | 1031 | impl Thing { |
1052 | fn new() -> Self { Self<|> { x: 0 } } | 1032 | fn new() -> Self { Self$0 { x: 0 } } |
1053 | } | 1033 | } |
1054 | "#, | 1034 | "#, |
1055 | expect![[r#" | 1035 | expect![[r#" |
@@ -1068,7 +1048,7 @@ impl Thing { | |||
1068 | r#" | 1048 | r#" |
1069 | struct Thing { x: u32 } | 1049 | struct Thing { x: u32 } |
1070 | impl Thing { | 1050 | impl Thing { |
1071 | fn new() -> Self<|> { Self { x: 0 } } | 1051 | fn new() -> Self$0 { Self { x: 0 } } |
1072 | } | 1052 | } |
1073 | "#, | 1053 | "#, |
1074 | expect![[r#" | 1054 | expect![[r#" |
@@ -1087,7 +1067,7 @@ impl Thing { | |||
1087 | r#" | 1067 | r#" |
1088 | enum Thing { A } | 1068 | enum Thing { A } |
1089 | impl Thing { | 1069 | impl Thing { |
1090 | pub fn new() -> Self<|> { Thing::A } | 1070 | pub fn new() -> Self$0 { Thing::A } |
1091 | } | 1071 | } |
1092 | "#, | 1072 | "#, |
1093 | expect![[r#" | 1073 | expect![[r#" |
@@ -1106,7 +1086,7 @@ impl Thing { | |||
1106 | r#" | 1086 | r#" |
1107 | enum Thing { A } | 1087 | enum Thing { A } |
1108 | impl Thing { | 1088 | impl Thing { |
1109 | pub fn thing(a: Self<|>) {} | 1089 | pub fn thing(a: Self$0) {} |
1110 | } | 1090 | } |
1111 | "#, | 1091 | "#, |
1112 | expect![[r#" | 1092 | expect![[r#" |
@@ -1131,7 +1111,7 @@ fn x() {} | |||
1131 | 1111 | ||
1132 | fn y() { | 1112 | fn y() { |
1133 | let x = 0i32; | 1113 | let x = 0i32; |
1134 | x<|>; | 1114 | x$0; |
1135 | } | 1115 | } |
1136 | "#, | 1116 | "#, |
1137 | expect![[r#" | 1117 | expect![[r#" |
@@ -1150,7 +1130,7 @@ fn y() { | |||
1150 | r#" | 1130 | r#" |
1151 | macro_rules! foo { () => {} } | 1131 | macro_rules! foo { () => {} } |
1152 | 1132 | ||
1153 | fn f() { fo<|>o!(); } | 1133 | fn f() { fo$0o!(); } |
1154 | "#, | 1134 | "#, |
1155 | expect![[r#" | 1135 | expect![[r#" |
1156 | *foo* | 1136 | *foo* |
@@ -1169,7 +1149,7 @@ fn f() { fo<|>o!(); } | |||
1169 | #[test] | 1149 | #[test] |
1170 | fn test_hover_tuple_field() { | 1150 | fn test_hover_tuple_field() { |
1171 | check( | 1151 | check( |
1172 | r#"struct TS(String, i32<|>);"#, | 1152 | r#"struct TS(String, i32$0);"#, |
1173 | expect![[r#" | 1153 | expect![[r#" |
1174 | *i32* | 1154 | *i32* |
1175 | 1155 | ||
@@ -1187,7 +1167,7 @@ fn f() { fo<|>o!(); } | |||
1187 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | 1167 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } |
1188 | fn foo() {} | 1168 | fn foo() {} |
1189 | id! { | 1169 | id! { |
1190 | fn bar() { fo<|>o(); } | 1170 | fn bar() { fo$0o(); } |
1191 | } | 1171 | } |
1192 | "#, | 1172 | "#, |
1193 | expect![[r#" | 1173 | expect![[r#" |
@@ -1209,7 +1189,7 @@ id! { | |||
1209 | check( | 1189 | check( |
1210 | r#" | 1190 | r#" |
1211 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | 1191 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } |
1212 | fn foo(bar:u32) { let a = id!(ba<|>r); } | 1192 | fn foo(bar:u32) { let a = id!(ba$0r); } |
1213 | "#, | 1193 | "#, |
1214 | expect![[r#" | 1194 | expect![[r#" |
1215 | *bar* | 1195 | *bar* |
@@ -1227,7 +1207,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); } | |||
1227 | r#" | 1207 | r#" |
1228 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } | 1208 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } |
1229 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } | 1209 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } |
1230 | fn foo(bar:u32) { let a = id!(ba<|>r); } | 1210 | fn foo(bar:u32) { let a = id!(ba$0r); } |
1231 | "#, | 1211 | "#, |
1232 | expect![[r#" | 1212 | expect![[r#" |
1233 | *bar* | 1213 | *bar* |
@@ -1246,7 +1226,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); } | |||
1246 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } | 1226 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } |
1247 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } | 1227 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } |
1248 | fn bar() -> u32 { 0 } | 1228 | fn bar() -> u32 { 0 } |
1249 | fn foo() { let a = id!([0u32, bar(<|>)] ); } | 1229 | fn foo() { let a = id!([0u32, bar($0)] ); } |
1250 | "#, | 1230 | "#, |
1251 | expect![[r#" | 1231 | expect![[r#" |
1252 | *bar()* | 1232 | *bar()* |
@@ -1264,7 +1244,7 @@ fn foo() { let a = id!([0u32, bar(<|>)] ); } | |||
1264 | macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } | 1244 | macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } |
1265 | fn foo() { | 1245 | fn foo() { |
1266 | let mastered_for_itunes = ""; | 1246 | let mastered_for_itunes = ""; |
1267 | let _ = arr!("Tr<|>acks", &mastered_for_itunes); | 1247 | let _ = arr!("Tr$0acks", &mastered_for_itunes); |
1268 | } | 1248 | } |
1269 | "#, | 1249 | "#, |
1270 | expect![[r#" | 1250 | expect![[r#" |
@@ -1285,7 +1265,7 @@ macro_rules! assert {} | |||
1285 | 1265 | ||
1286 | fn bar() -> bool { true } | 1266 | fn bar() -> bool { true } |
1287 | fn foo() { | 1267 | fn foo() { |
1288 | assert!(ba<|>r()); | 1268 | assert!(ba$0r()); |
1289 | } | 1269 | } |
1290 | "#, | 1270 | "#, |
1291 | expect![[r#" | 1271 | expect![[r#" |
@@ -1310,7 +1290,7 @@ fn foo() { | |||
1310 | macro_rules! format {} | 1290 | macro_rules! format {} |
1311 | 1291 | ||
1312 | fn foo() { | 1292 | fn foo() { |
1313 | format!("hel<|>lo {}", 0); | 1293 | format!("hel$0lo {}", 0); |
1314 | } | 1294 | } |
1315 | "#, | 1295 | "#, |
1316 | ); | 1296 | ); |
@@ -1323,7 +1303,7 @@ fn foo() { | |||
1323 | /// <- `\u{3000}` here | 1303 | /// <- `\u{3000}` here |
1324 | fn foo() { } | 1304 | fn foo() { } |
1325 | 1305 | ||
1326 | fn bar() { fo<|>o(); } | 1306 | fn bar() { fo$0o(); } |
1327 | ", | 1307 | ", |
1328 | expect![[r#" | 1308 | expect![[r#" |
1329 | *foo* | 1309 | *foo* |
@@ -1346,7 +1326,7 @@ fn bar() { fo<|>o(); } | |||
1346 | #[test] | 1326 | #[test] |
1347 | fn test_hover_function_show_qualifiers() { | 1327 | fn test_hover_function_show_qualifiers() { |
1348 | check( | 1328 | check( |
1349 | r#"async fn foo<|>() {}"#, | 1329 | r#"async fn foo$0() {}"#, |
1350 | expect![[r#" | 1330 | expect![[r#" |
1351 | *foo* | 1331 | *foo* |
1352 | 1332 | ||
@@ -1360,7 +1340,7 @@ fn bar() { fo<|>o(); } | |||
1360 | "#]], | 1340 | "#]], |
1361 | ); | 1341 | ); |
1362 | check( | 1342 | check( |
1363 | r#"pub const unsafe fn foo<|>() {}"#, | 1343 | r#"pub const unsafe fn foo$0() {}"#, |
1364 | expect![[r#" | 1344 | expect![[r#" |
1365 | *foo* | 1345 | *foo* |
1366 | 1346 | ||
@@ -1374,7 +1354,7 @@ fn bar() { fo<|>o(); } | |||
1374 | "#]], | 1354 | "#]], |
1375 | ); | 1355 | ); |
1376 | check( | 1356 | check( |
1377 | r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, | 1357 | r#"pub(crate) async unsafe extern "C" fn foo$0() {}"#, |
1378 | expect![[r#" | 1358 | expect![[r#" |
1379 | *foo* | 1359 | *foo* |
1380 | 1360 | ||
@@ -1392,7 +1372,7 @@ fn bar() { fo<|>o(); } | |||
1392 | #[test] | 1372 | #[test] |
1393 | fn test_hover_trait_show_qualifiers() { | 1373 | fn test_hover_trait_show_qualifiers() { |
1394 | check_actions( | 1374 | check_actions( |
1395 | r"unsafe trait foo<|>() {}", | 1375 | r"unsafe trait foo$0() {}", |
1396 | expect![[r#" | 1376 | expect![[r#" |
1397 | [ | 1377 | [ |
1398 | Implementation( | 1378 | Implementation( |
@@ -1413,7 +1393,7 @@ fn bar() { fo<|>o(); } | |||
1413 | check( | 1393 | check( |
1414 | r#" | 1394 | r#" |
1415 | //- /main.rs crate:main deps:std | 1395 | //- /main.rs crate:main deps:std |
1416 | extern crate st<|>d; | 1396 | extern crate st$0d; |
1417 | //- /std/lib.rs crate:std | 1397 | //- /std/lib.rs crate:std |
1418 | //! Standard library for this test | 1398 | //! Standard library for this test |
1419 | //! | 1399 | //! |
@@ -1431,7 +1411,7 @@ extern crate st<|>d; | |||
1431 | check( | 1411 | check( |
1432 | r#" | 1412 | r#" |
1433 | //- /main.rs crate:main deps:std | 1413 | //- /main.rs crate:main deps:std |
1434 | extern crate std as ab<|>c; | 1414 | extern crate std as ab$0c; |
1435 | //- /std/lib.rs crate:std | 1415 | //- /std/lib.rs crate:std |
1436 | //! Standard library for this test | 1416 | //! Standard library for this test |
1437 | //! | 1417 | //! |
@@ -1452,7 +1432,7 @@ extern crate std as ab<|>c; | |||
1452 | fn test_hover_mod_with_same_name_as_function() { | 1432 | fn test_hover_mod_with_same_name_as_function() { |
1453 | check( | 1433 | check( |
1454 | r#" | 1434 | r#" |
1455 | use self::m<|>y::Bar; | 1435 | use self::m$0y::Bar; |
1456 | mod my { pub struct Bar; } | 1436 | mod my { pub struct Bar; } |
1457 | 1437 | ||
1458 | fn my() {} | 1438 | fn my() {} |
@@ -1478,7 +1458,7 @@ fn my() {} | |||
1478 | /// bar docs | 1458 | /// bar docs |
1479 | struct Bar; | 1459 | struct Bar; |
1480 | 1460 | ||
1481 | fn foo() { let bar = Ba<|>r; } | 1461 | fn foo() { let bar = Ba$0r; } |
1482 | "#, | 1462 | "#, |
1483 | expect![[r#" | 1463 | expect![[r#" |
1484 | *Bar* | 1464 | *Bar* |
@@ -1505,7 +1485,7 @@ fn foo() { let bar = Ba<|>r; } | |||
1505 | #[doc = "bar docs"] | 1485 | #[doc = "bar docs"] |
1506 | struct Bar; | 1486 | struct Bar; |
1507 | 1487 | ||
1508 | fn foo() { let bar = Ba<|>r; } | 1488 | fn foo() { let bar = Ba$0r; } |
1509 | "#, | 1489 | "#, |
1510 | expect![[r#" | 1490 | expect![[r#" |
1511 | *Bar* | 1491 | *Bar* |
@@ -1534,7 +1514,7 @@ fn foo() { let bar = Ba<|>r; } | |||
1534 | #[doc = "bar docs 2"] | 1514 | #[doc = "bar docs 2"] |
1535 | struct Bar; | 1515 | struct Bar; |
1536 | 1516 | ||
1537 | fn foo() { let bar = Ba<|>r; } | 1517 | fn foo() { let bar = Ba$0r; } |
1538 | "#, | 1518 | "#, |
1539 | expect | 1544 | /// [Foo](struct.Foo.html) |
1565 | pub struct B<|>ar | 1545 | pub struct B$0ar |
1566 | "#, | 1546 | "#, |
1567 | expect | 1570 | /// [struct Foo](struct.Foo.html) |
1591 | pub struct B<|>ar | 1571 | pub struct B$0ar |
1592 | "#, | 1572 | "#, |
1593 | expect | 1598 | /// [Foo](struct.Foo.html) |
1619 | fie<|>ld: () | 1599 | fie$0ld: () |
1620 | } | 1600 | } |
1621 | "#, | 1601 | "#, |
1622 | expect | 1627 | /// [Foo](foo::Foo) |
1648 | pub struct B<|>ar | 1628 | pub struct B$0ar |
1649 | "#, | 1629 | "#, |
1650 | expect | 1657 | /// [Foo](foo::Foo) |
1678 | pub struct B<|>ar | 1658 | pub struct B$0ar |
1679 | "#, | 1659 | "#, |
1680 | expect![[r#" | 1660 | expect![[r#" |
1681 | *Bar* | 1661 | *Bar* |
@@ -1701,7 +1681,7 @@ pub struct B<|>ar | |||
1701 | r#" | 1681 | r#" |
1702 | pub struct Foo; | 1682 | pub struct Foo; |
1703 | /// [Foo] | 1683 | /// [Foo] |
1704 | pub struct B<|>ar | 1684 | pub struct B$0ar |
1705 | "#, | 1685 | "#, |
1706 | expect![[r#" | 1686 | expect![[r#" |
1707 | *Bar* | 1687 | *Bar* |
@@ -1727,7 +1707,7 @@ pub struct B<|>ar | |||
1727 | r#" | 1707 | r#" |
1728 | pub struct Foo; | 1708 | pub struct Foo; |
1729 | /// [`Foo`] | 1709 | /// [`Foo`] |
1730 | pub struct B<|>ar | 1710 | pub struct B$0ar |
1731 | "#, | 1711 | "#, |
1732 | expect![[r#" | 1712 | expect![[r#" |
1733 | *Bar* | 1713 | *Bar* |
@@ -1754,7 +1734,7 @@ pub struct B<|>ar | |||
1754 | pub struct Foo; | 1734 | pub struct Foo; |
1755 | fn Foo() {} | 1735 | fn Foo() {} |
1756 | /// [Foo()] | 1736 | /// [Foo()] |
1757 | pub struct B<|>ar | 1737 | pub struct B$0ar |
1758 | "#, | 1738 | "#, |
1759 | expect![[r#" | 1739 | expect![[r#" |
1760 | *Bar* | 1740 | *Bar* |
@@ -1780,7 +1760,7 @@ pub struct B<|>ar | |||
1780 | r#" | 1760 | r#" |
1781 | pub struct Foo; | 1761 | pub struct Foo; |
1782 | /// [`struct Foo`] | 1762 | /// [`struct Foo`] |
1783 | pub struct B<|>ar | 1763 | pub struct B$0ar |
1784 | "#, | 1764 | "#, |
1785 | expect![[r#" | 1765 | expect![[r#" |
1786 | *Bar* | 1766 | *Bar* |
@@ -1806,7 +1786,7 @@ pub struct B<|>ar | |||
1806 | r#" | 1786 | r#" |
1807 | pub struct Foo; | 1787 | pub struct Foo; |
1808 | /// [`struct@Foo`] | 1788 | /// [`struct@Foo`] |
1809 | pub struct B<|>ar | 1789 | pub struct B$0ar |
1810 | "#, | 1790 | "#, |
1811 | expect![[r#" | 1791 | expect![[r#" |
1812 | *Bar* | 1792 | *Bar* |
@@ -1834,7 +1814,7 @@ pub struct Foo; | |||
1834 | /// [my Foo][foo] | 1814 | /// [my Foo][foo] |
1835 | /// | 1815 | /// |
1836 | /// [foo]: Foo | 1816 | /// [foo]: Foo |
1837 | pub struct B<|>ar | 1817 | pub struct B$0ar |
1838 | "#, | 1818 | "#, |
1839 | expect | 1842 | /// [external](https://www.google.com) |
1863 | pub struct B<|>ar | 1843 | pub struct B$0ar |
1864 | "#, | 1844 | "#, |
1865 | expect | 1869 | /// [baz](Baz) |
1890 | pub struct B<|>ar | 1870 | pub struct B$0ar |
1891 | "#, | 1871 | "#, |
1892 | expect![[r#" | 1872 | expect![[r#" |
1893 | *Bar* | 1873 | *Bar* |
@@ -1913,7 +1893,7 @@ pub struct B<|>ar | |||
1913 | r#" | 1893 | r#" |
1914 | enum E { | 1894 | enum E { |
1915 | /// [E] | 1895 | /// [E] |
1916 | V<|> { field: i32 } | 1896 | V$0 { field: i32 } |
1917 | } | 1897 | } |
1918 | "#, | 1898 | "#, |
1919 | expect![[r#" | 1899 | expect![[r#" |
@@ -1940,7 +1920,7 @@ enum E { | |||
1940 | r#" | 1920 | r#" |
1941 | struct S { | 1921 | struct S { |
1942 | /// [`S`] | 1922 | /// [`S`] |
1943 | field<|>: i32 | 1923 | field$0: i32 |
1944 | } | 1924 | } |
1945 | "#, | 1925 | "#, |
1946 | expect | 1950 | /// case 2. inline URL with title: [example](https://www.example.com/) |
1971 | /// case 3. code refrence: [`Result`] | 1951 | /// case 3. code reference: [`Result`] |
1972 | /// case 4. code refrence but miss footnote: [`String`] | 1952 | /// case 4. code reference but miss footnote: [`String`] |
1973 | /// case 5. autolink: <http://www.example.com/> | 1953 | /// case 5. autolink: <http://www.example.com/> |
1974 | /// case 6. email address: <[email protected]> | 1954 | /// case 6. email address: <[email protected]> |
1975 | /// case 7. refrence: [example][example] | 1955 | /// case 7. reference: [example][example] |
1976 | /// case 8. collapsed link: [example][] | 1956 | /// case 8. collapsed link: [example][] |
1977 | /// case 9. shortcut link: [example] | 1957 | /// case 9. shortcut link: [example] |
1978 | /// case 10. inline without URL: [example]() | 1958 | /// case 10. inline without URL: [example]() |
1979 | /// case 11. refrence: [foo][foo] | 1959 | /// case 11. reference: [foo][foo] |
1980 | /// case 12. refrence: [foo][bar] | 1960 | /// case 12. reference: [foo][bar] |
1981 | /// case 13. collapsed link: [foo][] | 1961 | /// case 13. collapsed link: [foo][] |
1982 | /// case 14. shortcut link: [foo] | 1962 | /// case 14. shortcut link: [foo] |
1983 | /// case 15. inline without URL: [foo]() | 1963 | /// case 15. inline without URL: [foo]() |
@@ -1986,7 +1966,7 @@ struct S { | |||
1986 | /// | 1966 | /// |
1987 | /// [`Result`]: ../../std/result/enum.Result.html | 1967 | /// [`Result`]: ../../std/result/enum.Result.html |
1988 | /// [^example]: https://www.example.com/ | 1968 | /// [^example]: https://www.example.com/ |
1989 | pub fn fo<|>o() {} | 1969 | pub fn fo$0o() {} |
1990 | "#, | 1970 | "#, |
1991 | expect | 1986 | case 2. inline URL with title: [example](https://www.example.com/) |
2007 | case 3. code refrence: `Result` | 1987 | case 3. code reference: `Result` |
2008 | case 4. code refrence but miss footnote: `String` | 1988 | case 4. code reference but miss footnote: `String` |
2009 | case 5. autolink: http://www.example.com/ | 1989 | case 5. autolink: http://www.example.com/ |
2010 | case 6. email address: [email protected] | 1990 | case 6. email address: [email protected] |
2011 | case 7. refrence: example | 1991 | case 7. reference: example |
2012 | case 8. collapsed link: example | 1992 | case 8. collapsed link: example |
2013 | case 9. shortcut link: example | 1993 | case 9. shortcut link: example |
2014 | case 10. inline without URL: example | 1994 | case 10. inline without URL: example |
2015 | case 11. refrence: foo | 1995 | case 11. reference: foo |
2016 | case 12. refrence: foo | 1996 | case 12. reference: foo |
2017 | case 13. collapsed link: foo | 1997 | case 13. collapsed link: foo |
2018 | case 14. shortcut link: foo | 1998 | case 14. shortcut link: foo |
2019 | case 15. inline without URL: foo | 1999 | case 15. inline without URL: foo |
@@ -2043,7 +2023,7 @@ macro_rules! bar { | |||
2043 | 2023 | ||
2044 | bar!(); | 2024 | bar!(); |
2045 | 2025 | ||
2046 | fn foo() { let bar = Bar; bar.fo<|>o(); } | 2026 | fn foo() { let bar = Bar; bar.fo$0o(); } |
2047 | "#, | 2027 | "#, |
2048 | expect![[r#" | 2028 | expect![[r#" |
2049 | *foo* | 2029 | *foo* |
@@ -2081,7 +2061,7 @@ macro_rules! bar { | |||
2081 | 2061 | ||
2082 | bar!(); | 2062 | bar!(); |
2083 | 2063 | ||
2084 | fn foo() { let bar = Bar; bar.fo<|>o(); } | 2064 | fn foo() { let bar = Bar; bar.fo$0o(); } |
2085 | "#, | 2065 | "#, |
2086 | expect![[r#" | 2066 | expect![[r#" |
2087 | *foo* | 2067 | *foo* |
@@ -2104,7 +2084,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2104 | #[test] | 2084 | #[test] |
2105 | fn test_hover_trait_has_impl_action() { | 2085 | fn test_hover_trait_has_impl_action() { |
2106 | check_actions( | 2086 | check_actions( |
2107 | r#"trait foo<|>() {}"#, | 2087 | r#"trait foo$0() {}"#, |
2108 | expect![[r#" | 2088 | expect![[r#" |
2109 | [ | 2089 | [ |
2110 | Implementation( | 2090 | Implementation( |
@@ -2123,7 +2103,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2123 | #[test] | 2103 | #[test] |
2124 | fn test_hover_struct_has_impl_action() { | 2104 | fn test_hover_struct_has_impl_action() { |
2125 | check_actions( | 2105 | check_actions( |
2126 | r"struct foo<|>() {}", | 2106 | r"struct foo$0() {}", |
2127 | expect![[r#" | 2107 | expect![[r#" |
2128 | [ | 2108 | [ |
2129 | Implementation( | 2109 | Implementation( |
@@ -2142,7 +2122,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2142 | #[test] | 2122 | #[test] |
2143 | fn test_hover_union_has_impl_action() { | 2123 | fn test_hover_union_has_impl_action() { |
2144 | check_actions( | 2124 | check_actions( |
2145 | r#"union foo<|>() {}"#, | 2125 | r#"union foo$0() {}"#, |
2146 | expect![[r#" | 2126 | expect![[r#" |
2147 | [ | 2127 | [ |
2148 | Implementation( | 2128 | Implementation( |
@@ -2161,7 +2141,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2161 | #[test] | 2141 | #[test] |
2162 | fn test_hover_enum_has_impl_action() { | 2142 | fn test_hover_enum_has_impl_action() { |
2163 | check_actions( | 2143 | check_actions( |
2164 | r"enum foo<|>() { A, B }", | 2144 | r"enum foo$0() { A, B }", |
2165 | expect![[r#" | 2145 | expect![[r#" |
2166 | [ | 2146 | [ |
2167 | Implementation( | 2147 | Implementation( |
@@ -2180,7 +2160,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2180 | #[test] | 2160 | #[test] |
2181 | fn test_hover_self_has_impl_action() { | 2161 | fn test_hover_self_has_impl_action() { |
2182 | check_actions( | 2162 | check_actions( |
2183 | r#"struct foo where Self<|>:;"#, | 2163 | r#"struct foo where Self$0:;"#, |
2184 | expect![[r#" | 2164 | expect![[r#" |
2185 | [ | 2165 | [ |
2186 | Implementation( | 2166 | Implementation( |
@@ -2201,7 +2181,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2201 | check_actions( | 2181 | check_actions( |
2202 | r#" | 2182 | r#" |
2203 | #[test] | 2183 | #[test] |
2204 | fn foo_<|>test() {} | 2184 | fn foo_$0test() {} |
2205 | "#, | 2185 | "#, |
2206 | expect![[r#" | 2186 | expect![[r#" |
2207 | [ | 2187 | [ |
@@ -2236,7 +2216,7 @@ fn foo_<|>test() {} | |||
2236 | fn test_hover_test_mod_has_action() { | 2216 | fn test_hover_test_mod_has_action() { |
2237 | check_actions( | 2217 | check_actions( |
2238 | r#" | 2218 | r#" |
2239 | mod tests<|> { | 2219 | mod tests$0 { |
2240 | #[test] | 2220 | #[test] |
2241 | fn foo_test() {} | 2221 | fn foo_test() {} |
2242 | } | 2222 | } |
@@ -2271,7 +2251,7 @@ mod tests<|> { | |||
2271 | r#" | 2251 | r#" |
2272 | struct S{ f1: u32 } | 2252 | struct S{ f1: u32 } |
2273 | 2253 | ||
2274 | fn main() { let s<|>t = S{ f1:0 }; } | 2254 | fn main() { let s$0t = S{ f1:0 }; } |
2275 | "#, | 2255 | "#, |
2276 | expect![[r#" | 2256 | expect![[r#" |
2277 | [ | 2257 | [ |
@@ -2304,7 +2284,7 @@ fn main() { let s<|>t = S{ f1:0 }; } | |||
2304 | struct Arg(u32); | 2284 | struct Arg(u32); |
2305 | struct S<T>{ f1: T } | 2285 | struct S<T>{ f1: T } |
2306 | 2286 | ||
2307 | fn main() { let s<|>t = S{ f1:Arg(0) }; } | 2287 | fn main() { let s$0t = S{ f1:Arg(0) }; } |
2308 | "#, | 2288 | "#, |
2309 | expect![[r#" | 2289 | expect![[r#" |
2310 | [ | 2290 | [ |
@@ -2350,7 +2330,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } | |||
2350 | struct Arg(u32); | 2330 | struct Arg(u32); |
2351 | struct S<T>{ f1: T } | 2331 | struct S<T>{ f1: T } |
2352 | 2332 | ||
2353 | fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } | 2333 | fn main() { let s$0t = S{ f1: S{ f1: Arg(0) } }; } |
2354 | "#, | 2334 | "#, |
2355 | expect![[r#" | 2335 | expect![[r#" |
2356 | [ | 2336 | [ |
@@ -2399,7 +2379,7 @@ mod M { | |||
2399 | pub struct C(u32); | 2379 | pub struct C(u32); |
2400 | } | 2380 | } |
2401 | 2381 | ||
2402 | fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | 2382 | fn main() { let s$0t = (A(1), B(2), M::C(3) ); } |
2403 | "#, | 2383 | "#, |
2404 | expect![[r#" | 2384 | expect![[r#" |
2405 | [ | 2385 | [ |
@@ -2458,7 +2438,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | |||
2458 | trait Foo {} | 2438 | trait Foo {} |
2459 | fn foo() -> impl Foo {} | 2439 | fn foo() -> impl Foo {} |
2460 | 2440 | ||
2461 | fn main() { let s<|>t = foo(); } | 2441 | fn main() { let s$0t = foo(); } |
2462 | "#, | 2442 | "#, |
2463 | expect![[r#" | 2443 | expect![[r#" |
2464 | [ | 2444 | [ |
@@ -2492,7 +2472,7 @@ trait Foo<T> {} | |||
2492 | struct S; | 2472 | struct S; |
2493 | fn foo() -> impl Foo<S> {} | 2473 | fn foo() -> impl Foo<S> {} |
2494 | 2474 | ||
2495 | fn main() { let s<|>t = foo(); } | 2475 | fn main() { let s$0t = foo(); } |
2496 | "#, | 2476 | "#, |
2497 | expect![[r#" | 2477 | expect![[r#" |
2498 | [ | 2478 | [ |
@@ -2539,7 +2519,7 @@ trait Foo {} | |||
2539 | trait Bar {} | 2519 | trait Bar {} |
2540 | fn foo() -> impl Foo + Bar {} | 2520 | fn foo() -> impl Foo + Bar {} |
2541 | 2521 | ||
2542 | fn main() { let s<|>t = foo(); } | 2522 | fn main() { let s$0t = foo(); } |
2543 | "#, | 2523 | "#, |
2544 | expect![[r#" | 2524 | expect![[r#" |
2545 | [ | 2525 | [ |
@@ -2589,7 +2569,7 @@ struct S2 {} | |||
2589 | 2569 | ||
2590 | fn foo() -> impl Foo<S1> + Bar<S2> {} | 2570 | fn foo() -> impl Foo<S1> + Bar<S2> {} |
2591 | 2571 | ||
2592 | fn main() { let s<|>t = foo(); } | 2572 | fn main() { let s$0t = foo(); } |
2593 | "#, | 2573 | "#, |
2594 | expect![[r#" | 2574 | expect![[r#" |
2595 | [ | 2575 | [ |
@@ -2659,7 +2639,7 @@ fn main() { let s<|>t = foo(); } | |||
2659 | check_actions( | 2639 | check_actions( |
2660 | r#" | 2640 | r#" |
2661 | trait Foo {} | 2641 | trait Foo {} |
2662 | fn foo(ar<|>g: &impl Foo) {} | 2642 | fn foo(ar$0g: &impl Foo) {} |
2663 | "#, | 2643 | "#, |
2664 | expect![[r#" | 2644 | expect![[r#" |
2665 | [ | 2645 | [ |
@@ -2693,7 +2673,7 @@ trait Foo {} | |||
2693 | trait Bar<T> {} | 2673 | trait Bar<T> {} |
2694 | struct S{} | 2674 | struct S{} |
2695 | 2675 | ||
2696 | fn foo(ar<|>g: &impl Foo + Bar<S>) {} | 2676 | fn foo(ar$0g: &impl Foo + Bar<S>) {} |
2697 | "#, | 2677 | "#, |
2698 | expect![[r#" | 2678 | expect![[r#" |
2699 | [ | 2679 | [ |
@@ -2751,7 +2731,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
2751 | r#" | 2731 | r#" |
2752 | struct S; | 2732 | struct S; |
2753 | fn foo() { | 2733 | fn foo() { |
2754 | let fo<|>o = async { S }; | 2734 | let fo$0o = async { S }; |
2755 | } | 2735 | } |
2756 | 2736 | ||
2757 | #[prelude_import] use future::*; | 2737 | #[prelude_import] use future::*; |
@@ -2803,7 +2783,7 @@ mod future { | |||
2803 | r#" | 2783 | r#" |
2804 | trait Foo<T> {} | 2784 | trait Foo<T> {} |
2805 | struct S {} | 2785 | struct S {} |
2806 | fn foo(ar<|>g: &impl Foo<S>) {} | 2786 | fn foo(ar$0g: &impl Foo<S>) {} |
2807 | "#, | 2787 | "#, |
2808 | expect![[r#" | 2788 | expect![[r#" |
2809 | [ | 2789 | [ |
@@ -2853,7 +2833,7 @@ impl Foo for S {} | |||
2853 | struct B<T>{} | 2833 | struct B<T>{} |
2854 | fn foo() -> B<dyn Foo> {} | 2834 | fn foo() -> B<dyn Foo> {} |
2855 | 2835 | ||
2856 | fn main() { let s<|>t = foo(); } | 2836 | fn main() { let s$0t = foo(); } |
2857 | "#, | 2837 | "#, |
2858 | expect![[r#" | 2838 | expect![[r#" |
2859 | [ | 2839 | [ |
@@ -2897,7 +2877,7 @@ fn main() { let s<|>t = foo(); } | |||
2897 | check_actions( | 2877 | check_actions( |
2898 | r#" | 2878 | r#" |
2899 | trait Foo {} | 2879 | trait Foo {} |
2900 | fn foo(ar<|>g: &dyn Foo) {} | 2880 | fn foo(ar$0g: &dyn Foo) {} |
2901 | "#, | 2881 | "#, |
2902 | expect![[r#" | 2882 | expect![[r#" |
2903 | [ | 2883 | [ |
@@ -2929,7 +2909,7 @@ fn foo(ar<|>g: &dyn Foo) {} | |||
2929 | r#" | 2909 | r#" |
2930 | trait Foo<T> {} | 2910 | trait Foo<T> {} |
2931 | struct S {} | 2911 | struct S {} |
2932 | fn foo(ar<|>g: &dyn Foo<S>) {} | 2912 | fn foo(ar$0g: &dyn Foo<S>) {} |
2933 | "#, | 2913 | "#, |
2934 | expect![[r#" | 2914 | expect![[r#" |
2935 | [ | 2915 | [ |
@@ -2977,7 +2957,7 @@ trait DynTrait<T> {} | |||
2977 | struct B<T> {} | 2957 | struct B<T> {} |
2978 | struct S {} | 2958 | struct S {} |
2979 | 2959 | ||
2980 | fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | 2960 | fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} |
2981 | "#, | 2961 | "#, |
2982 | expect![[r#" | 2962 | expect![[r#" |
2983 | [ | 2963 | [ |
@@ -3058,7 +3038,7 @@ impl Foo for S { type Item = Bar; } | |||
3058 | 3038 | ||
3059 | fn test() -> impl Foo { S {} } | 3039 | fn test() -> impl Foo { S {} } |
3060 | 3040 | ||
3061 | fn main() { let s<|>t = test().get(); } | 3041 | fn main() { let s$0t = test().get(); } |
3062 | "#, | 3042 | "#, |
3063 | expect![[r#" | 3043 | expect![[r#" |
3064 | [ | 3044 | [ |
@@ -3091,7 +3071,7 @@ fn main() { let s<|>t = test().get(); } | |||
3091 | struct Bar; | 3071 | struct Bar; |
3092 | struct Foo<const BAR: Bar>; | 3072 | struct Foo<const BAR: Bar>; |
3093 | 3073 | ||
3094 | impl<const BAR: Bar> Foo<BAR<|>> {} | 3074 | impl<const BAR: Bar> Foo<BAR$0> {} |
3095 | "#, | 3075 | "#, |
3096 | expect![[r#" | 3076 | expect![[r#" |
3097 | [ | 3077 | [ |
@@ -3123,7 +3103,7 @@ impl<const BAR: Bar> Foo<BAR<|>> {} | |||
3123 | r#" | 3103 | r#" |
3124 | trait Foo {} | 3104 | trait Foo {} |
3125 | 3105 | ||
3126 | fn foo<T: Foo>(t: T<|>){} | 3106 | fn foo<T: Foo>(t: T$0){} |
3127 | "#, | 3107 | "#, |
3128 | expect![[r#" | 3108 | expect![[r#" |
3129 | [ | 3109 | [ |
@@ -3163,7 +3143,7 @@ pub mod wrapper { | |||
3163 | } | 3143 | } |
3164 | 3144 | ||
3165 | //- /main.rs crate:main deps:name-with-dashes | 3145 | //- /main.rs crate:main deps:name-with-dashes |
3166 | fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); } | 3146 | fn main() { let foo_test = name_with_dashes::wrapper::Thing::new$0(); } |
3167 | "#, | 3147 | "#, |
3168 | expect![[r#" | 3148 | expect![[r#" |
3169 | *new* | 3149 | *new* |
@@ -3189,7 +3169,7 @@ struct S { | |||
3189 | 3169 | ||
3190 | fn main() { | 3170 | fn main() { |
3191 | let s = S { f: 0 }; | 3171 | let s = S { f: 0 }; |
3192 | let S { f<|> } = &s; | 3172 | let S { f$0 } = &s; |
3193 | } | 3173 | } |
3194 | "#, | 3174 | "#, |
3195 | expect![[r#" | 3175 | expect![[r#" |
@@ -3208,7 +3188,7 @@ fn main() { | |||
3208 | r#" | 3188 | r#" |
3209 | struct Foo {} | 3189 | struct Foo {} |
3210 | impl Foo { | 3190 | impl Foo { |
3211 | fn bar(&sel<|>f) {} | 3191 | fn bar(&sel$0f) {} |
3212 | } | 3192 | } |
3213 | "#, | 3193 | "#, |
3214 | expect![[r#" | 3194 | expect![[r#" |
@@ -3227,7 +3207,7 @@ impl Foo { | |||
3227 | struct Arc<T>(T); | 3207 | struct Arc<T>(T); |
3228 | struct Foo {} | 3208 | struct Foo {} |
3229 | impl Foo { | 3209 | impl Foo { |
3230 | fn bar(sel<|>f: Arc<Foo>) {} | 3210 | fn bar(sel$0f: Arc<Foo>) {} |
3231 | } | 3211 | } |
3232 | "#, | 3212 | "#, |
3233 | expect![[r#" | 3213 | expect![[r#" |
@@ -3244,7 +3224,7 @@ impl Foo { | |||
3244 | check( | 3224 | check( |
3245 | r#" | 3225 | r#" |
3246 | /// Be quick; | 3226 | /// Be quick; |
3247 | mod Foo<|> { | 3227 | mod Foo$0 { |
3248 | //! time is mana | 3228 | //! time is mana |
3249 | 3229 | ||
3250 | /// This comment belongs to the function | 3230 | /// This comment belongs to the function |
@@ -3275,7 +3255,7 @@ mod Foo<|> { | |||
3275 | check( | 3255 | check( |
3276 | r#" | 3256 | r#" |
3277 | #[doc = "Be quick;"] | 3257 | #[doc = "Be quick;"] |
3278 | mod Foo<|> { | 3258 | mod Foo$0 { |
3279 | #![doc = "time is mana"] | 3259 | #![doc = "time is mana"] |
3280 | 3260 | ||
3281 | #[doc = "This comment belongs to the function"] | 3261 | #[doc = "This comment belongs to the function"] |
@@ -3306,7 +3286,7 @@ mod Foo<|> { | |||
3306 | check_hover_no_result( | 3286 | check_hover_no_result( |
3307 | r#" | 3287 | r#" |
3308 | fn no_hover() { | 3288 | fn no_hover() { |
3309 | // no<|>hover | 3289 | // no$0hover |
3310 | } | 3290 | } |
3311 | "#, | 3291 | "#, |
3312 | ); | 3292 | ); |
@@ -3317,7 +3297,7 @@ fn no_hover() { | |||
3317 | check( | 3297 | check( |
3318 | r#" | 3298 | r#" |
3319 | fn foo() { | 3299 | fn foo() { |
3320 | 'label<|>: loop {} | 3300 | 'label$0: loop {} |
3321 | } | 3301 | } |
3322 | "#, | 3302 | "#, |
3323 | expect![[r#" | 3303 | expect![[r#" |
@@ -3333,7 +3313,7 @@ fn foo() { | |||
3333 | #[test] | 3313 | #[test] |
3334 | fn hover_lifetime() { | 3314 | fn hover_lifetime() { |
3335 | check( | 3315 | check( |
3336 | r#"fn foo<'lifetime>(_: &'lifetime<|> ()) {}"#, | 3316 | r#"fn foo<'lifetime>(_: &'lifetime$0 ()) {}"#, |
3337 | expect![[r#" | 3317 | expect![[r#" |
3338 | *'lifetime* | 3318 | *'lifetime* |
3339 | 3319 | ||
@@ -3352,7 +3332,7 @@ struct Foo<T>(T); | |||
3352 | trait Copy {} | 3332 | trait Copy {} |
3353 | trait Clone {} | 3333 | trait Clone {} |
3354 | trait Sized {} | 3334 | trait Sized {} |
3355 | impl<T: Copy + Clone> Foo<T<|>> where T: Sized {} | 3335 | impl<T: Copy + Clone> Foo<T$0> where T: Sized {} |
3356 | "#, | 3336 | "#, |
3357 | expect![[r#" | 3337 | expect![[r#" |
3358 | *T* | 3338 | *T* |
@@ -3365,7 +3345,7 @@ impl<T: Copy + Clone> Foo<T<|>> where T: Sized {} | |||
3365 | check( | 3345 | check( |
3366 | r#" | 3346 | r#" |
3367 | struct Foo<T>(T); | 3347 | struct Foo<T>(T); |
3368 | impl<T> Foo<T<|>> {} | 3348 | impl<T> Foo<T$0> {} |
3369 | "#, | 3349 | "#, |
3370 | expect![[r#" | 3350 | expect![[r#" |
3371 | *T* | 3351 | *T* |
@@ -3379,7 +3359,7 @@ impl<T> Foo<T<|>> {} | |||
3379 | check( | 3359 | check( |
3380 | r#" | 3360 | r#" |
3381 | struct Foo<T>(T); | 3361 | struct Foo<T>(T); |
3382 | impl<T: 'static> Foo<T<|>> {} | 3362 | impl<T: 'static> Foo<T$0> {} |
3383 | "#, | 3363 | "#, |
3384 | expect![[r#" | 3364 | expect![[r#" |
3385 | *T* | 3365 | *T* |
@@ -3396,7 +3376,7 @@ impl<T: 'static> Foo<T<|>> {} | |||
3396 | check( | 3376 | check( |
3397 | r#" | 3377 | r#" |
3398 | struct Foo<const LEN: usize>; | 3378 | struct Foo<const LEN: usize>; |
3399 | impl<const LEN: usize> Foo<LEN<|>> {} | 3379 | impl<const LEN: usize> Foo<LEN$0> {} |
3400 | "#, | 3380 | "#, |
3401 | expect![[r#" | 3381 | expect![[r#" |
3402 | *LEN* | 3382 | *LEN* |