diff options
Diffstat (limited to 'crates')
108 files changed, 1742 insertions, 1762 deletions
diff --git a/crates/assists/src/handlers/add_explicit_type.rs b/crates/assists/src/handlers/add_explicit_type.rs index 563cbf505..cb1548cef 100644 --- a/crates/assists/src/handlers/add_explicit_type.rs +++ b/crates/assists/src/handlers/add_explicit_type.rs | |||
@@ -12,7 +12,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
12 | // | 12 | // |
13 | // ``` | 13 | // ``` |
14 | // fn main() { | 14 | // fn main() { |
15 | // let x<|> = 92; | 15 | // let x$0 = 92; |
16 | // } | 16 | // } |
17 | // ``` | 17 | // ``` |
18 | // -> | 18 | // -> |
@@ -81,21 +81,17 @@ mod tests { | |||
81 | 81 | ||
82 | #[test] | 82 | #[test] |
83 | fn add_explicit_type_target() { | 83 | fn add_explicit_type_target() { |
84 | check_assist_target(add_explicit_type, "fn f() { let a<|> = 1; }", "a"); | 84 | check_assist_target(add_explicit_type, "fn f() { let a$0 = 1; }", "a"); |
85 | } | 85 | } |
86 | 86 | ||
87 | #[test] | 87 | #[test] |
88 | fn add_explicit_type_works_for_simple_expr() { | 88 | fn add_explicit_type_works_for_simple_expr() { |
89 | check_assist(add_explicit_type, "fn f() { let a<|> = 1; }", "fn f() { let a: i32 = 1; }"); | 89 | check_assist(add_explicit_type, "fn f() { let a$0 = 1; }", "fn f() { let a: i32 = 1; }"); |
90 | } | 90 | } |
91 | 91 | ||
92 | #[test] | 92 | #[test] |
93 | fn add_explicit_type_works_for_underscore() { | 93 | fn add_explicit_type_works_for_underscore() { |
94 | check_assist( | 94 | check_assist(add_explicit_type, "fn f() { let a$0: _ = 1; }", "fn f() { let a: i32 = 1; }"); |
95 | add_explicit_type, | ||
96 | "fn f() { let a<|>: _ = 1; }", | ||
97 | "fn f() { let a: i32 = 1; }", | ||
98 | ); | ||
99 | } | 95 | } |
100 | 96 | ||
101 | #[test] | 97 | #[test] |
@@ -109,7 +105,7 @@ mod tests { | |||
109 | } | 105 | } |
110 | 106 | ||
111 | fn f() { | 107 | fn f() { |
112 | let a<|>: Option<_> = Option::Some(1); | 108 | let a$0: Option<_> = Option::Some(1); |
113 | }"#, | 109 | }"#, |
114 | r#" | 110 | r#" |
115 | enum Option<T> { | 111 | enum Option<T> { |
@@ -127,7 +123,7 @@ mod tests { | |||
127 | fn add_explicit_type_works_for_macro_call() { | 123 | fn add_explicit_type_works_for_macro_call() { |
128 | check_assist( | 124 | check_assist( |
129 | add_explicit_type, | 125 | add_explicit_type, |
130 | r"macro_rules! v { () => {0u64} } fn f() { let a<|> = v!(); }", | 126 | r"macro_rules! v { () => {0u64} } fn f() { let a$0 = v!(); }", |
131 | r"macro_rules! v { () => {0u64} } fn f() { let a: u64 = v!(); }", | 127 | r"macro_rules! v { () => {0u64} } fn f() { let a: u64 = v!(); }", |
132 | ); | 128 | ); |
133 | } | 129 | } |
@@ -136,31 +132,31 @@ mod tests { | |||
136 | fn add_explicit_type_works_for_macro_call_recursive() { | 132 | fn add_explicit_type_works_for_macro_call_recursive() { |
137 | check_assist( | 133 | check_assist( |
138 | add_explicit_type, | 134 | add_explicit_type, |
139 | r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a<|> = v!(); }"#, | 135 | r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a$0 = v!(); }"#, |
140 | r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a: u64 = v!(); }"#, | 136 | r#"macro_rules! u { () => {0u64} } macro_rules! v { () => {u!()} } fn f() { let a: u64 = v!(); }"#, |
141 | ); | 137 | ); |
142 | } | 138 | } |
143 | 139 | ||
144 | #[test] | 140 | #[test] |
145 | fn add_explicit_type_not_applicable_if_ty_not_inferred() { | 141 | fn add_explicit_type_not_applicable_if_ty_not_inferred() { |
146 | check_assist_not_applicable(add_explicit_type, "fn f() { let a<|> = None; }"); | 142 | check_assist_not_applicable(add_explicit_type, "fn f() { let a$0 = None; }"); |
147 | } | 143 | } |
148 | 144 | ||
149 | #[test] | 145 | #[test] |
150 | fn add_explicit_type_not_applicable_if_ty_already_specified() { | 146 | fn add_explicit_type_not_applicable_if_ty_already_specified() { |
151 | check_assist_not_applicable(add_explicit_type, "fn f() { let a<|>: i32 = 1; }"); | 147 | check_assist_not_applicable(add_explicit_type, "fn f() { let a$0: i32 = 1; }"); |
152 | } | 148 | } |
153 | 149 | ||
154 | #[test] | 150 | #[test] |
155 | fn add_explicit_type_not_applicable_if_specified_ty_is_tuple() { | 151 | fn add_explicit_type_not_applicable_if_specified_ty_is_tuple() { |
156 | check_assist_not_applicable(add_explicit_type, "fn f() { let a<|>: (i32, i32) = (3, 4); }"); | 152 | check_assist_not_applicable(add_explicit_type, "fn f() { let a$0: (i32, i32) = (3, 4); }"); |
157 | } | 153 | } |
158 | 154 | ||
159 | #[test] | 155 | #[test] |
160 | fn add_explicit_type_not_applicable_if_cursor_after_equals() { | 156 | fn add_explicit_type_not_applicable_if_cursor_after_equals() { |
161 | check_assist_not_applicable( | 157 | check_assist_not_applicable( |
162 | add_explicit_type, | 158 | add_explicit_type, |
163 | "fn f() {let a =<|> match 1 {2 => 3, 3 => 5};}", | 159 | "fn f() {let a =$0 match 1 {2 => 3, 3 => 5};}", |
164 | ) | 160 | ) |
165 | } | 161 | } |
166 | 162 | ||
@@ -168,7 +164,7 @@ mod tests { | |||
168 | fn add_explicit_type_not_applicable_if_cursor_before_let() { | 164 | fn add_explicit_type_not_applicable_if_cursor_before_let() { |
169 | check_assist_not_applicable( | 165 | check_assist_not_applicable( |
170 | add_explicit_type, | 166 | add_explicit_type, |
171 | "fn f() <|>{let a = match 1 {2 => 3, 3 => 5};}", | 167 | "fn f() $0{let a = match 1 {2 => 3, 3 => 5};}", |
172 | ) | 168 | ) |
173 | } | 169 | } |
174 | 170 | ||
@@ -178,7 +174,7 @@ mod tests { | |||
178 | add_explicit_type, | 174 | add_explicit_type, |
179 | r#" | 175 | r#" |
180 | fn main() { | 176 | fn main() { |
181 | let multiply_by_two<|> = |i| i * 3; | 177 | let multiply_by_two$0 = |i| i * 3; |
182 | let six = multiply_by_two(2); | 178 | let six = multiply_by_two(2); |
183 | }"#, | 179 | }"#, |
184 | ) | 180 | ) |
@@ -195,7 +191,7 @@ struct Test<K, T = u8> { | |||
195 | } | 191 | } |
196 | 192 | ||
197 | fn main() { | 193 | fn main() { |
198 | let test<|> = Test { t: 23u8, k: 33 }; | 194 | let test$0 = Test { t: 23u8, k: 33 }; |
199 | }"#, | 195 | }"#, |
200 | r#" | 196 | r#" |
201 | struct Test<K, T = u8> { | 197 | struct Test<K, T = u8> { |
diff --git a/crates/assists/src/handlers/add_missing_impl_members.rs b/crates/assists/src/handlers/add_missing_impl_members.rs index 7df05b841..63cea754d 100644 --- a/crates/assists/src/handlers/add_missing_impl_members.rs +++ b/crates/assists/src/handlers/add_missing_impl_members.rs | |||
@@ -20,7 +20,7 @@ use crate::{ | |||
20 | // fn bar(&self) {} | 20 | // fn bar(&self) {} |
21 | // } | 21 | // } |
22 | // | 22 | // |
23 | // impl Trait<u32> for () {<|> | 23 | // impl Trait<u32> for () {$0 |
24 | // | 24 | // |
25 | // } | 25 | // } |
26 | // ``` | 26 | // ``` |
@@ -63,7 +63,7 @@ pub(crate) fn add_missing_impl_members(acc: &mut Assists, ctx: &AssistContext) - | |||
63 | // | 63 | // |
64 | // impl Trait for () { | 64 | // impl Trait for () { |
65 | // type X = (); | 65 | // type X = (); |
66 | // fn foo(&self) {}<|> | 66 | // fn foo(&self) {}$0 |
67 | // | 67 | // |
68 | // } | 68 | // } |
69 | // ``` | 69 | // ``` |
@@ -166,7 +166,7 @@ struct S; | |||
166 | 166 | ||
167 | impl Foo for S { | 167 | impl Foo for S { |
168 | fn bar(&self) {} | 168 | fn bar(&self) {} |
169 | <|> | 169 | $0 |
170 | }"#, | 170 | }"#, |
171 | r#" | 171 | r#" |
172 | trait Foo { | 172 | trait Foo { |
@@ -214,7 +214,7 @@ struct S; | |||
214 | 214 | ||
215 | impl Foo for S { | 215 | impl Foo for S { |
216 | fn bar(&self) {} | 216 | fn bar(&self) {} |
217 | <|> | 217 | $0 |
218 | }"#, | 218 | }"#, |
219 | r#" | 219 | r#" |
220 | trait Foo { | 220 | trait Foo { |
@@ -242,7 +242,7 @@ impl Foo for S { | |||
242 | r#" | 242 | r#" |
243 | trait Foo { fn foo(&self); } | 243 | trait Foo { fn foo(&self); } |
244 | struct S; | 244 | struct S; |
245 | impl Foo for S { <|> }"#, | 245 | impl Foo for S { $0 }"#, |
246 | r#" | 246 | r#" |
247 | trait Foo { fn foo(&self); } | 247 | trait Foo { fn foo(&self); } |
248 | struct S; | 248 | struct S; |
@@ -261,7 +261,7 @@ impl Foo for S { | |||
261 | r#" | 261 | r#" |
262 | trait Foo { fn foo(&self); } | 262 | trait Foo { fn foo(&self); } |
263 | struct S; | 263 | struct S; |
264 | impl Foo for S<|>"#, | 264 | impl Foo for S$0"#, |
265 | r#" | 265 | r#" |
266 | trait Foo { fn foo(&self); } | 266 | trait Foo { fn foo(&self); } |
267 | struct S; | 267 | struct S; |
@@ -280,7 +280,7 @@ impl Foo for S { | |||
280 | r#" | 280 | r#" |
281 | trait Foo<T> { fn foo(&self, t: T) -> &T; } | 281 | trait Foo<T> { fn foo(&self, t: T) -> &T; } |
282 | struct S; | 282 | struct S; |
283 | impl Foo<u32> for S { <|> }"#, | 283 | impl Foo<u32> for S { $0 }"#, |
284 | r#" | 284 | r#" |
285 | trait Foo<T> { fn foo(&self, t: T) -> &T; } | 285 | trait Foo<T> { fn foo(&self, t: T) -> &T; } |
286 | struct S; | 286 | struct S; |
@@ -299,7 +299,7 @@ impl Foo<u32> for S { | |||
299 | r#" | 299 | r#" |
300 | trait Foo<T> { fn foo(&self, t: T) -> &T; } | 300 | trait Foo<T> { fn foo(&self, t: T) -> &T; } |
301 | struct S; | 301 | struct S; |
302 | impl<U> Foo<U> for S { <|> }"#, | 302 | impl<U> Foo<U> for S { $0 }"#, |
303 | r#" | 303 | r#" |
304 | trait Foo<T> { fn foo(&self, t: T) -> &T; } | 304 | trait Foo<T> { fn foo(&self, t: T) -> &T; } |
305 | struct S; | 305 | struct S; |
@@ -318,7 +318,7 @@ impl<U> Foo<U> for S { | |||
318 | r#" | 318 | r#" |
319 | trait Foo { fn foo(&self); } | 319 | trait Foo { fn foo(&self); } |
320 | struct S; | 320 | struct S; |
321 | impl Foo for S {}<|>"#, | 321 | impl Foo for S {}$0"#, |
322 | r#" | 322 | r#" |
323 | trait Foo { fn foo(&self); } | 323 | trait Foo { fn foo(&self); } |
324 | struct S; | 324 | struct S; |
@@ -340,7 +340,7 @@ mod foo { | |||
340 | trait Foo { fn foo(&self, bar: Bar); } | 340 | trait Foo { fn foo(&self, bar: Bar); } |
341 | } | 341 | } |
342 | struct S; | 342 | struct S; |
343 | impl foo::Foo for S { <|> }"#, | 343 | impl foo::Foo for S { $0 }"#, |
344 | r#" | 344 | r#" |
345 | mod foo { | 345 | mod foo { |
346 | pub struct Bar; | 346 | pub struct Bar; |
@@ -370,7 +370,7 @@ mod foo { | |||
370 | use foo::bar; | 370 | use foo::bar; |
371 | 371 | ||
372 | struct S; | 372 | struct S; |
373 | impl bar::Foo for S { <|> }"#, | 373 | impl bar::Foo for S { $0 }"#, |
374 | r#" | 374 | r#" |
375 | mod foo { | 375 | mod foo { |
376 | pub mod bar { | 376 | pub mod bar { |
@@ -400,7 +400,7 @@ mod foo { | |||
400 | trait Foo { fn foo(&self, bar: Bar<u32>); } | 400 | trait Foo { fn foo(&self, bar: Bar<u32>); } |
401 | } | 401 | } |
402 | struct S; | 402 | struct S; |
403 | impl foo::Foo for S { <|> }"#, | 403 | impl foo::Foo for S { $0 }"#, |
404 | r#" | 404 | r#" |
405 | mod foo { | 405 | mod foo { |
406 | pub struct Bar<T>; | 406 | pub struct Bar<T>; |
@@ -425,7 +425,7 @@ mod foo { | |||
425 | trait Foo<T> { fn foo(&self, bar: Bar<T>); } | 425 | trait Foo<T> { fn foo(&self, bar: Bar<T>); } |
426 | } | 426 | } |
427 | struct S; | 427 | struct S; |
428 | impl foo::Foo<u32> for S { <|> }"#, | 428 | impl foo::Foo<u32> for S { $0 }"#, |
429 | r#" | 429 | r#" |
430 | mod foo { | 430 | mod foo { |
431 | pub struct Bar<T>; | 431 | pub struct Bar<T>; |
@@ -452,7 +452,7 @@ mod foo { | |||
452 | } | 452 | } |
453 | struct Param; | 453 | struct Param; |
454 | struct S; | 454 | struct S; |
455 | impl foo::Foo<Param> for S { <|> }"#, | 455 | impl foo::Foo<Param> for S { $0 }"#, |
456 | r#" | 456 | r#" |
457 | mod foo { | 457 | mod foo { |
458 | trait Foo<T> { fn foo(&self, bar: T); } | 458 | trait Foo<T> { fn foo(&self, bar: T); } |
@@ -479,7 +479,7 @@ mod foo { | |||
479 | trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); } | 479 | trait Foo { fn foo(&self, bar: Bar<u32>::Assoc); } |
480 | } | 480 | } |
481 | struct S; | 481 | struct S; |
482 | impl foo::Foo for S { <|> }"#, | 482 | impl foo::Foo for S { $0 }"#, |
483 | r#" | 483 | r#" |
484 | mod foo { | 484 | mod foo { |
485 | pub struct Bar<T>; | 485 | pub struct Bar<T>; |
@@ -506,7 +506,7 @@ mod foo { | |||
506 | trait Foo { fn foo(&self, bar: Bar<Baz>); } | 506 | trait Foo { fn foo(&self, bar: Bar<Baz>); } |
507 | } | 507 | } |
508 | struct S; | 508 | struct S; |
509 | impl foo::Foo for S { <|> }"#, | 509 | impl foo::Foo for S { $0 }"#, |
510 | r#" | 510 | r#" |
511 | mod foo { | 511 | mod foo { |
512 | pub struct Bar<T>; | 512 | pub struct Bar<T>; |
@@ -532,7 +532,7 @@ mod foo { | |||
532 | trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); } | 532 | trait Foo { fn foo(&self, bar: dyn Fn(u32) -> i32); } |
533 | } | 533 | } |
534 | struct S; | 534 | struct S; |
535 | impl foo::Foo for S { <|> }"#, | 535 | impl foo::Foo for S { $0 }"#, |
536 | r#" | 536 | r#" |
537 | mod foo { | 537 | mod foo { |
538 | pub trait Fn<Args> { type Output; } | 538 | pub trait Fn<Args> { type Output; } |
@@ -554,7 +554,7 @@ impl foo::Foo for S { | |||
554 | r#" | 554 | r#" |
555 | trait Foo; | 555 | trait Foo; |
556 | struct S; | 556 | struct S; |
557 | impl Foo for S { <|> }"#, | 557 | impl Foo for S { $0 }"#, |
558 | ) | 558 | ) |
559 | } | 559 | } |
560 | 560 | ||
@@ -568,7 +568,7 @@ trait Foo { | |||
568 | fn valid(some: u32) -> bool { false } | 568 | fn valid(some: u32) -> bool { false } |
569 | } | 569 | } |
570 | struct S; | 570 | struct S; |
571 | impl Foo for S { <|> }"#, | 571 | impl Foo for S { $0 }"#, |
572 | ) | 572 | ) |
573 | } | 573 | } |
574 | 574 | ||
@@ -586,7 +586,7 @@ trait Foo { | |||
586 | fn foo(&self); | 586 | fn foo(&self); |
587 | } | 587 | } |
588 | struct S; | 588 | struct S; |
589 | impl Foo for S {}<|>"#, | 589 | impl Foo for S {}$0"#, |
590 | r#" | 590 | r#" |
591 | #[doc(alias = "test alias")] | 591 | #[doc(alias = "test alias")] |
592 | trait Foo { | 592 | trait Foo { |
@@ -621,7 +621,7 @@ trait Foo { | |||
621 | fn foo(some: u32) -> bool; | 621 | fn foo(some: u32) -> bool; |
622 | } | 622 | } |
623 | struct S; | 623 | struct S; |
624 | impl Foo for S { <|> }"#, | 624 | impl Foo for S { $0 }"#, |
625 | r#" | 625 | r#" |
626 | trait Foo { | 626 | trait Foo { |
627 | type Output; | 627 | type Output; |
@@ -648,7 +648,7 @@ trait Foo<T = Self> { | |||
648 | } | 648 | } |
649 | 649 | ||
650 | struct S; | 650 | struct S; |
651 | impl Foo for S { <|> }"#, | 651 | impl Foo for S { $0 }"#, |
652 | r#" | 652 | r#" |
653 | trait Foo<T = Self> { | 653 | trait Foo<T = Self> { |
654 | fn bar(&self, other: &T); | 654 | fn bar(&self, other: &T); |
@@ -673,7 +673,7 @@ trait Foo<T1, T2 = Self> { | |||
673 | } | 673 | } |
674 | 674 | ||
675 | struct S<T>; | 675 | struct S<T>; |
676 | impl Foo<T> for S<T> { <|> }"#, | 676 | impl Foo<T> for S<T> { $0 }"#, |
677 | r#" | 677 | r#" |
678 | trait Foo<T1, T2 = Self> { | 678 | trait Foo<T1, T2 = Self> { |
679 | fn bar(&self, this: &T1, that: &T2); | 679 | fn bar(&self, this: &T1, that: &T2); |
@@ -697,7 +697,7 @@ trait Tr { | |||
697 | type Ty: Copy + 'static; | 697 | type Ty: Copy + 'static; |
698 | } | 698 | } |
699 | 699 | ||
700 | impl Tr for ()<|> { | 700 | impl Tr for ()$0 { |
701 | }"#, | 701 | }"#, |
702 | r#" | 702 | r#" |
703 | trait Tr { | 703 | trait Tr { |
@@ -719,7 +719,7 @@ trait Tr { | |||
719 | fn foo(); | 719 | fn foo(); |
720 | } | 720 | } |
721 | 721 | ||
722 | impl Tr for ()<|> { | 722 | impl Tr for ()$0 { |
723 | +++ | 723 | +++ |
724 | }"#, | 724 | }"#, |
725 | r#" | 725 | r#" |
@@ -745,7 +745,7 @@ trait Tr { | |||
745 | fn foo(); | 745 | fn foo(); |
746 | } | 746 | } |
747 | 747 | ||
748 | impl Tr for ()<|> { | 748 | impl Tr for ()$0 { |
749 | // very important | 749 | // very important |
750 | }"#, | 750 | }"#, |
751 | r#" | 751 | r#" |
@@ -771,7 +771,7 @@ trait Test { | |||
771 | fn foo(&self, x: crate) | 771 | fn foo(&self, x: crate) |
772 | } | 772 | } |
773 | impl Test for () { | 773 | impl Test for () { |
774 | <|> | 774 | $0 |
775 | } | 775 | } |
776 | "#, | 776 | "#, |
777 | r#" | 777 | r#" |
@@ -796,7 +796,7 @@ trait Foo<BAR> { | |||
796 | fn foo(&self, bar: BAR); | 796 | fn foo(&self, bar: BAR); |
797 | } | 797 | } |
798 | impl Foo for () { | 798 | impl Foo for () { |
799 | <|> | 799 | $0 |
800 | } | 800 | } |
801 | "#, | 801 | "#, |
802 | r#" | 802 | r#" |
diff --git a/crates/assists/src/handlers/add_turbo_fish.rs b/crates/assists/src/handlers/add_turbo_fish.rs index 1f486c013..8e9ea4fad 100644 --- a/crates/assists/src/handlers/add_turbo_fish.rs +++ b/crates/assists/src/handlers/add_turbo_fish.rs | |||
@@ -14,7 +14,7 @@ use crate::{ | |||
14 | // ``` | 14 | // ``` |
15 | // fn make<T>() -> T { todo!() } | 15 | // fn make<T>() -> T { todo!() } |
16 | // fn main() { | 16 | // fn main() { |
17 | // let x = make<|>(); | 17 | // let x = make$0(); |
18 | // } | 18 | // } |
19 | // ``` | 19 | // ``` |
20 | // -> | 20 | // -> |
@@ -77,7 +77,7 @@ mod tests { | |||
77 | r#" | 77 | r#" |
78 | fn make<T>() -> T {} | 78 | fn make<T>() -> T {} |
79 | fn main() { | 79 | fn main() { |
80 | make<|>(); | 80 | make$0(); |
81 | } | 81 | } |
82 | "#, | 82 | "#, |
83 | r#" | 83 | r#" |
@@ -97,7 +97,7 @@ fn main() { | |||
97 | r#" | 97 | r#" |
98 | fn make<T>() -> T {} | 98 | fn make<T>() -> T {} |
99 | fn main() { | 99 | fn main() { |
100 | make()<|>; | 100 | make()$0; |
101 | } | 101 | } |
102 | "#, | 102 | "#, |
103 | r#" | 103 | r#" |
@@ -119,7 +119,7 @@ impl S { | |||
119 | fn make<T>(&self) -> T {} | 119 | fn make<T>(&self) -> T {} |
120 | } | 120 | } |
121 | fn main() { | 121 | fn main() { |
122 | S.make<|>(); | 122 | S.make$0(); |
123 | } | 123 | } |
124 | "#, | 124 | "#, |
125 | r#" | 125 | r#" |
@@ -142,7 +142,7 @@ fn main() { | |||
142 | r#" | 142 | r#" |
143 | fn make<T>() -> T {} | 143 | fn make<T>() -> T {} |
144 | fn main() { | 144 | fn main() { |
145 | make<|>::<()>(); | 145 | make$0::<()>(); |
146 | } | 146 | } |
147 | "#, | 147 | "#, |
148 | ); | 148 | ); |
@@ -156,7 +156,7 @@ fn main() { | |||
156 | r#" | 156 | r#" |
157 | fn make() -> () {} | 157 | fn make() -> () {} |
158 | fn main() { | 158 | fn main() { |
159 | make<|>(); | 159 | make$0(); |
160 | } | 160 | } |
161 | "#, | 161 | "#, |
162 | ); | 162 | ); |
diff --git a/crates/assists/src/handlers/apply_demorgan.rs b/crates/assists/src/handlers/apply_demorgan.rs index 1a6fdafda..ed4d11455 100644 --- a/crates/assists/src/handlers/apply_demorgan.rs +++ b/crates/assists/src/handlers/apply_demorgan.rs | |||
@@ -12,7 +12,7 @@ use crate::{utils::invert_boolean_expression, AssistContext, AssistId, AssistKin | |||
12 | // | 12 | // |
13 | // ``` | 13 | // ``` |
14 | // fn main() { | 14 | // fn main() { |
15 | // if x != 4 ||<|> !y {} | 15 | // if x != 4 ||$0 !y {} |
16 | // } | 16 | // } |
17 | // ``` | 17 | // ``` |
18 | // -> | 18 | // -> |
@@ -68,26 +68,26 @@ mod tests { | |||
68 | 68 | ||
69 | #[test] | 69 | #[test] |
70 | fn demorgan_turns_and_into_or() { | 70 | fn demorgan_turns_and_into_or() { |
71 | check_assist(apply_demorgan, "fn f() { !x &&<|> !x }", "fn f() { !(x || x) }") | 71 | check_assist(apply_demorgan, "fn f() { !x &&$0 !x }", "fn f() { !(x || x) }") |
72 | } | 72 | } |
73 | 73 | ||
74 | #[test] | 74 | #[test] |
75 | fn demorgan_turns_or_into_and() { | 75 | fn demorgan_turns_or_into_and() { |
76 | check_assist(apply_demorgan, "fn f() { !x ||<|> !x }", "fn f() { !(x && x) }") | 76 | check_assist(apply_demorgan, "fn f() { !x ||$0 !x }", "fn f() { !(x && x) }") |
77 | } | 77 | } |
78 | 78 | ||
79 | #[test] | 79 | #[test] |
80 | fn demorgan_removes_inequality() { | 80 | fn demorgan_removes_inequality() { |
81 | check_assist(apply_demorgan, "fn f() { x != x ||<|> !x }", "fn f() { !(x == x && x) }") | 81 | check_assist(apply_demorgan, "fn f() { x != x ||$0 !x }", "fn f() { !(x == x && x) }") |
82 | } | 82 | } |
83 | 83 | ||
84 | #[test] | 84 | #[test] |
85 | fn demorgan_general_case() { | 85 | fn demorgan_general_case() { |
86 | check_assist(apply_demorgan, "fn f() { x ||<|> x }", "fn f() { !(!x && !x) }") | 86 | check_assist(apply_demorgan, "fn f() { x ||$0 x }", "fn f() { !(!x && !x) }") |
87 | } | 87 | } |
88 | 88 | ||
89 | #[test] | 89 | #[test] |
90 | fn demorgan_doesnt_apply_with_cursor_not_on_op() { | 90 | fn demorgan_doesnt_apply_with_cursor_not_on_op() { |
91 | check_assist_not_applicable(apply_demorgan, "fn f() { <|> !x || !x }") | 91 | check_assist_not_applicable(apply_demorgan, "fn f() { $0 !x || !x }") |
92 | } | 92 | } |
93 | } | 93 | } |
diff --git a/crates/assists/src/handlers/auto_import.rs b/crates/assists/src/handlers/auto_import.rs index bd5bba646..55620f0f3 100644 --- a/crates/assists/src/handlers/auto_import.rs +++ b/crates/assists/src/handlers/auto_import.rs | |||
@@ -70,7 +70,7 @@ use crate::{ | |||
70 | // | 70 | // |
71 | // ``` | 71 | // ``` |
72 | // fn main() { | 72 | // fn main() { |
73 | // let map = HashMap<|>::new(); | 73 | // let map = HashMap$0::new(); |
74 | // } | 74 | // } |
75 | // # pub mod std { pub mod collections { pub struct HashMap { } } } | 75 | // # pub mod std { pub mod collections { pub struct HashMap { } } } |
76 | // ``` | 76 | // ``` |
@@ -151,7 +151,7 @@ mod tests { | |||
151 | 151 | ||
152 | use std::fmt; | 152 | use std::fmt; |
153 | 153 | ||
154 | <|>Formatter | 154 | $0Formatter |
155 | ", | 155 | ", |
156 | r" | 156 | r" |
157 | mod std { | 157 | mod std { |
@@ -172,7 +172,7 @@ mod tests { | |||
172 | check_assist( | 172 | check_assist( |
173 | auto_import, | 173 | auto_import, |
174 | r" | 174 | r" |
175 | <|>PubStruct | 175 | $0PubStruct |
176 | 176 | ||
177 | pub mod PubMod { | 177 | pub mod PubMod { |
178 | pub struct PubStruct; | 178 | pub struct PubStruct; |
@@ -198,7 +198,7 @@ mod tests { | |||
198 | macro_rules! foo { | 198 | macro_rules! foo { |
199 | ($i:ident) => { fn foo(a: $i) {} } | 199 | ($i:ident) => { fn foo(a: $i) {} } |
200 | } | 200 | } |
201 | foo!(Pub<|>Struct); | 201 | foo!(Pub$0Struct); |
202 | 202 | ||
203 | pub mod PubMod { | 203 | pub mod PubMod { |
204 | pub struct PubStruct; | 204 | pub struct PubStruct; |
@@ -227,7 +227,7 @@ mod tests { | |||
227 | use PubMod::PubStruct1; | 227 | use PubMod::PubStruct1; |
228 | 228 | ||
229 | struct Test { | 229 | struct Test { |
230 | test: Pub<|>Struct2<u8>, | 230 | test: Pub$0Struct2<u8>, |
231 | } | 231 | } |
232 | 232 | ||
233 | pub mod PubMod { | 233 | pub mod PubMod { |
@@ -259,7 +259,7 @@ mod tests { | |||
259 | check_assist( | 259 | check_assist( |
260 | auto_import, | 260 | auto_import, |
261 | r" | 261 | r" |
262 | PubSt<|>ruct | 262 | PubSt$0ruct |
263 | 263 | ||
264 | pub mod PubMod1 { | 264 | pub mod PubMod1 { |
265 | pub struct PubStruct; | 265 | pub struct PubStruct; |
@@ -296,7 +296,7 @@ mod tests { | |||
296 | r" | 296 | r" |
297 | use PubMod::PubStruct; | 297 | use PubMod::PubStruct; |
298 | 298 | ||
299 | PubStruct<|> | 299 | PubStruct$0 |
300 | 300 | ||
301 | pub mod PubMod { | 301 | pub mod PubMod { |
302 | pub struct PubStruct; | 302 | pub struct PubStruct; |
@@ -310,7 +310,7 @@ mod tests { | |||
310 | check_assist_not_applicable( | 310 | check_assist_not_applicable( |
311 | auto_import, | 311 | auto_import, |
312 | r" | 312 | r" |
313 | PrivateStruct<|> | 313 | PrivateStruct$0 |
314 | 314 | ||
315 | pub mod PubMod { | 315 | pub mod PubMod { |
316 | struct PrivateStruct; | 316 | struct PrivateStruct; |
@@ -324,7 +324,7 @@ mod tests { | |||
324 | check_assist_not_applicable( | 324 | check_assist_not_applicable( |
325 | auto_import, | 325 | auto_import, |
326 | " | 326 | " |
327 | PubStruct<|>", | 327 | PubStruct$0", |
328 | ); | 328 | ); |
329 | } | 329 | } |
330 | 330 | ||
@@ -333,7 +333,7 @@ mod tests { | |||
333 | check_assist_not_applicable( | 333 | check_assist_not_applicable( |
334 | auto_import, | 334 | auto_import, |
335 | r" | 335 | r" |
336 | use PubStruct<|>; | 336 | use PubStruct$0; |
337 | 337 | ||
338 | pub mod PubMod { | 338 | pub mod PubMod { |
339 | pub struct PubStruct; | 339 | pub struct PubStruct; |
@@ -346,7 +346,7 @@ mod tests { | |||
346 | check_assist( | 346 | check_assist( |
347 | auto_import, | 347 | auto_import, |
348 | r" | 348 | r" |
349 | test_function<|> | 349 | test_function$0 |
350 | 350 | ||
351 | pub mod PubMod { | 351 | pub mod PubMod { |
352 | pub fn test_function() {}; | 352 | pub fn test_function() {}; |
@@ -377,7 +377,7 @@ macro_rules! foo { | |||
377 | 377 | ||
378 | //- /main.rs crate:main deps:crate_with_macro | 378 | //- /main.rs crate:main deps:crate_with_macro |
379 | fn main() { | 379 | fn main() { |
380 | foo<|> | 380 | foo$0 |
381 | } | 381 | } |
382 | ", | 382 | ", |
383 | r"use crate_with_macro::foo; | 383 | r"use crate_with_macro::foo; |
@@ -395,7 +395,7 @@ fn main() { | |||
395 | auto_import, | 395 | auto_import, |
396 | r" | 396 | r" |
397 | struct AssistInfo { | 397 | struct AssistInfo { |
398 | group_label: Option<<|>GroupLabel>, | 398 | group_label: Option<$0GroupLabel>, |
399 | } | 399 | } |
400 | 400 | ||
401 | mod m { pub struct GroupLabel; } | 401 | mod m { pub struct GroupLabel; } |
@@ -419,7 +419,7 @@ fn main() { | |||
419 | 419 | ||
420 | use mod1::mod2; | 420 | use mod1::mod2; |
421 | fn main() { | 421 | fn main() { |
422 | mod2::mod3::TestStruct<|> | 422 | mod2::mod3::TestStruct$0 |
423 | } | 423 | } |
424 | ", | 424 | ", |
425 | ); | 425 | ); |
@@ -436,7 +436,7 @@ fn main() { | |||
436 | 436 | ||
437 | use test_mod::test_function; | 437 | use test_mod::test_function; |
438 | fn main() { | 438 | fn main() { |
439 | test_function<|> | 439 | test_function$0 |
440 | } | 440 | } |
441 | ", | 441 | ", |
442 | ); | 442 | ); |
@@ -455,7 +455,7 @@ fn main() { | |||
455 | } | 455 | } |
456 | 456 | ||
457 | fn main() { | 457 | fn main() { |
458 | TestStruct::test_function<|> | 458 | TestStruct::test_function$0 |
459 | } | 459 | } |
460 | ", | 460 | ", |
461 | r" | 461 | r" |
@@ -488,7 +488,7 @@ fn main() { | |||
488 | } | 488 | } |
489 | 489 | ||
490 | fn main() { | 490 | fn main() { |
491 | TestStruct::TEST_CONST<|> | 491 | TestStruct::TEST_CONST$0 |
492 | } | 492 | } |
493 | ", | 493 | ", |
494 | r" | 494 | r" |
@@ -524,7 +524,7 @@ fn main() { | |||
524 | } | 524 | } |
525 | 525 | ||
526 | fn main() { | 526 | fn main() { |
527 | test_mod::TestStruct::test_function<|> | 527 | test_mod::TestStruct::test_function$0 |
528 | } | 528 | } |
529 | ", | 529 | ", |
530 | r" | 530 | r" |
@@ -573,7 +573,7 @@ fn main() { | |||
573 | 573 | ||
574 | use test_mod::TestTrait2; | 574 | use test_mod::TestTrait2; |
575 | fn main() { | 575 | fn main() { |
576 | test_mod::TestEnum::test_function<|>; | 576 | test_mod::TestEnum::test_function$0; |
577 | } | 577 | } |
578 | ", | 578 | ", |
579 | ) | 579 | ) |
@@ -595,7 +595,7 @@ fn main() { | |||
595 | } | 595 | } |
596 | 596 | ||
597 | fn main() { | 597 | fn main() { |
598 | test_mod::TestStruct::TEST_CONST<|> | 598 | test_mod::TestStruct::TEST_CONST$0 |
599 | } | 599 | } |
600 | ", | 600 | ", |
601 | r" | 601 | r" |
@@ -644,7 +644,7 @@ fn main() { | |||
644 | 644 | ||
645 | use test_mod::TestTrait2; | 645 | use test_mod::TestTrait2; |
646 | fn main() { | 646 | fn main() { |
647 | test_mod::TestEnum::TEST_CONST<|>; | 647 | test_mod::TestEnum::TEST_CONST$0; |
648 | } | 648 | } |
649 | ", | 649 | ", |
650 | ) | 650 | ) |
@@ -667,7 +667,7 @@ fn main() { | |||
667 | 667 | ||
668 | fn main() { | 668 | fn main() { |
669 | let test_struct = test_mod::TestStruct {}; | 669 | let test_struct = test_mod::TestStruct {}; |
670 | test_struct.test_meth<|>od() | 670 | test_struct.test_meth$0od() |
671 | } | 671 | } |
672 | ", | 672 | ", |
673 | r" | 673 | r" |
@@ -699,7 +699,7 @@ fn main() { | |||
699 | //- /main.rs crate:main deps:dep | 699 | //- /main.rs crate:main deps:dep |
700 | fn main() { | 700 | fn main() { |
701 | let test_struct = dep::test_mod::TestStruct {}; | 701 | let test_struct = dep::test_mod::TestStruct {}; |
702 | test_struct.test_meth<|>od() | 702 | test_struct.test_meth$0od() |
703 | } | 703 | } |
704 | //- /dep.rs crate:dep | 704 | //- /dep.rs crate:dep |
705 | pub mod test_mod { | 705 | pub mod test_mod { |
@@ -730,7 +730,7 @@ fn main() { | |||
730 | r" | 730 | r" |
731 | //- /main.rs crate:main deps:dep | 731 | //- /main.rs crate:main deps:dep |
732 | fn main() { | 732 | fn main() { |
733 | dep::test_mod::TestStruct::test_func<|>tion | 733 | dep::test_mod::TestStruct::test_func$0tion |
734 | } | 734 | } |
735 | //- /dep.rs crate:dep | 735 | //- /dep.rs crate:dep |
736 | pub mod test_mod { | 736 | pub mod test_mod { |
@@ -760,7 +760,7 @@ fn main() { | |||
760 | r" | 760 | r" |
761 | //- /main.rs crate:main deps:dep | 761 | //- /main.rs crate:main deps:dep |
762 | fn main() { | 762 | fn main() { |
763 | dep::test_mod::TestStruct::CONST<|> | 763 | dep::test_mod::TestStruct::CONST$0 |
764 | } | 764 | } |
765 | //- /dep.rs crate:dep | 765 | //- /dep.rs crate:dep |
766 | pub mod test_mod { | 766 | pub mod test_mod { |
@@ -791,7 +791,7 @@ fn main() { | |||
791 | //- /main.rs crate:main deps:dep | 791 | //- /main.rs crate:main deps:dep |
792 | fn main() { | 792 | fn main() { |
793 | let test_struct = dep::test_mod::TestStruct {}; | 793 | let test_struct = dep::test_mod::TestStruct {}; |
794 | test_struct.test_func<|>tion() | 794 | test_struct.test_func$0tion() |
795 | } | 795 | } |
796 | //- /dep.rs crate:dep | 796 | //- /dep.rs crate:dep |
797 | pub mod test_mod { | 797 | pub mod test_mod { |
@@ -815,7 +815,7 @@ fn main() { | |||
815 | //- /main.rs crate:main deps:dep | 815 | //- /main.rs crate:main deps:dep |
816 | fn main() { | 816 | fn main() { |
817 | let test_struct = dep::test_mod::TestStruct {}; | 817 | let test_struct = dep::test_mod::TestStruct {}; |
818 | test_struct.test_meth<|>od() | 818 | test_struct.test_meth$0od() |
819 | } | 819 | } |
820 | //- /dep.rs crate:dep | 820 | //- /dep.rs crate:dep |
821 | pub mod test_mod { | 821 | pub mod test_mod { |
@@ -858,7 +858,7 @@ fn main() { | |||
858 | use test_mod::TestTrait2; | 858 | use test_mod::TestTrait2; |
859 | fn main() { | 859 | fn main() { |
860 | let one = test_mod::TestEnum::One; | 860 | let one = test_mod::TestEnum::One; |
861 | one.test<|>_method(); | 861 | one.test$0_method(); |
862 | } | 862 | } |
863 | ", | 863 | ", |
864 | ) | 864 | ) |
@@ -874,7 +874,7 @@ pub struct Struct; | |||
874 | 874 | ||
875 | //- /main.rs crate:main deps:dep | 875 | //- /main.rs crate:main deps:dep |
876 | fn main() { | 876 | fn main() { |
877 | Struct<|> | 877 | Struct$0 |
878 | } | 878 | } |
879 | ", | 879 | ", |
880 | r"use dep::Struct; | 880 | r"use dep::Struct; |
@@ -902,7 +902,7 @@ pub fn panic_fmt() {} | |||
902 | //- /main.rs crate:main deps:dep | 902 | //- /main.rs crate:main deps:dep |
903 | struct S; | 903 | struct S; |
904 | 904 | ||
905 | impl f<|>mt::Display for S {} | 905 | impl f$0mt::Display for S {} |
906 | ", | 906 | ", |
907 | r"use dep::fmt; | 907 | r"use dep::fmt; |
908 | 908 | ||
@@ -930,7 +930,7 @@ mac!(); | |||
930 | 930 | ||
931 | //- /main.rs crate:main deps:dep | 931 | //- /main.rs crate:main deps:dep |
932 | fn main() { | 932 | fn main() { |
933 | Cheese<|>; | 933 | Cheese$0; |
934 | } | 934 | } |
935 | ", | 935 | ", |
936 | r"use dep::Cheese; | 936 | r"use dep::Cheese; |
@@ -954,7 +954,7 @@ pub struct fmt; | |||
954 | 954 | ||
955 | //- /main.rs crate:main deps:dep | 955 | //- /main.rs crate:main deps:dep |
956 | fn main() { | 956 | fn main() { |
957 | FMT<|>; | 957 | FMT$0; |
958 | } | 958 | } |
959 | ", | 959 | ", |
960 | r"use dep::FMT; | 960 | r"use dep::FMT; |
diff --git a/crates/assists/src/handlers/change_visibility.rs b/crates/assists/src/handlers/change_visibility.rs index 22d7c95d9..ac8c44124 100644 --- a/crates/assists/src/handlers/change_visibility.rs +++ b/crates/assists/src/handlers/change_visibility.rs | |||
@@ -13,7 +13,7 @@ use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists}; | |||
13 | // Adds or changes existing visibility specifier. | 13 | // Adds or changes existing visibility specifier. |
14 | // | 14 | // |
15 | // ``` | 15 | // ``` |
16 | // <|>fn frobnicate() {} | 16 | // $0fn frobnicate() {} |
17 | // ``` | 17 | // ``` |
18 | // -> | 18 | // -> |
19 | // ``` | 19 | // ``` |
@@ -118,23 +118,23 @@ mod tests { | |||
118 | 118 | ||
119 | #[test] | 119 | #[test] |
120 | fn change_visibility_adds_pub_crate_to_items() { | 120 | fn change_visibility_adds_pub_crate_to_items() { |
121 | check_assist(change_visibility, "<|>fn foo() {}", "pub(crate) fn foo() {}"); | 121 | check_assist(change_visibility, "$0fn foo() {}", "pub(crate) fn foo() {}"); |
122 | check_assist(change_visibility, "f<|>n foo() {}", "pub(crate) fn foo() {}"); | 122 | check_assist(change_visibility, "f$0n foo() {}", "pub(crate) fn foo() {}"); |
123 | check_assist(change_visibility, "<|>struct Foo {}", "pub(crate) struct Foo {}"); | 123 | check_assist(change_visibility, "$0struct Foo {}", "pub(crate) struct Foo {}"); |
124 | check_assist(change_visibility, "<|>mod foo {}", "pub(crate) mod foo {}"); | 124 | check_assist(change_visibility, "$0mod foo {}", "pub(crate) mod foo {}"); |
125 | check_assist(change_visibility, "<|>trait Foo {}", "pub(crate) trait Foo {}"); | 125 | check_assist(change_visibility, "$0trait Foo {}", "pub(crate) trait Foo {}"); |
126 | check_assist(change_visibility, "m<|>od {}", "pub(crate) mod {}"); | 126 | check_assist(change_visibility, "m$0od {}", "pub(crate) mod {}"); |
127 | check_assist(change_visibility, "unsafe f<|>n foo() {}", "pub(crate) unsafe fn foo() {}"); | 127 | check_assist(change_visibility, "unsafe f$0n foo() {}", "pub(crate) unsafe fn foo() {}"); |
128 | } | 128 | } |
129 | 129 | ||
130 | #[test] | 130 | #[test] |
131 | fn change_visibility_works_with_struct_fields() { | 131 | fn change_visibility_works_with_struct_fields() { |
132 | check_assist( | 132 | check_assist( |
133 | change_visibility, | 133 | change_visibility, |
134 | r"struct S { <|>field: u32 }", | 134 | r"struct S { $0field: u32 }", |
135 | r"struct S { pub(crate) field: u32 }", | 135 | r"struct S { pub(crate) field: u32 }", |
136 | ); | 136 | ); |
137 | check_assist(change_visibility, r"struct S ( <|>u32 )", r"struct S ( pub(crate) u32 )"); | 137 | check_assist(change_visibility, r"struct S ( $0u32 )", r"struct S ( pub(crate) u32 )"); |
138 | } | 138 | } |
139 | 139 | ||
140 | #[test] | 140 | #[test] |
@@ -142,33 +142,33 @@ mod tests { | |||
142 | mark::check!(change_visibility_field_false_positive); | 142 | mark::check!(change_visibility_field_false_positive); |
143 | check_assist_not_applicable( | 143 | check_assist_not_applicable( |
144 | change_visibility, | 144 | change_visibility, |
145 | r"struct S { field: [(); { let <|>x = ();}] }", | 145 | r"struct S { field: [(); { let $0x = ();}] }", |
146 | ) | 146 | ) |
147 | } | 147 | } |
148 | 148 | ||
149 | #[test] | 149 | #[test] |
150 | fn change_visibility_pub_to_pub_crate() { | 150 | fn change_visibility_pub_to_pub_crate() { |
151 | check_assist(change_visibility, "<|>pub fn foo() {}", "pub(crate) fn foo() {}") | 151 | check_assist(change_visibility, "$0pub fn foo() {}", "pub(crate) fn foo() {}") |
152 | } | 152 | } |
153 | 153 | ||
154 | #[test] | 154 | #[test] |
155 | fn change_visibility_pub_crate_to_pub() { | 155 | fn change_visibility_pub_crate_to_pub() { |
156 | check_assist(change_visibility, "<|>pub(crate) fn foo() {}", "pub fn foo() {}") | 156 | check_assist(change_visibility, "$0pub(crate) fn foo() {}", "pub fn foo() {}") |
157 | } | 157 | } |
158 | 158 | ||
159 | #[test] | 159 | #[test] |
160 | fn change_visibility_const() { | 160 | fn change_visibility_const() { |
161 | check_assist(change_visibility, "<|>const FOO = 3u8;", "pub(crate) const FOO = 3u8;"); | 161 | check_assist(change_visibility, "$0const FOO = 3u8;", "pub(crate) const FOO = 3u8;"); |
162 | } | 162 | } |
163 | 163 | ||
164 | #[test] | 164 | #[test] |
165 | fn change_visibility_static() { | 165 | fn change_visibility_static() { |
166 | check_assist(change_visibility, "<|>static FOO = 3u8;", "pub(crate) static FOO = 3u8;"); | 166 | check_assist(change_visibility, "$0static FOO = 3u8;", "pub(crate) static FOO = 3u8;"); |
167 | } | 167 | } |
168 | 168 | ||
169 | #[test] | 169 | #[test] |
170 | fn change_visibility_type_alias() { | 170 | fn change_visibility_type_alias() { |
171 | check_assist(change_visibility, "<|>type T = ();", "pub(crate) type T = ();"); | 171 | check_assist(change_visibility, "$0type T = ();", "pub(crate) type T = ();"); |
172 | } | 172 | } |
173 | 173 | ||
174 | #[test] | 174 | #[test] |
@@ -181,7 +181,7 @@ mod tests { | |||
181 | // comments | 181 | // comments |
182 | 182 | ||
183 | #[derive(Debug)] | 183 | #[derive(Debug)] |
184 | <|>struct Foo; | 184 | $0struct Foo; |
185 | ", | 185 | ", |
186 | r" | 186 | r" |
187 | /// docs | 187 | /// docs |
@@ -199,14 +199,14 @@ mod tests { | |||
199 | check_assist_not_applicable( | 199 | check_assist_not_applicable( |
200 | change_visibility, | 200 | change_visibility, |
201 | r"mod foo { pub enum Foo {Foo1} } | 201 | r"mod foo { pub enum Foo {Foo1} } |
202 | fn main() { foo::Foo::Foo1<|> } ", | 202 | fn main() { foo::Foo::Foo1$0 } ", |
203 | ); | 203 | ); |
204 | } | 204 | } |
205 | 205 | ||
206 | #[test] | 206 | #[test] |
207 | fn change_visibility_target() { | 207 | fn change_visibility_target() { |
208 | check_assist_target(change_visibility, "<|>fn foo() {}", "fn"); | 208 | check_assist_target(change_visibility, "$0fn foo() {}", "fn"); |
209 | check_assist_target(change_visibility, "pub(crate)<|> fn foo() {}", "pub(crate)"); | 209 | check_assist_target(change_visibility, "pub(crate)$0 fn foo() {}", "pub(crate)"); |
210 | check_assist_target(change_visibility, "struct S { <|>field: u32 }", "field"); | 210 | check_assist_target(change_visibility, "struct S { $0field: u32 }", "field"); |
211 | } | 211 | } |
212 | } | 212 | } |
diff --git a/crates/assists/src/handlers/convert_integer_literal.rs b/crates/assists/src/handlers/convert_integer_literal.rs index 667115382..a8a819cfc 100644 --- a/crates/assists/src/handlers/convert_integer_literal.rs +++ b/crates/assists/src/handlers/convert_integer_literal.rs | |||
@@ -7,7 +7,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, GroupLabel}; | |||
7 | // Converts the base of integer literals to other bases. | 7 | // Converts the base of integer literals to other bases. |
8 | // | 8 | // |
9 | // ``` | 9 | // ``` |
10 | // const _: i32 = 10<|>; | 10 | // const _: i32 = 10$0; |
11 | // ``` | 11 | // ``` |
12 | // -> | 12 | // -> |
13 | // ``` | 13 | // ``` |
@@ -65,47 +65,47 @@ mod tests { | |||
65 | 65 | ||
66 | #[test] | 66 | #[test] |
67 | fn binary_target() { | 67 | fn binary_target() { |
68 | check_assist_target(convert_integer_literal, "const _: i32 = 0b1010<|>;", "0b1010"); | 68 | check_assist_target(convert_integer_literal, "const _: i32 = 0b1010$0;", "0b1010"); |
69 | } | 69 | } |
70 | 70 | ||
71 | #[test] | 71 | #[test] |
72 | fn octal_target() { | 72 | fn octal_target() { |
73 | check_assist_target(convert_integer_literal, "const _: i32 = 0o12<|>;", "0o12"); | 73 | check_assist_target(convert_integer_literal, "const _: i32 = 0o12$0;", "0o12"); |
74 | } | 74 | } |
75 | 75 | ||
76 | #[test] | 76 | #[test] |
77 | fn decimal_target() { | 77 | fn decimal_target() { |
78 | check_assist_target(convert_integer_literal, "const _: i32 = 10<|>;", "10"); | 78 | check_assist_target(convert_integer_literal, "const _: i32 = 10$0;", "10"); |
79 | } | 79 | } |
80 | 80 | ||
81 | #[test] | 81 | #[test] |
82 | fn hexadecimal_target() { | 82 | fn hexadecimal_target() { |
83 | check_assist_target(convert_integer_literal, "const _: i32 = 0xA<|>;", "0xA"); | 83 | check_assist_target(convert_integer_literal, "const _: i32 = 0xA$0;", "0xA"); |
84 | } | 84 | } |
85 | 85 | ||
86 | #[test] | 86 | #[test] |
87 | fn binary_target_with_underscores() { | 87 | fn binary_target_with_underscores() { |
88 | check_assist_target(convert_integer_literal, "const _: i32 = 0b10_10<|>;", "0b10_10"); | 88 | check_assist_target(convert_integer_literal, "const _: i32 = 0b10_10$0;", "0b10_10"); |
89 | } | 89 | } |
90 | 90 | ||
91 | #[test] | 91 | #[test] |
92 | fn octal_target_with_underscores() { | 92 | fn octal_target_with_underscores() { |
93 | check_assist_target(convert_integer_literal, "const _: i32 = 0o1_2<|>;", "0o1_2"); | 93 | check_assist_target(convert_integer_literal, "const _: i32 = 0o1_2$0;", "0o1_2"); |
94 | } | 94 | } |
95 | 95 | ||
96 | #[test] | 96 | #[test] |
97 | fn decimal_target_with_underscores() { | 97 | fn decimal_target_with_underscores() { |
98 | check_assist_target(convert_integer_literal, "const _: i32 = 1_0<|>;", "1_0"); | 98 | check_assist_target(convert_integer_literal, "const _: i32 = 1_0$0;", "1_0"); |
99 | } | 99 | } |
100 | 100 | ||
101 | #[test] | 101 | #[test] |
102 | fn hexadecimal_target_with_underscores() { | 102 | fn hexadecimal_target_with_underscores() { |
103 | check_assist_target(convert_integer_literal, "const _: i32 = 0x_A<|>;", "0x_A"); | 103 | check_assist_target(convert_integer_literal, "const _: i32 = 0x_A$0;", "0x_A"); |
104 | } | 104 | } |
105 | 105 | ||
106 | #[test] | 106 | #[test] |
107 | fn convert_decimal_integer() { | 107 | fn convert_decimal_integer() { |
108 | let before = "const _: i32 = 1000<|>;"; | 108 | let before = "const _: i32 = 1000$0;"; |
109 | 109 | ||
110 | check_assist_by_label( | 110 | check_assist_by_label( |
111 | convert_integer_literal, | 111 | convert_integer_literal, |
@@ -131,7 +131,7 @@ mod tests { | |||
131 | 131 | ||
132 | #[test] | 132 | #[test] |
133 | fn convert_hexadecimal_integer() { | 133 | fn convert_hexadecimal_integer() { |
134 | let before = "const _: i32 = 0xFF<|>;"; | 134 | let before = "const _: i32 = 0xFF$0;"; |
135 | 135 | ||
136 | check_assist_by_label( | 136 | check_assist_by_label( |
137 | convert_integer_literal, | 137 | convert_integer_literal, |
@@ -157,7 +157,7 @@ mod tests { | |||
157 | 157 | ||
158 | #[test] | 158 | #[test] |
159 | fn convert_binary_integer() { | 159 | fn convert_binary_integer() { |
160 | let before = "const _: i32 = 0b11111111<|>;"; | 160 | let before = "const _: i32 = 0b11111111$0;"; |
161 | 161 | ||
162 | check_assist_by_label( | 162 | check_assist_by_label( |
163 | convert_integer_literal, | 163 | convert_integer_literal, |
@@ -183,7 +183,7 @@ mod tests { | |||
183 | 183 | ||
184 | #[test] | 184 | #[test] |
185 | fn convert_octal_integer() { | 185 | fn convert_octal_integer() { |
186 | let before = "const _: i32 = 0o377<|>;"; | 186 | let before = "const _: i32 = 0o377$0;"; |
187 | 187 | ||
188 | check_assist_by_label( | 188 | check_assist_by_label( |
189 | convert_integer_literal, | 189 | convert_integer_literal, |
@@ -209,7 +209,7 @@ mod tests { | |||
209 | 209 | ||
210 | #[test] | 210 | #[test] |
211 | fn convert_integer_with_underscores() { | 211 | fn convert_integer_with_underscores() { |
212 | let before = "const _: i32 = 1_00_0<|>;"; | 212 | let before = "const _: i32 = 1_00_0$0;"; |
213 | 213 | ||
214 | check_assist_by_label( | 214 | check_assist_by_label( |
215 | convert_integer_literal, | 215 | convert_integer_literal, |
@@ -235,7 +235,7 @@ mod tests { | |||
235 | 235 | ||
236 | #[test] | 236 | #[test] |
237 | fn convert_integer_with_suffix() { | 237 | fn convert_integer_with_suffix() { |
238 | let before = "const _: i32 = 1000i32<|>;"; | 238 | let before = "const _: i32 = 1000i32$0;"; |
239 | 239 | ||
240 | check_assist_by_label( | 240 | check_assist_by_label( |
241 | convert_integer_literal, | 241 | convert_integer_literal, |
@@ -262,7 +262,7 @@ mod tests { | |||
262 | #[test] | 262 | #[test] |
263 | fn convert_overflowing_literal() { | 263 | fn convert_overflowing_literal() { |
264 | let before = "const _: i32 = | 264 | let before = "const _: i32 = |
265 | 111111111111111111111111111111111111111111111111111111111111111111111111<|>;"; | 265 | 111111111111111111111111111111111111111111111111111111111111111111111111$0;"; |
266 | check_assist_not_applicable(convert_integer_literal, before); | 266 | check_assist_not_applicable(convert_integer_literal, before); |
267 | } | 267 | } |
268 | } | 268 | } |
diff --git a/crates/assists/src/handlers/early_return.rs b/crates/assists/src/handlers/early_return.rs index 2c48f32bf..8bbbb7ed5 100644 --- a/crates/assists/src/handlers/early_return.rs +++ b/crates/assists/src/handlers/early_return.rs | |||
@@ -24,7 +24,7 @@ use crate::{ | |||
24 | // | 24 | // |
25 | // ``` | 25 | // ``` |
26 | // fn main() { | 26 | // fn main() { |
27 | // <|>if cond { | 27 | // $0if cond { |
28 | // foo(); | 28 | // foo(); |
29 | // bar(); | 29 | // bar(); |
30 | // } | 30 | // } |
@@ -200,7 +200,7 @@ mod tests { | |||
200 | r#" | 200 | r#" |
201 | fn main() { | 201 | fn main() { |
202 | bar(); | 202 | bar(); |
203 | if<|> true { | 203 | if$0 true { |
204 | foo(); | 204 | foo(); |
205 | 205 | ||
206 | //comment | 206 | //comment |
@@ -230,7 +230,7 @@ mod tests { | |||
230 | r#" | 230 | r#" |
231 | fn main(n: Option<String>) { | 231 | fn main(n: Option<String>) { |
232 | bar(); | 232 | bar(); |
233 | if<|> let Some(n) = n { | 233 | if$0 let Some(n) = n { |
234 | foo(n); | 234 | foo(n); |
235 | 235 | ||
236 | //comment | 236 | //comment |
@@ -260,7 +260,7 @@ mod tests { | |||
260 | convert_to_guarded_return, | 260 | convert_to_guarded_return, |
261 | r#" | 261 | r#" |
262 | fn main() { | 262 | fn main() { |
263 | if<|> let Ok(x) = Err(92) { | 263 | if$0 let Ok(x) = Err(92) { |
264 | foo(x); | 264 | foo(x); |
265 | } | 265 | } |
266 | } | 266 | } |
@@ -284,7 +284,7 @@ mod tests { | |||
284 | r#" | 284 | r#" |
285 | fn main(n: Option<String>) { | 285 | fn main(n: Option<String>) { |
286 | bar(); | 286 | bar(); |
287 | if<|> let Ok(n) = n { | 287 | if$0 let Ok(n) = n { |
288 | foo(n); | 288 | foo(n); |
289 | 289 | ||
290 | //comment | 290 | //comment |
@@ -315,7 +315,7 @@ mod tests { | |||
315 | r#" | 315 | r#" |
316 | fn main() { | 316 | fn main() { |
317 | while true { | 317 | while true { |
318 | if<|> true { | 318 | if$0 true { |
319 | foo(); | 319 | foo(); |
320 | bar(); | 320 | bar(); |
321 | } | 321 | } |
@@ -343,7 +343,7 @@ mod tests { | |||
343 | r#" | 343 | r#" |
344 | fn main() { | 344 | fn main() { |
345 | while true { | 345 | while true { |
346 | if<|> let Some(n) = n { | 346 | if$0 let Some(n) = n { |
347 | foo(n); | 347 | foo(n); |
348 | bar(); | 348 | bar(); |
349 | } | 349 | } |
@@ -372,7 +372,7 @@ mod tests { | |||
372 | r#" | 372 | r#" |
373 | fn main() { | 373 | fn main() { |
374 | loop { | 374 | loop { |
375 | if<|> true { | 375 | if$0 true { |
376 | foo(); | 376 | foo(); |
377 | bar(); | 377 | bar(); |
378 | } | 378 | } |
@@ -400,7 +400,7 @@ mod tests { | |||
400 | r#" | 400 | r#" |
401 | fn main() { | 401 | fn main() { |
402 | loop { | 402 | loop { |
403 | if<|> let Some(n) = n { | 403 | if$0 let Some(n) = n { |
404 | foo(n); | 404 | foo(n); |
405 | bar(); | 405 | bar(); |
406 | } | 406 | } |
@@ -428,7 +428,7 @@ mod tests { | |||
428 | convert_to_guarded_return, | 428 | convert_to_guarded_return, |
429 | r#" | 429 | r#" |
430 | fn main() { | 430 | fn main() { |
431 | if<|> true { | 431 | if$0 true { |
432 | return; | 432 | return; |
433 | } | 433 | } |
434 | } | 434 | } |
@@ -443,7 +443,7 @@ mod tests { | |||
443 | r#" | 443 | r#" |
444 | fn main() { | 444 | fn main() { |
445 | loop { | 445 | loop { |
446 | if<|> true { | 446 | if$0 true { |
447 | continue; | 447 | continue; |
448 | } | 448 | } |
449 | } | 449 | } |
@@ -458,7 +458,7 @@ mod tests { | |||
458 | convert_to_guarded_return, | 458 | convert_to_guarded_return, |
459 | r#" | 459 | r#" |
460 | fn main() { | 460 | fn main() { |
461 | if<|> true { | 461 | if$0 true { |
462 | return | 462 | return |
463 | } | 463 | } |
464 | } | 464 | } |
@@ -472,7 +472,7 @@ mod tests { | |||
472 | convert_to_guarded_return, | 472 | convert_to_guarded_return, |
473 | r#" | 473 | r#" |
474 | fn main() { | 474 | fn main() { |
475 | if<|> true { | 475 | if$0 true { |
476 | foo(); | 476 | foo(); |
477 | } else { | 477 | } else { |
478 | bar() | 478 | bar() |
@@ -488,7 +488,7 @@ mod tests { | |||
488 | convert_to_guarded_return, | 488 | convert_to_guarded_return, |
489 | r#" | 489 | r#" |
490 | fn main() { | 490 | fn main() { |
491 | if<|> true { | 491 | if$0 true { |
492 | foo(); | 492 | foo(); |
493 | } | 493 | } |
494 | bar(); | 494 | bar(); |
@@ -504,7 +504,7 @@ mod tests { | |||
504 | r#" | 504 | r#" |
505 | fn main() { | 505 | fn main() { |
506 | if false { | 506 | if false { |
507 | if<|> true { | 507 | if$0 true { |
508 | foo(); | 508 | foo(); |
509 | } | 509 | } |
510 | } | 510 | } |
diff --git a/crates/assists/src/handlers/expand_glob_import.rs b/crates/assists/src/handlers/expand_glob_import.rs index f51a9a4ad..5fe617ba4 100644 --- a/crates/assists/src/handlers/expand_glob_import.rs +++ b/crates/assists/src/handlers/expand_glob_import.rs | |||
@@ -25,7 +25,7 @@ use crate::{ | |||
25 | // pub struct Baz; | 25 | // pub struct Baz; |
26 | // } | 26 | // } |
27 | // | 27 | // |
28 | // use foo::*<|>; | 28 | // use foo::*$0; |
29 | // | 29 | // |
30 | // fn qux(bar: Bar, baz: Baz) {} | 30 | // fn qux(bar: Bar, baz: Baz) {} |
31 | // ``` | 31 | // ``` |
@@ -201,7 +201,7 @@ fn is_mod_visible_from(ctx: &AssistContext, module: Module, from: Module) -> boo | |||
201 | // } | 201 | // } |
202 | // | 202 | // |
203 | // ↓ --------------- | 203 | // ↓ --------------- |
204 | // use foo::*<|>; | 204 | // use foo::*$0; |
205 | // use baz::Baz; | 205 | // use baz::Baz; |
206 | // ↑ --------------- | 206 | // ↑ --------------- |
207 | fn find_imported_defs(ctx: &AssistContext, star: SyntaxToken) -> Option<Vec<Def>> { | 207 | fn find_imported_defs(ctx: &AssistContext, star: SyntaxToken) -> Option<Vec<Def>> { |
@@ -303,7 +303,7 @@ mod foo { | |||
303 | pub fn f() {} | 303 | pub fn f() {} |
304 | } | 304 | } |
305 | 305 | ||
306 | use foo::*<|>; | 306 | use foo::*$0; |
307 | 307 | ||
308 | fn qux(bar: Bar, baz: Baz) { | 308 | fn qux(bar: Bar, baz: Baz) { |
309 | f(); | 309 | f(); |
@@ -340,7 +340,7 @@ mod foo { | |||
340 | pub fn f() {} | 340 | pub fn f() {} |
341 | } | 341 | } |
342 | 342 | ||
343 | use foo::{*<|>, f}; | 343 | use foo::{*$0, f}; |
344 | 344 | ||
345 | fn qux(bar: Bar, baz: Baz) { | 345 | fn qux(bar: Bar, baz: Baz) { |
346 | f(); | 346 | f(); |
@@ -378,7 +378,7 @@ mod foo { | |||
378 | } | 378 | } |
379 | 379 | ||
380 | use foo::Bar; | 380 | use foo::Bar; |
381 | use foo::{*<|>, f}; | 381 | use foo::{*$0, f}; |
382 | 382 | ||
383 | fn qux(bar: Bar, baz: Baz) { | 383 | fn qux(bar: Bar, baz: Baz) { |
384 | f(); | 384 | f(); |
@@ -422,7 +422,7 @@ mod foo { | |||
422 | } | 422 | } |
423 | } | 423 | } |
424 | 424 | ||
425 | use foo::{bar::{*<|>, f}, baz::*}; | 425 | use foo::{bar::{*$0, f}, baz::*}; |
426 | 426 | ||
427 | fn qux(bar: Bar, baz: Baz) { | 427 | fn qux(bar: Bar, baz: Baz) { |
428 | f(); | 428 | f(); |
@@ -470,7 +470,7 @@ mod foo { | |||
470 | } | 470 | } |
471 | } | 471 | } |
472 | 472 | ||
473 | use foo::{bar::{Bar, Baz, f}, baz::*<|>}; | 473 | use foo::{bar::{Bar, Baz, f}, baz::*$0}; |
474 | 474 | ||
475 | fn qux(bar: Bar, baz: Baz) { | 475 | fn qux(bar: Bar, baz: Baz) { |
476 | f(); | 476 | f(); |
@@ -529,7 +529,7 @@ mod foo { | |||
529 | 529 | ||
530 | use foo::{ | 530 | use foo::{ |
531 | bar::{*, f}, | 531 | bar::{*, f}, |
532 | baz::{g, qux::*<|>} | 532 | baz::{g, qux::*$0} |
533 | }; | 533 | }; |
534 | 534 | ||
535 | fn qux(bar: Bar, baz: Baz) { | 535 | fn qux(bar: Bar, baz: Baz) { |
@@ -605,7 +605,7 @@ mod foo { | |||
605 | 605 | ||
606 | use foo::{ | 606 | use foo::{ |
607 | bar::{*, f}, | 607 | bar::{*, f}, |
608 | baz::{g, qux::{h, q::*<|>}} | 608 | baz::{g, qux::{h, q::*$0}} |
609 | }; | 609 | }; |
610 | 610 | ||
611 | fn qux(bar: Bar, baz: Baz) { | 611 | fn qux(bar: Bar, baz: Baz) { |
@@ -681,7 +681,7 @@ mod foo { | |||
681 | 681 | ||
682 | use foo::{ | 682 | use foo::{ |
683 | bar::{*, f}, | 683 | bar::{*, f}, |
684 | baz::{g, qux::{q::j, *<|>}} | 684 | baz::{g, qux::{q::j, *$0}} |
685 | }; | 685 | }; |
686 | 686 | ||
687 | fn qux(bar: Bar, baz: Baz) { | 687 | fn qux(bar: Bar, baz: Baz) { |
@@ -747,7 +747,7 @@ fn qux(bar: Bar, baz: Baz) { | |||
747 | // pub fn baz() {} | 747 | // pub fn baz() {} |
748 | 748 | ||
749 | // //- /main.rs crate:main deps:foo | 749 | // //- /main.rs crate:main deps:foo |
750 | // use foo::*<|>; | 750 | // use foo::*$0; |
751 | 751 | ||
752 | // fn main() { | 752 | // fn main() { |
753 | // bar!(); | 753 | // bar!(); |
@@ -777,7 +777,7 @@ pub trait Tr { | |||
777 | impl Tr for () {} | 777 | impl Tr for () {} |
778 | 778 | ||
779 | //- /main.rs crate:main deps:foo | 779 | //- /main.rs crate:main deps:foo |
780 | use foo::*<|>; | 780 | use foo::*$0; |
781 | 781 | ||
782 | fn main() { | 782 | fn main() { |
783 | ().method(); | 783 | ().method(); |
@@ -807,7 +807,7 @@ pub trait Tr2 { | |||
807 | impl Tr2 for () {} | 807 | impl Tr2 for () {} |
808 | 808 | ||
809 | //- /main.rs crate:main deps:foo | 809 | //- /main.rs crate:main deps:foo |
810 | use foo::*<|>; | 810 | use foo::*$0; |
811 | 811 | ||
812 | fn main() { | 812 | fn main() { |
813 | ().method(); | 813 | ().method(); |
@@ -834,7 +834,7 @@ mod foo { | |||
834 | } | 834 | } |
835 | } | 835 | } |
836 | 836 | ||
837 | use foo::bar::*<|>; | 837 | use foo::bar::*$0; |
838 | 838 | ||
839 | fn baz(bar: Bar) {} | 839 | fn baz(bar: Bar) {} |
840 | ", | 840 | ", |
@@ -851,7 +851,7 @@ mod foo { | |||
851 | } | 851 | } |
852 | } | 852 | } |
853 | 853 | ||
854 | use foo::bar::baz::*<|>; | 854 | use foo::bar::baz::*$0; |
855 | 855 | ||
856 | fn qux(baz: Baz) {} | 856 | fn qux(baz: Baz) {} |
857 | ", | 857 | ", |
@@ -869,7 +869,7 @@ fn qux(baz: Baz) {} | |||
869 | pub struct Qux; | 869 | pub struct Qux; |
870 | } | 870 | } |
871 | 871 | ||
872 | use foo::Bar<|>; | 872 | use foo::Bar$0; |
873 | 873 | ||
874 | fn qux(bar: Bar, baz: Baz) {} | 874 | fn qux(bar: Bar, baz: Baz) {} |
875 | ", | 875 | ", |
@@ -885,7 +885,7 @@ mod foo { | |||
885 | pub struct Bar; | 885 | pub struct Bar; |
886 | } | 886 | } |
887 | 887 | ||
888 | use foo::{*<|>}; | 888 | use foo::{*$0}; |
889 | 889 | ||
890 | struct Baz { | 890 | struct Baz { |
891 | bar: Bar | 891 | bar: Bar |
diff --git a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs index 6f35a061c..40028fc01 100644 --- a/crates/assists/src/handlers/extract_struct_from_enum_variant.rs +++ b/crates/assists/src/handlers/extract_struct_from_enum_variant.rs | |||
@@ -21,7 +21,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
21 | // Extracts a struct from enum variant. | 21 | // Extracts a struct from enum variant. |
22 | // | 22 | // |
23 | // ``` | 23 | // ``` |
24 | // enum A { <|>One(u32, u32) } | 24 | // enum A { $0One(u32, u32) } |
25 | // ``` | 25 | // ``` |
26 | // -> | 26 | // -> |
27 | // ``` | 27 | // ``` |
@@ -251,7 +251,7 @@ mod tests { | |||
251 | fn test_extract_struct_several_fields_tuple() { | 251 | fn test_extract_struct_several_fields_tuple() { |
252 | check_assist( | 252 | check_assist( |
253 | extract_struct_from_enum_variant, | 253 | extract_struct_from_enum_variant, |
254 | "enum A { <|>One(u32, u32) }", | 254 | "enum A { $0One(u32, u32) }", |
255 | r#"struct One(pub u32, pub u32); | 255 | r#"struct One(pub u32, pub u32); |
256 | 256 | ||
257 | enum A { One(One) }"#, | 257 | enum A { One(One) }"#, |
@@ -262,7 +262,7 @@ enum A { One(One) }"#, | |||
262 | fn test_extract_struct_several_fields_named() { | 262 | fn test_extract_struct_several_fields_named() { |
263 | check_assist( | 263 | check_assist( |
264 | extract_struct_from_enum_variant, | 264 | extract_struct_from_enum_variant, |
265 | "enum A { <|>One { foo: u32, bar: u32 } }", | 265 | "enum A { $0One { foo: u32, bar: u32 } }", |
266 | r#"struct One{ pub foo: u32, pub bar: u32 } | 266 | r#"struct One{ pub foo: u32, pub bar: u32 } |
267 | 267 | ||
268 | enum A { One(One) }"#, | 268 | enum A { One(One) }"#, |
@@ -273,7 +273,7 @@ enum A { One(One) }"#, | |||
273 | fn test_extract_struct_one_field_named() { | 273 | fn test_extract_struct_one_field_named() { |
274 | check_assist( | 274 | check_assist( |
275 | extract_struct_from_enum_variant, | 275 | extract_struct_from_enum_variant, |
276 | "enum A { <|>One { foo: u32 } }", | 276 | "enum A { $0One { foo: u32 } }", |
277 | r#"struct One{ pub foo: u32 } | 277 | r#"struct One{ pub foo: u32 } |
278 | 278 | ||
279 | enum A { One(One) }"#, | 279 | enum A { One(One) }"#, |
@@ -285,7 +285,7 @@ enum A { One(One) }"#, | |||
285 | check_assist( | 285 | check_assist( |
286 | extract_struct_from_enum_variant, | 286 | extract_struct_from_enum_variant, |
287 | r#"const One: () = (); | 287 | r#"const One: () = (); |
288 | enum A { <|>One(u32, u32) }"#, | 288 | enum A { $0One(u32, u32) }"#, |
289 | r#"const One: () = (); | 289 | r#"const One: () = (); |
290 | struct One(pub u32, pub u32); | 290 | struct One(pub u32, pub u32); |
291 | 291 | ||
@@ -297,7 +297,7 @@ enum A { One(One) }"#, | |||
297 | fn test_extract_struct_pub_visibility() { | 297 | fn test_extract_struct_pub_visibility() { |
298 | check_assist( | 298 | check_assist( |
299 | extract_struct_from_enum_variant, | 299 | extract_struct_from_enum_variant, |
300 | "pub enum A { <|>One(u32, u32) }", | 300 | "pub enum A { $0One(u32, u32) }", |
301 | r#"pub struct One(pub u32, pub u32); | 301 | r#"pub struct One(pub u32, pub u32); |
302 | 302 | ||
303 | pub enum A { One(One) }"#, | 303 | pub enum A { One(One) }"#, |
@@ -319,7 +319,7 @@ pub enum A { One(One) }"#, | |||
319 | } | 319 | } |
320 | 320 | ||
321 | pub enum MyEnum { | 321 | pub enum MyEnum { |
322 | <|>MyField(u8, u8), | 322 | $0MyField(u8, u8), |
323 | } | 323 | } |
324 | } | 324 | } |
325 | } | 325 | } |
@@ -361,7 +361,7 @@ fn another_fn() { | |||
361 | extract_struct_from_enum_variant, | 361 | extract_struct_from_enum_variant, |
362 | r#" | 362 | r#" |
363 | enum E { | 363 | enum E { |
364 | <|>V { i: i32, j: i32 } | 364 | $0V { i: i32, j: i32 } |
365 | } | 365 | } |
366 | 366 | ||
367 | fn f() { | 367 | fn f() { |
@@ -389,7 +389,7 @@ fn f() { | |||
389 | r#" | 389 | r#" |
390 | //- /main.rs | 390 | //- /main.rs |
391 | enum E { | 391 | enum E { |
392 | <|>V(i32, i32) | 392 | $0V(i32, i32) |
393 | } | 393 | } |
394 | mod foo; | 394 | mod foo; |
395 | 395 | ||
@@ -424,7 +424,7 @@ fn f() { | |||
424 | r#" | 424 | r#" |
425 | //- /main.rs | 425 | //- /main.rs |
426 | enum E { | 426 | enum E { |
427 | <|>V { i: i32, j: i32 } | 427 | $0V { i: i32, j: i32 } |
428 | } | 428 | } |
429 | mod foo; | 429 | mod foo; |
430 | 430 | ||
@@ -457,7 +457,7 @@ fn f() { | |||
457 | check_assist( | 457 | check_assist( |
458 | extract_struct_from_enum_variant, | 458 | extract_struct_from_enum_variant, |
459 | r#" | 459 | r#" |
460 | enum A { <|>One { a: u32, b: u32 } } | 460 | enum A { $0One { a: u32, b: u32 } } |
461 | 461 | ||
462 | struct B(A); | 462 | struct B(A); |
463 | 463 | ||
@@ -487,29 +487,29 @@ fn foo() { | |||
487 | 487 | ||
488 | #[test] | 488 | #[test] |
489 | fn test_extract_enum_not_applicable_for_element_with_no_fields() { | 489 | fn test_extract_enum_not_applicable_for_element_with_no_fields() { |
490 | check_not_applicable("enum A { <|>One }"); | 490 | check_not_applicable("enum A { $0One }"); |
491 | } | 491 | } |
492 | 492 | ||
493 | #[test] | 493 | #[test] |
494 | fn test_extract_enum_not_applicable_if_struct_exists() { | 494 | fn test_extract_enum_not_applicable_if_struct_exists() { |
495 | check_not_applicable( | 495 | check_not_applicable( |
496 | r#"struct One; | 496 | r#"struct One; |
497 | enum A { <|>One(u8, u32) }"#, | 497 | enum A { $0One(u8, u32) }"#, |
498 | ); | 498 | ); |
499 | } | 499 | } |
500 | 500 | ||
501 | #[test] | 501 | #[test] |
502 | fn test_extract_not_applicable_one_field() { | 502 | fn test_extract_not_applicable_one_field() { |
503 | check_not_applicable(r"enum A { <|>One(u32) }"); | 503 | check_not_applicable(r"enum A { $0One(u32) }"); |
504 | } | 504 | } |
505 | 505 | ||
506 | #[test] | 506 | #[test] |
507 | fn test_extract_not_applicable_no_field_tuple() { | 507 | fn test_extract_not_applicable_no_field_tuple() { |
508 | check_not_applicable(r"enum A { <|>None() }"); | 508 | check_not_applicable(r"enum A { $0None() }"); |
509 | } | 509 | } |
510 | 510 | ||
511 | #[test] | 511 | #[test] |
512 | fn test_extract_not_applicable_no_field_named() { | 512 | fn test_extract_not_applicable_no_field_named() { |
513 | check_not_applicable(r"enum A { <|>None {} }"); | 513 | check_not_applicable(r"enum A { $0None {} }"); |
514 | } | 514 | } |
515 | } | 515 | } |
diff --git a/crates/assists/src/handlers/extract_variable.rs b/crates/assists/src/handlers/extract_variable.rs index 291809205..98f3dc6ca 100644 --- a/crates/assists/src/handlers/extract_variable.rs +++ b/crates/assists/src/handlers/extract_variable.rs | |||
@@ -16,7 +16,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
16 | // | 16 | // |
17 | // ``` | 17 | // ``` |
18 | // fn main() { | 18 | // fn main() { |
19 | // <|>(1 + 2)<|> * 4; | 19 | // $0(1 + 2)$0 * 4; |
20 | // } | 20 | // } |
21 | // ``` | 21 | // ``` |
22 | // -> | 22 | // -> |
@@ -187,7 +187,7 @@ mod tests { | |||
187 | extract_variable, | 187 | extract_variable, |
188 | r#" | 188 | r#" |
189 | fn foo() { | 189 | fn foo() { |
190 | foo(<|>1 + 1<|>); | 190 | foo($01 + 1$0); |
191 | }"#, | 191 | }"#, |
192 | r#" | 192 | r#" |
193 | fn foo() { | 193 | fn foo() { |
@@ -200,7 +200,7 @@ fn foo() { | |||
200 | #[test] | 200 | #[test] |
201 | fn extract_var_in_comment_is_not_applicable() { | 201 | fn extract_var_in_comment_is_not_applicable() { |
202 | mark::check!(extract_var_in_comment_is_not_applicable); | 202 | mark::check!(extract_var_in_comment_is_not_applicable); |
203 | check_assist_not_applicable(extract_variable, "fn main() { 1 + /* <|>comment<|> */ 1; }"); | 203 | check_assist_not_applicable(extract_variable, "fn main() { 1 + /* $0comment$0 */ 1; }"); |
204 | } | 204 | } |
205 | 205 | ||
206 | #[test] | 206 | #[test] |
@@ -210,7 +210,7 @@ fn foo() { | |||
210 | extract_variable, | 210 | extract_variable, |
211 | r#" | 211 | r#" |
212 | fn foo() { | 212 | fn foo() { |
213 | <|>1 + 1<|>; | 213 | $01 + 1$0; |
214 | }"#, | 214 | }"#, |
215 | r#" | 215 | r#" |
216 | fn foo() { | 216 | fn foo() { |
@@ -221,7 +221,7 @@ fn foo() { | |||
221 | extract_variable, | 221 | extract_variable, |
222 | " | 222 | " |
223 | fn foo() { | 223 | fn foo() { |
224 | <|>{ let x = 0; x }<|> | 224 | $0{ let x = 0; x }$0 |
225 | something_else(); | 225 | something_else(); |
226 | }", | 226 | }", |
227 | " | 227 | " |
@@ -238,7 +238,7 @@ fn foo() { | |||
238 | extract_variable, | 238 | extract_variable, |
239 | " | 239 | " |
240 | fn foo() { | 240 | fn foo() { |
241 | <|>1<|> + 1; | 241 | $01$0 + 1; |
242 | }", | 242 | }", |
243 | " | 243 | " |
244 | fn foo() { | 244 | fn foo() { |
@@ -255,7 +255,7 @@ fn foo() { | |||
255 | extract_variable, | 255 | extract_variable, |
256 | r#" | 256 | r#" |
257 | fn foo() { | 257 | fn foo() { |
258 | bar(<|>1 + 1<|>) | 258 | bar($01 + 1$0) |
259 | } | 259 | } |
260 | "#, | 260 | "#, |
261 | r#" | 261 | r#" |
@@ -269,7 +269,7 @@ fn foo() { | |||
269 | extract_variable, | 269 | extract_variable, |
270 | r#" | 270 | r#" |
271 | fn foo() { | 271 | fn foo() { |
272 | <|>bar(1 + 1)<|> | 272 | $0bar(1 + 1)$0 |
273 | } | 273 | } |
274 | "#, | 274 | "#, |
275 | r#" | 275 | r#" |
@@ -289,7 +289,7 @@ fn foo() { | |||
289 | fn main() { | 289 | fn main() { |
290 | let x = true; | 290 | let x = true; |
291 | let tuple = match x { | 291 | let tuple = match x { |
292 | true => (<|>2 + 2<|>, true) | 292 | true => ($02 + 2$0, true) |
293 | _ => (0, false) | 293 | _ => (0, false) |
294 | }; | 294 | }; |
295 | } | 295 | } |
@@ -316,7 +316,7 @@ fn main() { | |||
316 | let tuple = match x { | 316 | let tuple = match x { |
317 | true => { | 317 | true => { |
318 | let y = 1; | 318 | let y = 1; |
319 | (<|>2 + y<|>, true) | 319 | ($02 + y$0, true) |
320 | } | 320 | } |
321 | _ => (0, false) | 321 | _ => (0, false) |
322 | }; | 322 | }; |
@@ -344,7 +344,7 @@ fn main() { | |||
344 | extract_variable, | 344 | extract_variable, |
345 | " | 345 | " |
346 | fn main() { | 346 | fn main() { |
347 | let lambda = |x: u32| <|>x * 2<|>; | 347 | let lambda = |x: u32| $0x * 2$0; |
348 | } | 348 | } |
349 | ", | 349 | ", |
350 | " | 350 | " |
@@ -361,7 +361,7 @@ fn main() { | |||
361 | extract_variable, | 361 | extract_variable, |
362 | " | 362 | " |
363 | fn main() { | 363 | fn main() { |
364 | let lambda = |x: u32| { <|>x * 2<|> }; | 364 | let lambda = |x: u32| { $0x * 2$0 }; |
365 | } | 365 | } |
366 | ", | 366 | ", |
367 | " | 367 | " |
@@ -378,7 +378,7 @@ fn main() { | |||
378 | extract_variable, | 378 | extract_variable, |
379 | " | 379 | " |
380 | fn main() { | 380 | fn main() { |
381 | let o = <|>Some(true)<|>; | 381 | let o = $0Some(true)$0; |
382 | } | 382 | } |
383 | ", | 383 | ", |
384 | " | 384 | " |
@@ -396,7 +396,7 @@ fn main() { | |||
396 | extract_variable, | 396 | extract_variable, |
397 | " | 397 | " |
398 | fn main() { | 398 | fn main() { |
399 | let v = <|>bar.foo()<|>; | 399 | let v = $0bar.foo()$0; |
400 | } | 400 | } |
401 | ", | 401 | ", |
402 | " | 402 | " |
@@ -414,7 +414,7 @@ fn main() { | |||
414 | extract_variable, | 414 | extract_variable, |
415 | " | 415 | " |
416 | fn foo() -> u32 { | 416 | fn foo() -> u32 { |
417 | <|>return 2 + 2<|>; | 417 | $0return 2 + 2$0; |
418 | } | 418 | } |
419 | ", | 419 | ", |
420 | " | 420 | " |
@@ -434,7 +434,7 @@ fn foo() -> u32 { | |||
434 | fn foo() -> u32 { | 434 | fn foo() -> u32 { |
435 | 435 | ||
436 | 436 | ||
437 | <|>return 2 + 2<|>; | 437 | $0return 2 + 2$0; |
438 | } | 438 | } |
439 | ", | 439 | ", |
440 | " | 440 | " |
@@ -452,7 +452,7 @@ fn foo() -> u32 { | |||
452 | " | 452 | " |
453 | fn foo() -> u32 { | 453 | fn foo() -> u32 { |
454 | 454 | ||
455 | <|>return 2 + 2<|>; | 455 | $0return 2 + 2$0; |
456 | } | 456 | } |
457 | ", | 457 | ", |
458 | " | 458 | " |
@@ -473,7 +473,7 @@ fn foo() -> u32 { | |||
473 | // bar | 473 | // bar |
474 | 474 | ||
475 | 475 | ||
476 | <|>return 2 + 2<|>; | 476 | $0return 2 + 2$0; |
477 | } | 477 | } |
478 | ", | 478 | ", |
479 | " | 479 | " |
@@ -497,7 +497,7 @@ fn foo() -> u32 { | |||
497 | " | 497 | " |
498 | fn main() { | 498 | fn main() { |
499 | let result = loop { | 499 | let result = loop { |
500 | <|>break 2 + 2<|>; | 500 | $0break 2 + 2$0; |
501 | }; | 501 | }; |
502 | } | 502 | } |
503 | ", | 503 | ", |
@@ -518,7 +518,7 @@ fn main() { | |||
518 | extract_variable, | 518 | extract_variable, |
519 | " | 519 | " |
520 | fn main() { | 520 | fn main() { |
521 | let v = <|>0f32 as u32<|>; | 521 | let v = $00f32 as u32$0; |
522 | } | 522 | } |
523 | ", | 523 | ", |
524 | " | 524 | " |
@@ -540,7 +540,7 @@ struct S { | |||
540 | } | 540 | } |
541 | 541 | ||
542 | fn main() { | 542 | fn main() { |
543 | S { foo: <|>1 + 1<|> } | 543 | S { foo: $01 + 1$0 } |
544 | } | 544 | } |
545 | "#, | 545 | "#, |
546 | r#" | 546 | r#" |
@@ -558,18 +558,18 @@ fn main() { | |||
558 | 558 | ||
559 | #[test] | 559 | #[test] |
560 | fn test_extract_var_for_return_not_applicable() { | 560 | fn test_extract_var_for_return_not_applicable() { |
561 | check_assist_not_applicable(extract_variable, "fn foo() { <|>return<|>; } "); | 561 | check_assist_not_applicable(extract_variable, "fn foo() { $0return$0; } "); |
562 | } | 562 | } |
563 | 563 | ||
564 | #[test] | 564 | #[test] |
565 | fn test_extract_var_for_break_not_applicable() { | 565 | fn test_extract_var_for_break_not_applicable() { |
566 | check_assist_not_applicable(extract_variable, "fn main() { loop { <|>break<|>; }; }"); | 566 | check_assist_not_applicable(extract_variable, "fn main() { loop { $0break$0; }; }"); |
567 | } | 567 | } |
568 | 568 | ||
569 | // FIXME: This is not quite correct, but good enough(tm) for the sorting heuristic | 569 | // FIXME: This is not quite correct, but good enough(tm) for the sorting heuristic |
570 | #[test] | 570 | #[test] |
571 | fn extract_var_target() { | 571 | fn extract_var_target() { |
572 | check_assist_target(extract_variable, "fn foo() -> u32 { <|>return 2 + 2<|>; }", "2 + 2"); | 572 | check_assist_target(extract_variable, "fn foo() -> u32 { $0return 2 + 2$0; }", "2 + 2"); |
573 | 573 | ||
574 | check_assist_target( | 574 | check_assist_target( |
575 | extract_variable, | 575 | extract_variable, |
@@ -577,7 +577,7 @@ fn main() { | |||
577 | fn main() { | 577 | fn main() { |
578 | let x = true; | 578 | let x = true; |
579 | let tuple = match x { | 579 | let tuple = match x { |
580 | true => (<|>2 + 2<|>, true) | 580 | true => ($02 + 2$0, true) |
581 | _ => (0, false) | 581 | _ => (0, false) |
582 | }; | 582 | }; |
583 | } | 583 | } |
diff --git a/crates/assists/src/handlers/fill_match_arms.rs b/crates/assists/src/handlers/fill_match_arms.rs index f9a62b9fa..da47187e4 100644 --- a/crates/assists/src/handlers/fill_match_arms.rs +++ b/crates/assists/src/handlers/fill_match_arms.rs | |||
@@ -21,7 +21,7 @@ use crate::{ | |||
21 | // | 21 | // |
22 | // fn handle(action: Action) { | 22 | // fn handle(action: Action) { |
23 | // match action { | 23 | // match action { |
24 | // <|> | 24 | // $0 |
25 | // } | 25 | // } |
26 | // } | 26 | // } |
27 | // ``` | 27 | // ``` |
@@ -231,7 +231,7 @@ mod tests { | |||
231 | Cs(i32, Option<i32>), | 231 | Cs(i32, Option<i32>), |
232 | } | 232 | } |
233 | fn main() { | 233 | fn main() { |
234 | match A::As<|> { | 234 | match A::As$0 { |
235 | A::As, | 235 | A::As, |
236 | A::Bs{x,y:Some(_)} => {} | 236 | A::Bs{x,y:Some(_)} => {} |
237 | A::Cs(_, Some(_)) => {} | 237 | A::Cs(_, Some(_)) => {} |
@@ -249,7 +249,7 @@ mod tests { | |||
249 | fill_match_arms, | 249 | fill_match_arms, |
250 | r#" | 250 | r#" |
251 | fn main() { | 251 | fn main() { |
252 | match (0, false)<|> { | 252 | match (0, false)$0 { |
253 | } | 253 | } |
254 | } | 254 | } |
255 | "#, | 255 | "#, |
@@ -267,7 +267,7 @@ mod tests { | |||
267 | Cs(i32, Option<i32>), | 267 | Cs(i32, Option<i32>), |
268 | } | 268 | } |
269 | fn main() { | 269 | fn main() { |
270 | match A::As<|> { | 270 | match A::As$0 { |
271 | A::Bs { x, y: Some(_) } => {} | 271 | A::Bs { x, y: Some(_) } => {} |
272 | A::Cs(_, Some(_)) => {} | 272 | A::Cs(_, Some(_)) => {} |
273 | } | 273 | } |
@@ -297,7 +297,7 @@ mod tests { | |||
297 | r#" | 297 | r#" |
298 | enum A { As, Bs, Cs(Option<i32>) } | 298 | enum A { As, Bs, Cs(Option<i32>) } |
299 | fn main() { | 299 | fn main() { |
300 | match A::As<|> { | 300 | match A::As$0 { |
301 | A::Cs(_) | A::Bs => {} | 301 | A::Cs(_) | A::Bs => {} |
302 | } | 302 | } |
303 | } | 303 | } |
@@ -322,7 +322,7 @@ fn main() { | |||
322 | enum A { As, Bs, Cs, Ds(String), Es(B) } | 322 | enum A { As, Bs, Cs, Ds(String), Es(B) } |
323 | enum B { Xs, Ys } | 323 | enum B { Xs, Ys } |
324 | fn main() { | 324 | fn main() { |
325 | match A::As<|> { | 325 | match A::As$0 { |
326 | A::Bs if 0 < 1 => {} | 326 | A::Bs if 0 < 1 => {} |
327 | A::Ds(_value) => { let x = 1; } | 327 | A::Ds(_value) => { let x = 1; } |
328 | A::Es(B::Xs) => (), | 328 | A::Es(B::Xs) => (), |
@@ -352,7 +352,7 @@ fn main() { | |||
352 | r#" | 352 | r#" |
353 | enum A { As, Bs, Cs(Option<i32>) } | 353 | enum A { As, Bs, Cs(Option<i32>) } |
354 | fn main() { | 354 | fn main() { |
355 | match A::As<|> { | 355 | match A::As$0 { |
356 | A::As(_) => {} | 356 | A::As(_) => {} |
357 | a @ A::Bs(_) => {} | 357 | a @ A::Bs(_) => {} |
358 | } | 358 | } |
@@ -380,7 +380,7 @@ enum A { As, Bs, Cs(String), Ds(String, String), Es { x: usize, y: usize } } | |||
380 | 380 | ||
381 | fn main() { | 381 | fn main() { |
382 | let a = A::As; | 382 | let a = A::As; |
383 | match a<|> {} | 383 | match a$0 {} |
384 | } | 384 | } |
385 | "#, | 385 | "#, |
386 | r#" | 386 | r#" |
@@ -411,7 +411,7 @@ fn main() { | |||
411 | fn main() { | 411 | fn main() { |
412 | let a = A::One; | 412 | let a = A::One; |
413 | let b = B::One; | 413 | let b = B::One; |
414 | match (a<|>, b) {} | 414 | match (a$0, b) {} |
415 | } | 415 | } |
416 | "#, | 416 | "#, |
417 | r#" | 417 | r#" |
@@ -443,7 +443,7 @@ fn main() { | |||
443 | fn main() { | 443 | fn main() { |
444 | let a = A::One; | 444 | let a = A::One; |
445 | let b = B::One; | 445 | let b = B::One; |
446 | match (&a<|>, &b) {} | 446 | match (&a$0, &b) {} |
447 | } | 447 | } |
448 | "#, | 448 | "#, |
449 | r#" | 449 | r#" |
@@ -475,7 +475,7 @@ fn main() { | |||
475 | fn main() { | 475 | fn main() { |
476 | let a = A::One; | 476 | let a = A::One; |
477 | let b = B::One; | 477 | let b = B::One; |
478 | match (a<|>, b) { | 478 | match (a$0, b) { |
479 | (A::Two, B::One) => {} | 479 | (A::Two, B::One) => {} |
480 | } | 480 | } |
481 | } | 481 | } |
@@ -494,7 +494,7 @@ fn main() { | |||
494 | fn main() { | 494 | fn main() { |
495 | let a = A::One; | 495 | let a = A::One; |
496 | let b = B::One; | 496 | let b = B::One; |
497 | match (a<|>, b) { | 497 | match (a$0, b) { |
498 | (A::Two, B::One) => {} | 498 | (A::Two, B::One) => {} |
499 | (A::One, B::One) => {} | 499 | (A::One, B::One) => {} |
500 | (A::One, B::Two) => {} | 500 | (A::One, B::Two) => {} |
@@ -517,7 +517,7 @@ fn main() { | |||
517 | 517 | ||
518 | fn main() { | 518 | fn main() { |
519 | let a = A::One; | 519 | let a = A::One; |
520 | match (a<|>, ) { | 520 | match (a$0, ) { |
521 | } | 521 | } |
522 | } | 522 | } |
523 | "#, | 523 | "#, |
@@ -532,7 +532,7 @@ fn main() { | |||
532 | enum A { As } | 532 | enum A { As } |
533 | 533 | ||
534 | fn foo(a: &A) { | 534 | fn foo(a: &A) { |
535 | match a<|> { | 535 | match a$0 { |
536 | } | 536 | } |
537 | } | 537 | } |
538 | "#, | 538 | "#, |
@@ -555,7 +555,7 @@ fn main() { | |||
555 | } | 555 | } |
556 | 556 | ||
557 | fn foo(a: &mut A) { | 557 | fn foo(a: &mut A) { |
558 | match a<|> { | 558 | match a$0 { |
559 | } | 559 | } |
560 | } | 560 | } |
561 | "#, | 561 | "#, |
@@ -581,7 +581,7 @@ fn main() { | |||
581 | enum E { X, Y } | 581 | enum E { X, Y } |
582 | 582 | ||
583 | fn main() { | 583 | fn main() { |
584 | match E::X<|> {} | 584 | match E::X$0 {} |
585 | } | 585 | } |
586 | "#, | 586 | "#, |
587 | "match E::X {}", | 587 | "match E::X {}", |
@@ -597,7 +597,7 @@ fn main() { | |||
597 | 597 | ||
598 | fn main() { | 598 | fn main() { |
599 | match E::X { | 599 | match E::X { |
600 | <|>_ => {} | 600 | $0_ => {} |
601 | } | 601 | } |
602 | } | 602 | } |
603 | "#, | 603 | "#, |
@@ -624,7 +624,7 @@ fn main() { | |||
624 | 624 | ||
625 | fn main() { | 625 | fn main() { |
626 | match X { | 626 | match X { |
627 | <|> | 627 | $0 |
628 | } | 628 | } |
629 | } | 629 | } |
630 | "#, | 630 | "#, |
@@ -650,7 +650,7 @@ fn main() { | |||
650 | enum A { One, Two } | 650 | enum A { One, Two } |
651 | fn foo(a: A) { | 651 | fn foo(a: A) { |
652 | match a { | 652 | match a { |
653 | // foo bar baz<|> | 653 | // foo bar baz$0 |
654 | A::One => {} | 654 | A::One => {} |
655 | // This is where the rest should be | 655 | // This is where the rest should be |
656 | } | 656 | } |
@@ -678,7 +678,7 @@ fn main() { | |||
678 | enum A { One, Two } | 678 | enum A { One, Two } |
679 | fn foo(a: A) { | 679 | fn foo(a: A) { |
680 | match a { | 680 | match a { |
681 | // foo bar baz<|> | 681 | // foo bar baz$0 |
682 | } | 682 | } |
683 | } | 683 | } |
684 | "#, | 684 | "#, |
@@ -702,7 +702,7 @@ fn main() { | |||
702 | r#" | 702 | r#" |
703 | enum A { One, Two, } | 703 | enum A { One, Two, } |
704 | fn foo(a: A) { | 704 | fn foo(a: A) { |
705 | match a<|> { | 705 | match a$0 { |
706 | _ => (), | 706 | _ => (), |
707 | } | 707 | } |
708 | } | 708 | } |
@@ -724,7 +724,7 @@ fn main() { | |||
724 | mark::check!(option_order); | 724 | mark::check!(option_order); |
725 | let before = r#" | 725 | let before = r#" |
726 | fn foo(opt: Option<i32>) { | 726 | fn foo(opt: Option<i32>) { |
727 | match opt<|> { | 727 | match opt$0 { |
728 | } | 728 | } |
729 | } | 729 | } |
730 | "#; | 730 | "#; |
diff --git a/crates/assists/src/handlers/fix_visibility.rs b/crates/assists/src/handlers/fix_visibility.rs index c10b3b8f5..6c7824e55 100644 --- a/crates/assists/src/handlers/fix_visibility.rs +++ b/crates/assists/src/handlers/fix_visibility.rs | |||
@@ -18,7 +18,7 @@ use crate::{utils::vis_offset, AssistContext, AssistId, AssistKind, Assists}; | |||
18 | // fn frobnicate() {} | 18 | // fn frobnicate() {} |
19 | // } | 19 | // } |
20 | // fn main() { | 20 | // fn main() { |
21 | // m::frobnicate<|>() {} | 21 | // m::frobnicate$0() {} |
22 | // } | 22 | // } |
23 | // ``` | 23 | // ``` |
24 | // -> | 24 | // -> |
@@ -218,14 +218,14 @@ mod tests { | |||
218 | check_assist( | 218 | check_assist( |
219 | fix_visibility, | 219 | fix_visibility, |
220 | r"mod foo { fn foo() {} } | 220 | r"mod foo { fn foo() {} } |
221 | fn main() { foo::foo<|>() } ", | 221 | fn main() { foo::foo$0() } ", |
222 | r"mod foo { $0pub(crate) fn foo() {} } | 222 | r"mod foo { $0pub(crate) fn foo() {} } |
223 | fn main() { foo::foo() } ", | 223 | fn main() { foo::foo() } ", |
224 | ); | 224 | ); |
225 | check_assist_not_applicable( | 225 | check_assist_not_applicable( |
226 | fix_visibility, | 226 | fix_visibility, |
227 | r"mod foo { pub fn foo() {} } | 227 | r"mod foo { pub fn foo() {} } |
228 | fn main() { foo::foo<|>() } ", | 228 | fn main() { foo::foo$0() } ", |
229 | ) | 229 | ) |
230 | } | 230 | } |
231 | 231 | ||
@@ -234,38 +234,38 @@ mod tests { | |||
234 | check_assist( | 234 | check_assist( |
235 | fix_visibility, | 235 | fix_visibility, |
236 | r"mod foo { struct Foo; } | 236 | r"mod foo { struct Foo; } |
237 | fn main() { foo::Foo<|> } ", | 237 | fn main() { foo::Foo$0 } ", |
238 | r"mod foo { $0pub(crate) struct Foo; } | 238 | r"mod foo { $0pub(crate) struct Foo; } |
239 | fn main() { foo::Foo } ", | 239 | fn main() { foo::Foo } ", |
240 | ); | 240 | ); |
241 | check_assist_not_applicable( | 241 | check_assist_not_applicable( |
242 | fix_visibility, | 242 | fix_visibility, |
243 | r"mod foo { pub struct Foo; } | 243 | r"mod foo { pub struct Foo; } |
244 | fn main() { foo::Foo<|> } ", | 244 | fn main() { foo::Foo$0 } ", |
245 | ); | 245 | ); |
246 | check_assist( | 246 | check_assist( |
247 | fix_visibility, | 247 | fix_visibility, |
248 | r"mod foo { enum Foo; } | 248 | r"mod foo { enum Foo; } |
249 | fn main() { foo::Foo<|> } ", | 249 | fn main() { foo::Foo$0 } ", |
250 | r"mod foo { $0pub(crate) enum Foo; } | 250 | r"mod foo { $0pub(crate) enum Foo; } |
251 | fn main() { foo::Foo } ", | 251 | fn main() { foo::Foo } ", |
252 | ); | 252 | ); |
253 | check_assist_not_applicable( | 253 | check_assist_not_applicable( |
254 | fix_visibility, | 254 | fix_visibility, |
255 | r"mod foo { pub enum Foo; } | 255 | r"mod foo { pub enum Foo; } |
256 | fn main() { foo::Foo<|> } ", | 256 | fn main() { foo::Foo$0 } ", |
257 | ); | 257 | ); |
258 | check_assist( | 258 | check_assist( |
259 | fix_visibility, | 259 | fix_visibility, |
260 | r"mod foo { union Foo; } | 260 | r"mod foo { union Foo; } |
261 | fn main() { foo::Foo<|> } ", | 261 | fn main() { foo::Foo$0 } ", |
262 | r"mod foo { $0pub(crate) union Foo; } | 262 | r"mod foo { $0pub(crate) union Foo; } |
263 | fn main() { foo::Foo } ", | 263 | fn main() { foo::Foo } ", |
264 | ); | 264 | ); |
265 | check_assist_not_applicable( | 265 | check_assist_not_applicable( |
266 | fix_visibility, | 266 | fix_visibility, |
267 | r"mod foo { pub union Foo; } | 267 | r"mod foo { pub union Foo; } |
268 | fn main() { foo::Foo<|> } ", | 268 | fn main() { foo::Foo$0 } ", |
269 | ); | 269 | ); |
270 | } | 270 | } |
271 | 271 | ||
@@ -276,7 +276,7 @@ mod tests { | |||
276 | r" | 276 | r" |
277 | //- /main.rs | 277 | //- /main.rs |
278 | mod foo; | 278 | mod foo; |
279 | fn main() { foo::Foo<|> } | 279 | fn main() { foo::Foo$0 } |
280 | 280 | ||
281 | //- /foo.rs | 281 | //- /foo.rs |
282 | struct Foo; | 282 | struct Foo; |
@@ -291,7 +291,7 @@ struct Foo; | |||
291 | check_assist( | 291 | check_assist( |
292 | fix_visibility, | 292 | fix_visibility, |
293 | r"mod foo { pub struct Foo { bar: (), } } | 293 | r"mod foo { pub struct Foo { bar: (), } } |
294 | fn main() { foo::Foo { <|>bar: () }; } ", | 294 | fn main() { foo::Foo { $0bar: () }; } ", |
295 | r"mod foo { pub struct Foo { $0pub(crate) bar: (), } } | 295 | r"mod foo { pub struct Foo { $0pub(crate) bar: (), } } |
296 | fn main() { foo::Foo { bar: () }; } ", | 296 | fn main() { foo::Foo { bar: () }; } ", |
297 | ); | 297 | ); |
@@ -300,7 +300,7 @@ struct Foo; | |||
300 | r" | 300 | r" |
301 | //- /lib.rs | 301 | //- /lib.rs |
302 | mod foo; | 302 | mod foo; |
303 | fn main() { foo::Foo { <|>bar: () }; } | 303 | fn main() { foo::Foo { $0bar: () }; } |
304 | //- /foo.rs | 304 | //- /foo.rs |
305 | pub struct Foo { bar: () } | 305 | pub struct Foo { bar: () } |
306 | ", | 306 | ", |
@@ -310,14 +310,14 @@ pub struct Foo { bar: () } | |||
310 | check_assist_not_applicable( | 310 | check_assist_not_applicable( |
311 | fix_visibility, | 311 | fix_visibility, |
312 | r"mod foo { pub struct Foo { pub bar: (), } } | 312 | r"mod foo { pub struct Foo { pub bar: (), } } |
313 | fn main() { foo::Foo { <|>bar: () }; } ", | 313 | fn main() { foo::Foo { $0bar: () }; } ", |
314 | ); | 314 | ); |
315 | check_assist_not_applicable( | 315 | check_assist_not_applicable( |
316 | fix_visibility, | 316 | fix_visibility, |
317 | r" | 317 | r" |
318 | //- /lib.rs | 318 | //- /lib.rs |
319 | mod foo; | 319 | mod foo; |
320 | fn main() { foo::Foo { <|>bar: () }; } | 320 | fn main() { foo::Foo { $0bar: () }; } |
321 | //- /foo.rs | 321 | //- /foo.rs |
322 | pub struct Foo { pub bar: () } | 322 | pub struct Foo { pub bar: () } |
323 | ", | 323 | ", |
@@ -331,14 +331,14 @@ pub struct Foo { pub bar: () } | |||
331 | check_assist_not_applicable( | 331 | check_assist_not_applicable( |
332 | fix_visibility, | 332 | fix_visibility, |
333 | r"mod foo { pub enum Foo { Bar { bar: () } } } | 333 | r"mod foo { pub enum Foo { Bar { bar: () } } } |
334 | fn main() { foo::Foo::Bar { <|>bar: () }; } ", | 334 | fn main() { foo::Foo::Bar { $0bar: () }; } ", |
335 | ); | 335 | ); |
336 | check_assist_not_applicable( | 336 | check_assist_not_applicable( |
337 | fix_visibility, | 337 | fix_visibility, |
338 | r" | 338 | r" |
339 | //- /lib.rs | 339 | //- /lib.rs |
340 | mod foo; | 340 | mod foo; |
341 | fn main() { foo::Foo::Bar { <|>bar: () }; } | 341 | fn main() { foo::Foo::Bar { $0bar: () }; } |
342 | //- /foo.rs | 342 | //- /foo.rs |
343 | pub enum Foo { Bar { bar: () } } | 343 | pub enum Foo { Bar { bar: () } } |
344 | ", | 344 | ", |
@@ -346,14 +346,14 @@ pub enum Foo { Bar { bar: () } } | |||
346 | check_assist_not_applicable( | 346 | check_assist_not_applicable( |
347 | fix_visibility, | 347 | fix_visibility, |
348 | r"mod foo { pub struct Foo { pub bar: (), } } | 348 | r"mod foo { pub struct Foo { pub bar: (), } } |
349 | fn main() { foo::Foo { <|>bar: () }; } ", | 349 | fn main() { foo::Foo { $0bar: () }; } ", |
350 | ); | 350 | ); |
351 | check_assist_not_applicable( | 351 | check_assist_not_applicable( |
352 | fix_visibility, | 352 | fix_visibility, |
353 | r" | 353 | r" |
354 | //- /lib.rs | 354 | //- /lib.rs |
355 | mod foo; | 355 | mod foo; |
356 | fn main() { foo::Foo { <|>bar: () }; } | 356 | fn main() { foo::Foo { $0bar: () }; } |
357 | //- /foo.rs | 357 | //- /foo.rs |
358 | pub struct Foo { pub bar: () } | 358 | pub struct Foo { pub bar: () } |
359 | ", | 359 | ", |
@@ -367,7 +367,7 @@ pub struct Foo { pub bar: () } | |||
367 | check_assist( | 367 | check_assist( |
368 | fix_visibility, | 368 | fix_visibility, |
369 | r"mod foo { pub union Foo { bar: (), } } | 369 | r"mod foo { pub union Foo { bar: (), } } |
370 | fn main() { foo::Foo { <|>bar: () }; } ", | 370 | fn main() { foo::Foo { $0bar: () }; } ", |
371 | r"mod foo { pub union Foo { $0pub(crate) bar: (), } } | 371 | r"mod foo { pub union Foo { $0pub(crate) bar: (), } } |
372 | fn main() { foo::Foo { bar: () }; } ", | 372 | fn main() { foo::Foo { bar: () }; } ", |
373 | ); | 373 | ); |
@@ -376,7 +376,7 @@ pub struct Foo { pub bar: () } | |||
376 | r" | 376 | r" |
377 | //- /lib.rs | 377 | //- /lib.rs |
378 | mod foo; | 378 | mod foo; |
379 | fn main() { foo::Foo { <|>bar: () }; } | 379 | fn main() { foo::Foo { $0bar: () }; } |
380 | //- /foo.rs | 380 | //- /foo.rs |
381 | pub union Foo { bar: () } | 381 | pub union Foo { bar: () } |
382 | ", | 382 | ", |
@@ -386,14 +386,14 @@ pub union Foo { bar: () } | |||
386 | check_assist_not_applicable( | 386 | check_assist_not_applicable( |
387 | fix_visibility, | 387 | fix_visibility, |
388 | r"mod foo { pub union Foo { pub bar: (), } } | 388 | r"mod foo { pub union Foo { pub bar: (), } } |
389 | fn main() { foo::Foo { <|>bar: () }; } ", | 389 | fn main() { foo::Foo { $0bar: () }; } ", |
390 | ); | 390 | ); |
391 | check_assist_not_applicable( | 391 | check_assist_not_applicable( |
392 | fix_visibility, | 392 | fix_visibility, |
393 | r" | 393 | r" |
394 | //- /lib.rs | 394 | //- /lib.rs |
395 | mod foo; | 395 | mod foo; |
396 | fn main() { foo::Foo { <|>bar: () }; } | 396 | fn main() { foo::Foo { $0bar: () }; } |
397 | //- /foo.rs | 397 | //- /foo.rs |
398 | pub union Foo { pub bar: () } | 398 | pub union Foo { pub bar: () } |
399 | ", | 399 | ", |
@@ -405,14 +405,14 @@ pub union Foo { pub bar: () } | |||
405 | check_assist( | 405 | check_assist( |
406 | fix_visibility, | 406 | fix_visibility, |
407 | r"mod foo { const FOO: () = (); } | 407 | r"mod foo { const FOO: () = (); } |
408 | fn main() { foo::FOO<|> } ", | 408 | fn main() { foo::FOO$0 } ", |
409 | r"mod foo { $0pub(crate) const FOO: () = (); } | 409 | r"mod foo { $0pub(crate) const FOO: () = (); } |
410 | fn main() { foo::FOO } ", | 410 | fn main() { foo::FOO } ", |
411 | ); | 411 | ); |
412 | check_assist_not_applicable( | 412 | check_assist_not_applicable( |
413 | fix_visibility, | 413 | fix_visibility, |
414 | r"mod foo { pub const FOO: () = (); } | 414 | r"mod foo { pub const FOO: () = (); } |
415 | fn main() { foo::FOO<|> } ", | 415 | fn main() { foo::FOO$0 } ", |
416 | ); | 416 | ); |
417 | } | 417 | } |
418 | 418 | ||
@@ -421,14 +421,14 @@ pub union Foo { pub bar: () } | |||
421 | check_assist( | 421 | check_assist( |
422 | fix_visibility, | 422 | fix_visibility, |
423 | r"mod foo { static FOO: () = (); } | 423 | r"mod foo { static FOO: () = (); } |
424 | fn main() { foo::FOO<|> } ", | 424 | fn main() { foo::FOO$0 } ", |
425 | r"mod foo { $0pub(crate) static FOO: () = (); } | 425 | r"mod foo { $0pub(crate) static FOO: () = (); } |
426 | fn main() { foo::FOO } ", | 426 | fn main() { foo::FOO } ", |
427 | ); | 427 | ); |
428 | check_assist_not_applicable( | 428 | check_assist_not_applicable( |
429 | fix_visibility, | 429 | fix_visibility, |
430 | r"mod foo { pub static FOO: () = (); } | 430 | r"mod foo { pub static FOO: () = (); } |
431 | fn main() { foo::FOO<|> } ", | 431 | fn main() { foo::FOO$0 } ", |
432 | ); | 432 | ); |
433 | } | 433 | } |
434 | 434 | ||
@@ -437,14 +437,14 @@ pub union Foo { pub bar: () } | |||
437 | check_assist( | 437 | check_assist( |
438 | fix_visibility, | 438 | fix_visibility, |
439 | r"mod foo { trait Foo { fn foo(&self) {} } } | 439 | r"mod foo { trait Foo { fn foo(&self) {} } } |
440 | fn main() { let x: &dyn foo::<|>Foo; } ", | 440 | fn main() { let x: &dyn foo::$0Foo; } ", |
441 | r"mod foo { $0pub(crate) trait Foo { fn foo(&self) {} } } | 441 | r"mod foo { $0pub(crate) trait Foo { fn foo(&self) {} } } |
442 | fn main() { let x: &dyn foo::Foo; } ", | 442 | fn main() { let x: &dyn foo::Foo; } ", |
443 | ); | 443 | ); |
444 | check_assist_not_applicable( | 444 | check_assist_not_applicable( |
445 | fix_visibility, | 445 | fix_visibility, |
446 | r"mod foo { pub trait Foo { fn foo(&self) {} } } | 446 | r"mod foo { pub trait Foo { fn foo(&self) {} } } |
447 | fn main() { let x: &dyn foo::Foo<|>; } ", | 447 | fn main() { let x: &dyn foo::Foo$0; } ", |
448 | ); | 448 | ); |
449 | } | 449 | } |
450 | 450 | ||
@@ -453,14 +453,14 @@ pub union Foo { pub bar: () } | |||
453 | check_assist( | 453 | check_assist( |
454 | fix_visibility, | 454 | fix_visibility, |
455 | r"mod foo { type Foo = (); } | 455 | r"mod foo { type Foo = (); } |
456 | fn main() { let x: foo::Foo<|>; } ", | 456 | fn main() { let x: foo::Foo$0; } ", |
457 | r"mod foo { $0pub(crate) type Foo = (); } | 457 | r"mod foo { $0pub(crate) type Foo = (); } |
458 | fn main() { let x: foo::Foo; } ", | 458 | fn main() { let x: foo::Foo; } ", |
459 | ); | 459 | ); |
460 | check_assist_not_applicable( | 460 | check_assist_not_applicable( |
461 | fix_visibility, | 461 | fix_visibility, |
462 | r"mod foo { pub type Foo = (); } | 462 | r"mod foo { pub type Foo = (); } |
463 | fn main() { let x: foo::Foo<|>; } ", | 463 | fn main() { let x: foo::Foo$0; } ", |
464 | ); | 464 | ); |
465 | } | 465 | } |
466 | 466 | ||
@@ -469,7 +469,7 @@ pub union Foo { pub bar: () } | |||
469 | check_assist( | 469 | check_assist( |
470 | fix_visibility, | 470 | fix_visibility, |
471 | r"mod foo { mod bar { fn bar() {} } } | 471 | r"mod foo { mod bar { fn bar() {} } } |
472 | fn main() { foo::bar<|>::bar(); } ", | 472 | fn main() { foo::bar$0::bar(); } ", |
473 | r"mod foo { $0pub(crate) mod bar { fn bar() {} } } | 473 | r"mod foo { $0pub(crate) mod bar { fn bar() {} } } |
474 | fn main() { foo::bar::bar(); } ", | 474 | fn main() { foo::bar::bar(); } ", |
475 | ); | 475 | ); |
@@ -479,7 +479,7 @@ pub union Foo { pub bar: () } | |||
479 | r" | 479 | r" |
480 | //- /main.rs | 480 | //- /main.rs |
481 | mod foo; | 481 | mod foo; |
482 | fn main() { foo::bar<|>::baz(); } | 482 | fn main() { foo::bar$0::baz(); } |
483 | 483 | ||
484 | //- /foo.rs | 484 | //- /foo.rs |
485 | mod bar { | 485 | mod bar { |
@@ -495,7 +495,7 @@ mod bar { | |||
495 | check_assist_not_applicable( | 495 | check_assist_not_applicable( |
496 | fix_visibility, | 496 | fix_visibility, |
497 | r"mod foo { pub mod bar { pub fn bar() {} } } | 497 | r"mod foo { pub mod bar { pub fn bar() {} } } |
498 | fn main() { foo::bar<|>::bar(); } ", | 498 | fn main() { foo::bar$0::bar(); } ", |
499 | ); | 499 | ); |
500 | } | 500 | } |
501 | 501 | ||
@@ -506,7 +506,7 @@ mod bar { | |||
506 | r" | 506 | r" |
507 | //- /main.rs | 507 | //- /main.rs |
508 | mod foo; | 508 | mod foo; |
509 | fn main() { foo::bar<|>::baz(); } | 509 | fn main() { foo::bar$0::baz(); } |
510 | 510 | ||
511 | //- /foo.rs | 511 | //- /foo.rs |
512 | mod bar; | 512 | mod bar; |
@@ -525,7 +525,7 @@ pub fn baz() {} | |||
525 | r" | 525 | r" |
526 | //- /main.rs | 526 | //- /main.rs |
527 | mod foo; | 527 | mod foo; |
528 | fn main() { foo::bar<|>>::baz(); } | 528 | fn main() { foo::bar$0>::baz(); } |
529 | 529 | ||
530 | //- /foo.rs | 530 | //- /foo.rs |
531 | mod bar { | 531 | mod bar { |
@@ -545,7 +545,7 @@ mod bar { | |||
545 | fix_visibility, | 545 | fix_visibility, |
546 | r" | 546 | r" |
547 | //- /main.rs crate:a deps:foo | 547 | //- /main.rs crate:a deps:foo |
548 | foo::Bar<|> | 548 | foo::Bar$0 |
549 | //- /lib.rs crate:foo | 549 | //- /lib.rs crate:foo |
550 | struct Bar; | 550 | struct Bar; |
551 | ", | 551 | ", |
@@ -560,7 +560,7 @@ struct Bar; | |||
560 | fix_visibility, | 560 | fix_visibility, |
561 | r" | 561 | r" |
562 | //- /main.rs crate:a deps:foo | 562 | //- /main.rs crate:a deps:foo |
563 | foo::Bar<|> | 563 | foo::Bar$0 |
564 | //- /lib.rs crate:foo | 564 | //- /lib.rs crate:foo |
565 | pub(crate) struct Bar; | 565 | pub(crate) struct Bar; |
566 | ", | 566 | ", |
@@ -572,7 +572,7 @@ pub(crate) struct Bar; | |||
572 | r" | 572 | r" |
573 | //- /main.rs crate:a deps:foo | 573 | //- /main.rs crate:a deps:foo |
574 | fn main() { | 574 | fn main() { |
575 | foo::Foo { <|>bar: () }; | 575 | foo::Foo { $0bar: () }; |
576 | } | 576 | } |
577 | //- /lib.rs crate:foo | 577 | //- /lib.rs crate:foo |
578 | pub struct Foo { pub(crate) bar: () } | 578 | pub struct Foo { pub(crate) bar: () } |
@@ -593,7 +593,7 @@ pub struct Foo { pub(crate) bar: () } | |||
593 | use bar::Baz; | 593 | use bar::Baz; |
594 | mod bar { pub(super) struct Baz; } | 594 | mod bar { pub(super) struct Baz; } |
595 | } | 595 | } |
596 | foo::Baz<|> | 596 | foo::Baz$0 |
597 | ", | 597 | ", |
598 | r" | 598 | r" |
599 | mod foo { | 599 | mod foo { |
diff --git a/crates/assists/src/handlers/flip_binexpr.rs b/crates/assists/src/handlers/flip_binexpr.rs index 404f06133..209e5d43c 100644 --- a/crates/assists/src/handlers/flip_binexpr.rs +++ b/crates/assists/src/handlers/flip_binexpr.rs | |||
@@ -8,7 +8,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
8 | // | 8 | // |
9 | // ``` | 9 | // ``` |
10 | // fn main() { | 10 | // fn main() { |
11 | // let _ = 90 +<|> 2; | 11 | // let _ = 90 +$0 2; |
12 | // } | 12 | // } |
13 | // ``` | 13 | // ``` |
14 | // -> | 14 | // -> |
@@ -77,42 +77,34 @@ mod tests { | |||
77 | 77 | ||
78 | #[test] | 78 | #[test] |
79 | fn flip_binexpr_target_is_the_op() { | 79 | fn flip_binexpr_target_is_the_op() { |
80 | check_assist_target(flip_binexpr, "fn f() { let res = 1 ==<|> 2; }", "==") | 80 | check_assist_target(flip_binexpr, "fn f() { let res = 1 ==$0 2; }", "==") |
81 | } | 81 | } |
82 | 82 | ||
83 | #[test] | 83 | #[test] |
84 | fn flip_binexpr_not_applicable_for_assignment() { | 84 | fn flip_binexpr_not_applicable_for_assignment() { |
85 | check_assist_not_applicable(flip_binexpr, "fn f() { let mut _x = 1; _x +=<|> 2 }") | 85 | check_assist_not_applicable(flip_binexpr, "fn f() { let mut _x = 1; _x +=$0 2 }") |
86 | } | 86 | } |
87 | 87 | ||
88 | #[test] | 88 | #[test] |
89 | fn flip_binexpr_works_for_eq() { | 89 | fn flip_binexpr_works_for_eq() { |
90 | check_assist( | 90 | check_assist(flip_binexpr, "fn f() { let res = 1 ==$0 2; }", "fn f() { let res = 2 == 1; }") |
91 | flip_binexpr, | ||
92 | "fn f() { let res = 1 ==<|> 2; }", | ||
93 | "fn f() { let res = 2 == 1; }", | ||
94 | ) | ||
95 | } | 91 | } |
96 | 92 | ||
97 | #[test] | 93 | #[test] |
98 | fn flip_binexpr_works_for_gt() { | 94 | fn flip_binexpr_works_for_gt() { |
99 | check_assist(flip_binexpr, "fn f() { let res = 1 ><|> 2; }", "fn f() { let res = 2 < 1; }") | 95 | check_assist(flip_binexpr, "fn f() { let res = 1 >$0 2; }", "fn f() { let res = 2 < 1; }") |
100 | } | 96 | } |
101 | 97 | ||
102 | #[test] | 98 | #[test] |
103 | fn flip_binexpr_works_for_lteq() { | 99 | fn flip_binexpr_works_for_lteq() { |
104 | check_assist( | 100 | check_assist(flip_binexpr, "fn f() { let res = 1 <=$0 2; }", "fn f() { let res = 2 >= 1; }") |
105 | flip_binexpr, | ||
106 | "fn f() { let res = 1 <=<|> 2; }", | ||
107 | "fn f() { let res = 2 >= 1; }", | ||
108 | ) | ||
109 | } | 101 | } |
110 | 102 | ||
111 | #[test] | 103 | #[test] |
112 | fn flip_binexpr_works_for_complex_expr() { | 104 | fn flip_binexpr_works_for_complex_expr() { |
113 | check_assist( | 105 | check_assist( |
114 | flip_binexpr, | 106 | flip_binexpr, |
115 | "fn f() { let res = (1 + 1) ==<|> (2 + 2); }", | 107 | "fn f() { let res = (1 + 1) ==$0 (2 + 2); }", |
116 | "fn f() { let res = (2 + 2) == (1 + 1); }", | 108 | "fn f() { let res = (2 + 2) == (1 + 1); }", |
117 | ) | 109 | ) |
118 | } | 110 | } |
@@ -125,7 +117,7 @@ mod tests { | |||
125 | fn dyn_eq(&self, other: &dyn Diagnostic) -> bool { | 117 | fn dyn_eq(&self, other: &dyn Diagnostic) -> bool { |
126 | match other.downcast_ref::<Self>() { | 118 | match other.downcast_ref::<Self>() { |
127 | None => false, | 119 | None => false, |
128 | Some(it) => it ==<|> self, | 120 | Some(it) => it ==$0 self, |
129 | } | 121 | } |
130 | } | 122 | } |
131 | "#, | 123 | "#, |
diff --git a/crates/assists/src/handlers/flip_comma.rs b/crates/assists/src/handlers/flip_comma.rs index 64b4b1a76..a48b0e450 100644 --- a/crates/assists/src/handlers/flip_comma.rs +++ b/crates/assists/src/handlers/flip_comma.rs | |||
@@ -8,7 +8,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
8 | // | 8 | // |
9 | // ``` | 9 | // ``` |
10 | // fn main() { | 10 | // fn main() { |
11 | // ((1, 2),<|> (3, 4)); | 11 | // ((1, 2),$0 (3, 4)); |
12 | // } | 12 | // } |
13 | // ``` | 13 | // ``` |
14 | // -> | 14 | // -> |
@@ -49,14 +49,14 @@ mod tests { | |||
49 | fn flip_comma_works_for_function_parameters() { | 49 | fn flip_comma_works_for_function_parameters() { |
50 | check_assist( | 50 | check_assist( |
51 | flip_comma, | 51 | flip_comma, |
52 | "fn foo(x: i32,<|> y: Result<(), ()>) {}", | 52 | "fn foo(x: i32,$0 y: Result<(), ()>) {}", |
53 | "fn foo(y: Result<(), ()>, x: i32) {}", | 53 | "fn foo(y: Result<(), ()>, x: i32) {}", |
54 | ) | 54 | ) |
55 | } | 55 | } |
56 | 56 | ||
57 | #[test] | 57 | #[test] |
58 | fn flip_comma_target() { | 58 | fn flip_comma_target() { |
59 | check_assist_target(flip_comma, "fn foo(x: i32,<|> y: Result<(), ()>) {}", ",") | 59 | check_assist_target(flip_comma, "fn foo(x: i32,$0 y: Result<(), ()>) {}", ",") |
60 | } | 60 | } |
61 | 61 | ||
62 | #[test] | 62 | #[test] |
@@ -68,7 +68,7 @@ mod tests { | |||
68 | check_assist_target( | 68 | check_assist_target( |
69 | flip_comma, | 69 | flip_comma, |
70 | "pub enum Test { \ | 70 | "pub enum Test { \ |
71 | A,<|> \ | 71 | A,$0 \ |
72 | }", | 72 | }", |
73 | ",", | 73 | ",", |
74 | ); | 74 | ); |
@@ -76,7 +76,7 @@ mod tests { | |||
76 | check_assist_target( | 76 | check_assist_target( |
77 | flip_comma, | 77 | flip_comma, |
78 | "pub struct Test { \ | 78 | "pub struct Test { \ |
79 | foo: usize,<|> \ | 79 | foo: usize,$0 \ |
80 | }", | 80 | }", |
81 | ",", | 81 | ",", |
82 | ); | 82 | ); |
diff --git a/crates/assists/src/handlers/flip_trait_bound.rs b/crates/assists/src/handlers/flip_trait_bound.rs index 92ee42181..d419d263e 100644 --- a/crates/assists/src/handlers/flip_trait_bound.rs +++ b/crates/assists/src/handlers/flip_trait_bound.rs | |||
@@ -11,7 +11,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
11 | // Flips two trait bounds. | 11 | // Flips two trait bounds. |
12 | // | 12 | // |
13 | // ``` | 13 | // ``` |
14 | // fn foo<T: Clone +<|> Copy>() { } | 14 | // fn foo<T: Clone +$0 Copy>() { } |
15 | // ``` | 15 | // ``` |
16 | // -> | 16 | // -> |
17 | // ``` | 17 | // ``` |
@@ -52,19 +52,19 @@ mod tests { | |||
52 | 52 | ||
53 | #[test] | 53 | #[test] |
54 | fn flip_trait_bound_assist_available() { | 54 | fn flip_trait_bound_assist_available() { |
55 | check_assist_target(flip_trait_bound, "struct S<T> where T: A <|>+ B + C { }", "+") | 55 | check_assist_target(flip_trait_bound, "struct S<T> where T: A $0+ B + C { }", "+") |
56 | } | 56 | } |
57 | 57 | ||
58 | #[test] | 58 | #[test] |
59 | fn flip_trait_bound_not_applicable_for_single_trait_bound() { | 59 | fn flip_trait_bound_not_applicable_for_single_trait_bound() { |
60 | check_assist_not_applicable(flip_trait_bound, "struct S<T> where T: <|>A { }") | 60 | check_assist_not_applicable(flip_trait_bound, "struct S<T> where T: $0A { }") |
61 | } | 61 | } |
62 | 62 | ||
63 | #[test] | 63 | #[test] |
64 | fn flip_trait_bound_works_for_struct() { | 64 | fn flip_trait_bound_works_for_struct() { |
65 | check_assist( | 65 | check_assist( |
66 | flip_trait_bound, | 66 | flip_trait_bound, |
67 | "struct S<T> where T: A <|>+ B { }", | 67 | "struct S<T> where T: A $0+ B { }", |
68 | "struct S<T> where T: B + A { }", | 68 | "struct S<T> where T: B + A { }", |
69 | ) | 69 | ) |
70 | } | 70 | } |
@@ -73,21 +73,21 @@ mod tests { | |||
73 | fn flip_trait_bound_works_for_trait_impl() { | 73 | fn flip_trait_bound_works_for_trait_impl() { |
74 | check_assist( | 74 | check_assist( |
75 | flip_trait_bound, | 75 | flip_trait_bound, |
76 | "impl X for S<T> where T: A +<|> B { }", | 76 | "impl X for S<T> where T: A +$0 B { }", |
77 | "impl X for S<T> where T: B + A { }", | 77 | "impl X for S<T> where T: B + A { }", |
78 | ) | 78 | ) |
79 | } | 79 | } |
80 | 80 | ||
81 | #[test] | 81 | #[test] |
82 | fn flip_trait_bound_works_for_fn() { | 82 | fn flip_trait_bound_works_for_fn() { |
83 | check_assist(flip_trait_bound, "fn f<T: A <|>+ B>(t: T) { }", "fn f<T: B + A>(t: T) { }") | 83 | check_assist(flip_trait_bound, "fn f<T: A $0+ B>(t: T) { }", "fn f<T: B + A>(t: T) { }") |
84 | } | 84 | } |
85 | 85 | ||
86 | #[test] | 86 | #[test] |
87 | fn flip_trait_bound_works_for_fn_where_clause() { | 87 | fn flip_trait_bound_works_for_fn_where_clause() { |
88 | check_assist( | 88 | check_assist( |
89 | flip_trait_bound, | 89 | flip_trait_bound, |
90 | "fn f<T>(t: T) where T: A +<|> B { }", | 90 | "fn f<T>(t: T) where T: A +$0 B { }", |
91 | "fn f<T>(t: T) where T: B + A { }", | 91 | "fn f<T>(t: T) where T: B + A { }", |
92 | ) | 92 | ) |
93 | } | 93 | } |
@@ -96,7 +96,7 @@ mod tests { | |||
96 | fn flip_trait_bound_works_for_lifetime() { | 96 | fn flip_trait_bound_works_for_lifetime() { |
97 | check_assist( | 97 | check_assist( |
98 | flip_trait_bound, | 98 | flip_trait_bound, |
99 | "fn f<T>(t: T) where T: A <|>+ 'static { }", | 99 | "fn f<T>(t: T) where T: A $0+ 'static { }", |
100 | "fn f<T>(t: T) where T: 'static + A { }", | 100 | "fn f<T>(t: T) where T: 'static + A { }", |
101 | ) | 101 | ) |
102 | } | 102 | } |
@@ -105,7 +105,7 @@ mod tests { | |||
105 | fn flip_trait_bound_works_for_complex_bounds() { | 105 | fn flip_trait_bound_works_for_complex_bounds() { |
106 | check_assist( | 106 | check_assist( |
107 | flip_trait_bound, | 107 | flip_trait_bound, |
108 | "struct S<T> where T: A<T> <|>+ b_mod::B<T> + C<T> { }", | 108 | "struct S<T> where T: A<T> $0+ b_mod::B<T> + C<T> { }", |
109 | "struct S<T> where T: b_mod::B<T> + A<T> + C<T> { }", | 109 | "struct S<T> where T: b_mod::B<T> + A<T> + C<T> { }", |
110 | ) | 110 | ) |
111 | } | 111 | } |
@@ -114,7 +114,7 @@ mod tests { | |||
114 | fn flip_trait_bound_works_for_long_bounds() { | 114 | fn flip_trait_bound_works_for_long_bounds() { |
115 | check_assist( | 115 | check_assist( |
116 | flip_trait_bound, | 116 | flip_trait_bound, |
117 | "struct S<T> where T: A + B + C + D + E + F +<|> G + H + I + J { }", | 117 | "struct S<T> where T: A + B + C + D + E + F +$0 G + H + I + J { }", |
118 | "struct S<T> where T: A + B + C + D + E + G + F + H + I + J { }", | 118 | "struct S<T> where T: A + B + C + D + E + G + F + H + I + J { }", |
119 | ) | 119 | ) |
120 | } | 120 | } |
diff --git a/crates/assists/src/handlers/generate_default_from_enum_variant.rs b/crates/assists/src/handlers/generate_default_from_enum_variant.rs index bcea46735..6a2ab9596 100644 --- a/crates/assists/src/handlers/generate_default_from_enum_variant.rs +++ b/crates/assists/src/handlers/generate_default_from_enum_variant.rs | |||
@@ -12,7 +12,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
12 | // ``` | 12 | // ``` |
13 | // enum Version { | 13 | // enum Version { |
14 | // Undefined, | 14 | // Undefined, |
15 | // Minor<|>, | 15 | // Minor$0, |
16 | // Major, | 16 | // Major, |
17 | // } | 17 | // } |
18 | // ``` | 18 | // ``` |
@@ -108,7 +108,7 @@ mod tests { | |||
108 | r#" | 108 | r#" |
109 | enum Variant { | 109 | enum Variant { |
110 | Undefined, | 110 | Undefined, |
111 | Minor<|>, | 111 | Minor$0, |
112 | Major, | 112 | Major, |
113 | }"#, | 113 | }"#, |
114 | r#"enum Variant { | 114 | r#"enum Variant { |
@@ -132,7 +132,7 @@ impl Default for Variant { | |||
132 | r#" | 132 | r#" |
133 | enum Variant { | 133 | enum Variant { |
134 | Undefined, | 134 | Undefined, |
135 | Minor<|>, | 135 | Minor$0, |
136 | Major, | 136 | Major, |
137 | } | 137 | } |
138 | 138 | ||
@@ -151,7 +151,7 @@ impl Default for Variant { | |||
151 | r#" | 151 | r#" |
152 | enum Variant { | 152 | enum Variant { |
153 | Undefined, | 153 | Undefined, |
154 | Minor(u32)<|>, | 154 | Minor(u32)$0, |
155 | Major, | 155 | Major, |
156 | }"#, | 156 | }"#, |
157 | ); | 157 | ); |
@@ -161,7 +161,7 @@ enum Variant { | |||
161 | fn test_generate_default_from_variant_with_one_variant() { | 161 | fn test_generate_default_from_variant_with_one_variant() { |
162 | check_assist( | 162 | check_assist( |
163 | generate_default_from_enum_variant, | 163 | generate_default_from_enum_variant, |
164 | r#"enum Variant { Undefi<|>ned }"#, | 164 | r#"enum Variant { Undefi$0ned }"#, |
165 | r#" | 165 | r#" |
166 | enum Variant { Undefined } | 166 | enum Variant { Undefined } |
167 | 167 | ||
diff --git a/crates/assists/src/handlers/generate_derive.rs b/crates/assists/src/handlers/generate_derive.rs index 314504e15..f876b7684 100644 --- a/crates/assists/src/handlers/generate_derive.rs +++ b/crates/assists/src/handlers/generate_derive.rs | |||
@@ -13,7 +13,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
13 | // ``` | 13 | // ``` |
14 | // struct Point { | 14 | // struct Point { |
15 | // x: u32, | 15 | // x: u32, |
16 | // y: u32,<|> | 16 | // y: u32,$0 |
17 | // } | 17 | // } |
18 | // ``` | 18 | // ``` |
19 | // -> | 19 | // -> |
@@ -76,12 +76,12 @@ mod tests { | |||
76 | fn add_derive_new() { | 76 | fn add_derive_new() { |
77 | check_assist( | 77 | check_assist( |
78 | generate_derive, | 78 | generate_derive, |
79 | "struct Foo { a: i32, <|>}", | 79 | "struct Foo { a: i32, $0}", |
80 | "#[derive($0)]\nstruct Foo { a: i32, }", | 80 | "#[derive($0)]\nstruct Foo { a: i32, }", |
81 | ); | 81 | ); |
82 | check_assist( | 82 | check_assist( |
83 | generate_derive, | 83 | generate_derive, |
84 | "struct Foo { <|> a: i32, }", | 84 | "struct Foo { $0 a: i32, }", |
85 | "#[derive($0)]\nstruct Foo { a: i32, }", | 85 | "#[derive($0)]\nstruct Foo { a: i32, }", |
86 | ); | 86 | ); |
87 | } | 87 | } |
@@ -90,7 +90,7 @@ mod tests { | |||
90 | fn add_derive_existing() { | 90 | fn add_derive_existing() { |
91 | check_assist( | 91 | check_assist( |
92 | generate_derive, | 92 | generate_derive, |
93 | "#[derive(Clone)]\nstruct Foo { a: i32<|>, }", | 93 | "#[derive(Clone)]\nstruct Foo { a: i32$0, }", |
94 | "#[derive(Clone$0)]\nstruct Foo { a: i32, }", | 94 | "#[derive(Clone$0)]\nstruct Foo { a: i32, }", |
95 | ); | 95 | ); |
96 | } | 96 | } |
@@ -102,7 +102,7 @@ mod tests { | |||
102 | " | 102 | " |
103 | /// `Foo` is a pretty important struct. | 103 | /// `Foo` is a pretty important struct. |
104 | /// It does stuff. | 104 | /// It does stuff. |
105 | struct Foo { a: i32<|>, } | 105 | struct Foo { a: i32$0, } |
106 | ", | 106 | ", |
107 | " | 107 | " |
108 | /// `Foo` is a pretty important struct. | 108 | /// `Foo` is a pretty important struct. |
@@ -121,7 +121,7 @@ struct Foo { a: i32, } | |||
121 | struct SomeThingIrrelevant; | 121 | struct SomeThingIrrelevant; |
122 | /// `Foo` is a pretty important struct. | 122 | /// `Foo` is a pretty important struct. |
123 | /// It does stuff. | 123 | /// It does stuff. |
124 | struct Foo { a: i32<|>, } | 124 | struct Foo { a: i32$0, } |
125 | struct EvenMoreIrrelevant; | 125 | struct EvenMoreIrrelevant; |
126 | ", | 126 | ", |
127 | "/// `Foo` is a pretty important struct. | 127 | "/// `Foo` is a pretty important struct. |
diff --git a/crates/assists/src/handlers/generate_from_impl_for_enum.rs b/crates/assists/src/handlers/generate_from_impl_for_enum.rs index 3c374e5d9..d9af6ab11 100644 --- a/crates/assists/src/handlers/generate_from_impl_for_enum.rs +++ b/crates/assists/src/handlers/generate_from_impl_for_enum.rs | |||
@@ -10,7 +10,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
10 | // Adds a From impl for an enum variant with one tuple field. | 10 | // Adds a From impl for an enum variant with one tuple field. |
11 | // | 11 | // |
12 | // ``` | 12 | // ``` |
13 | // enum A { <|>One(u32) } | 13 | // enum A { $0One(u32) } |
14 | // ``` | 14 | // ``` |
15 | // -> | 15 | // -> |
16 | // ``` | 16 | // ``` |
@@ -101,7 +101,7 @@ mod tests { | |||
101 | fn test_generate_from_impl_for_enum() { | 101 | fn test_generate_from_impl_for_enum() { |
102 | check_assist( | 102 | check_assist( |
103 | generate_from_impl_for_enum, | 103 | generate_from_impl_for_enum, |
104 | "enum A { <|>One(u32) }", | 104 | "enum A { $0One(u32) }", |
105 | r#"enum A { One(u32) } | 105 | r#"enum A { One(u32) } |
106 | 106 | ||
107 | impl From<u32> for A { | 107 | impl From<u32> for A { |
@@ -116,7 +116,7 @@ impl From<u32> for A { | |||
116 | fn test_generate_from_impl_for_enum_complicated_path() { | 116 | fn test_generate_from_impl_for_enum_complicated_path() { |
117 | check_assist( | 117 | check_assist( |
118 | generate_from_impl_for_enum, | 118 | generate_from_impl_for_enum, |
119 | r#"enum A { <|>One(foo::bar::baz::Boo) }"#, | 119 | r#"enum A { $0One(foo::bar::baz::Boo) }"#, |
120 | r#"enum A { One(foo::bar::baz::Boo) } | 120 | r#"enum A { One(foo::bar::baz::Boo) } |
121 | 121 | ||
122 | impl From<foo::bar::baz::Boo> for A { | 122 | impl From<foo::bar::baz::Boo> for A { |
@@ -135,17 +135,17 @@ impl From<foo::bar::baz::Boo> for A { | |||
135 | 135 | ||
136 | #[test] | 136 | #[test] |
137 | fn test_add_from_impl_no_element() { | 137 | fn test_add_from_impl_no_element() { |
138 | check_not_applicable("enum A { <|>One }"); | 138 | check_not_applicable("enum A { $0One }"); |
139 | } | 139 | } |
140 | 140 | ||
141 | #[test] | 141 | #[test] |
142 | fn test_add_from_impl_more_than_one_element_in_tuple() { | 142 | fn test_add_from_impl_more_than_one_element_in_tuple() { |
143 | check_not_applicable("enum A { <|>One(u32, String) }"); | 143 | check_not_applicable("enum A { $0One(u32, String) }"); |
144 | } | 144 | } |
145 | 145 | ||
146 | #[test] | 146 | #[test] |
147 | fn test_add_from_impl_struct_variant() { | 147 | fn test_add_from_impl_struct_variant() { |
148 | check_not_applicable("enum A { <|>One { x: u32 } }"); | 148 | check_not_applicable("enum A { $0One { x: u32 } }"); |
149 | } | 149 | } |
150 | 150 | ||
151 | #[test] | 151 | #[test] |
@@ -153,7 +153,7 @@ impl From<foo::bar::baz::Boo> for A { | |||
153 | mark::check!(test_add_from_impl_already_exists); | 153 | mark::check!(test_add_from_impl_already_exists); |
154 | check_not_applicable( | 154 | check_not_applicable( |
155 | r#" | 155 | r#" |
156 | enum A { <|>One(u32), } | 156 | enum A { $0One(u32), } |
157 | 157 | ||
158 | impl From<u32> for A { | 158 | impl From<u32> for A { |
159 | fn from(v: u32) -> Self { | 159 | fn from(v: u32) -> Self { |
@@ -168,7 +168,7 @@ impl From<u32> for A { | |||
168 | fn test_add_from_impl_different_variant_impl_exists() { | 168 | fn test_add_from_impl_different_variant_impl_exists() { |
169 | check_assist( | 169 | check_assist( |
170 | generate_from_impl_for_enum, | 170 | generate_from_impl_for_enum, |
171 | r#"enum A { <|>One(u32), Two(String), } | 171 | r#"enum A { $0One(u32), Two(String), } |
172 | 172 | ||
173 | impl From<String> for A { | 173 | impl From<String> for A { |
174 | fn from(v: String) -> Self { | 174 | fn from(v: String) -> Self { |
diff --git a/crates/assists/src/handlers/generate_function.rs b/crates/assists/src/handlers/generate_function.rs index d169abedb..06ac85f67 100644 --- a/crates/assists/src/handlers/generate_function.rs +++ b/crates/assists/src/handlers/generate_function.rs | |||
@@ -23,7 +23,7 @@ use crate::{ | |||
23 | // struct Baz; | 23 | // struct Baz; |
24 | // fn baz() -> Baz { Baz } | 24 | // fn baz() -> Baz { Baz } |
25 | // fn foo() { | 25 | // fn foo() { |
26 | // bar<|>("", baz()); | 26 | // bar$0("", baz()); |
27 | // } | 27 | // } |
28 | // | 28 | // |
29 | // ``` | 29 | // ``` |
@@ -342,7 +342,7 @@ mod tests { | |||
342 | generate_function, | 342 | generate_function, |
343 | r" | 343 | r" |
344 | fn foo() { | 344 | fn foo() { |
345 | bar<|>(); | 345 | bar$0(); |
346 | } | 346 | } |
347 | ", | 347 | ", |
348 | r" | 348 | r" |
@@ -366,7 +366,7 @@ fn bar() ${0:-> ()} { | |||
366 | r" | 366 | r" |
367 | impl Foo { | 367 | impl Foo { |
368 | fn foo() { | 368 | fn foo() { |
369 | bar<|>(); | 369 | bar$0(); |
370 | } | 370 | } |
371 | } | 371 | } |
372 | ", | 372 | ", |
@@ -391,7 +391,7 @@ fn bar() ${0:-> ()} { | |||
391 | generate_function, | 391 | generate_function, |
392 | r" | 392 | r" |
393 | fn foo1() { | 393 | fn foo1() { |
394 | bar<|>(); | 394 | bar$0(); |
395 | } | 395 | } |
396 | 396 | ||
397 | fn foo2() {} | 397 | fn foo2() {} |
@@ -417,7 +417,7 @@ fn foo2() {} | |||
417 | r" | 417 | r" |
418 | mod baz { | 418 | mod baz { |
419 | fn foo() { | 419 | fn foo() { |
420 | bar<|>(); | 420 | bar$0(); |
421 | } | 421 | } |
422 | } | 422 | } |
423 | ", | 423 | ", |
@@ -443,7 +443,7 @@ mod baz { | |||
443 | struct Baz; | 443 | struct Baz; |
444 | fn baz() -> Baz { todo!() } | 444 | fn baz() -> Baz { todo!() } |
445 | fn foo() { | 445 | fn foo() { |
446 | bar<|>(baz()); | 446 | bar$0(baz()); |
447 | } | 447 | } |
448 | ", | 448 | ", |
449 | r" | 449 | r" |
@@ -468,7 +468,7 @@ fn bar(baz: Baz) ${0:-> ()} { | |||
468 | struct Baz; | 468 | struct Baz; |
469 | impl Baz { | 469 | impl Baz { |
470 | fn foo(&self) -> Baz { | 470 | fn foo(&self) -> Baz { |
471 | ba<|>r(self.baz()) | 471 | ba$0r(self.baz()) |
472 | } | 472 | } |
473 | fn baz(&self) -> Baz { | 473 | fn baz(&self) -> Baz { |
474 | Baz | 474 | Baz |
@@ -499,7 +499,7 @@ fn bar(baz: Baz) ${0:-> ()} { | |||
499 | generate_function, | 499 | generate_function, |
500 | r#" | 500 | r#" |
501 | fn foo() { | 501 | fn foo() { |
502 | <|>bar("bar") | 502 | $0bar("bar") |
503 | } | 503 | } |
504 | "#, | 504 | "#, |
505 | r#" | 505 | r#" |
@@ -520,7 +520,7 @@ fn bar(arg: &str) ${0:-> ()} { | |||
520 | generate_function, | 520 | generate_function, |
521 | r#" | 521 | r#" |
522 | fn foo() { | 522 | fn foo() { |
523 | <|>bar('x') | 523 | $0bar('x') |
524 | } | 524 | } |
525 | "#, | 525 | "#, |
526 | r#" | 526 | r#" |
@@ -541,7 +541,7 @@ fn bar(arg: char) ${0:-> ()} { | |||
541 | generate_function, | 541 | generate_function, |
542 | r" | 542 | r" |
543 | fn foo() { | 543 | fn foo() { |
544 | <|>bar(42) | 544 | $0bar(42) |
545 | } | 545 | } |
546 | ", | 546 | ", |
547 | r" | 547 | r" |
@@ -562,7 +562,7 @@ fn bar(arg: i32) ${0:-> ()} { | |||
562 | generate_function, | 562 | generate_function, |
563 | r" | 563 | r" |
564 | fn foo() { | 564 | fn foo() { |
565 | <|>bar(42 as u8) | 565 | $0bar(42 as u8) |
566 | } | 566 | } |
567 | ", | 567 | ", |
568 | r" | 568 | r" |
@@ -586,7 +586,7 @@ fn bar(arg: u8) ${0:-> ()} { | |||
586 | r" | 586 | r" |
587 | fn foo() { | 587 | fn foo() { |
588 | let x = 42; | 588 | let x = 42; |
589 | bar<|>(x as u8) | 589 | bar$0(x as u8) |
590 | } | 590 | } |
591 | ", | 591 | ", |
592 | r" | 592 | r" |
@@ -609,7 +609,7 @@ fn bar(x: u8) ${0:-> ()} { | |||
609 | r" | 609 | r" |
610 | fn foo() { | 610 | fn foo() { |
611 | let worble = (); | 611 | let worble = (); |
612 | <|>bar(worble) | 612 | $0bar(worble) |
613 | } | 613 | } |
614 | ", | 614 | ", |
615 | r" | 615 | r" |
@@ -635,7 +635,7 @@ fn foo() -> impl Foo { | |||
635 | todo!() | 635 | todo!() |
636 | } | 636 | } |
637 | fn baz() { | 637 | fn baz() { |
638 | <|>bar(foo()) | 638 | $0bar(foo()) |
639 | } | 639 | } |
640 | ", | 640 | ", |
641 | r" | 641 | r" |
@@ -663,7 +663,7 @@ struct Baz; | |||
663 | fn baz() -> Baz { todo!() } | 663 | fn baz() -> Baz { todo!() } |
664 | 664 | ||
665 | fn foo() { | 665 | fn foo() { |
666 | bar<|>(&baz()) | 666 | bar$0(&baz()) |
667 | } | 667 | } |
668 | ", | 668 | ", |
669 | r" | 669 | r" |
@@ -691,7 +691,7 @@ mod Baz { | |||
691 | pub fn baz() -> Bof { Bof } | 691 | pub fn baz() -> Bof { Bof } |
692 | } | 692 | } |
693 | fn foo() { | 693 | fn foo() { |
694 | <|>bar(Baz::baz()) | 694 | $0bar(Baz::baz()) |
695 | } | 695 | } |
696 | ", | 696 | ", |
697 | r" | 697 | r" |
@@ -718,7 +718,7 @@ fn bar(baz: Baz::Bof) ${0:-> ()} { | |||
718 | generate_function, | 718 | generate_function, |
719 | r" | 719 | r" |
720 | fn foo<T>(t: T) { | 720 | fn foo<T>(t: T) { |
721 | <|>bar(t) | 721 | $0bar(t) |
722 | } | 722 | } |
723 | ", | 723 | ", |
724 | r" | 724 | r" |
@@ -745,7 +745,7 @@ impl Baz { | |||
745 | fn new() -> Self { Baz } | 745 | fn new() -> Self { Baz } |
746 | } | 746 | } |
747 | fn foo() { | 747 | fn foo() { |
748 | <|>bar(Baz::new); | 748 | $0bar(Baz::new); |
749 | } | 749 | } |
750 | ", | 750 | ", |
751 | r" | 751 | r" |
@@ -773,7 +773,7 @@ fn bar(arg: fn() -> Baz) ${0:-> ()} { | |||
773 | r" | 773 | r" |
774 | fn foo() { | 774 | fn foo() { |
775 | let closure = |x: i64| x - 1; | 775 | let closure = |x: i64| x - 1; |
776 | <|>bar(closure) | 776 | $0bar(closure) |
777 | } | 777 | } |
778 | ", | 778 | ", |
779 | r" | 779 | r" |
@@ -795,7 +795,7 @@ fn bar(closure: impl Fn(i64) -> i64) ${0:-> ()} { | |||
795 | generate_function, | 795 | generate_function, |
796 | r" | 796 | r" |
797 | fn foo() { | 797 | fn foo() { |
798 | <|>bar(baz) | 798 | $0bar(baz) |
799 | } | 799 | } |
800 | ", | 800 | ", |
801 | r" | 801 | r" |
@@ -818,7 +818,7 @@ fn bar(baz: ()) ${0:-> ()} { | |||
818 | struct Baz; | 818 | struct Baz; |
819 | fn baz() -> Baz { Baz } | 819 | fn baz() -> Baz { Baz } |
820 | fn foo() { | 820 | fn foo() { |
821 | <|>bar(baz(), baz()) | 821 | $0bar(baz(), baz()) |
822 | } | 822 | } |
823 | ", | 823 | ", |
824 | r" | 824 | r" |
@@ -843,7 +843,7 @@ fn bar(baz_1: Baz, baz_2: Baz) ${0:-> ()} { | |||
843 | struct Baz; | 843 | struct Baz; |
844 | fn baz() -> Baz { Baz } | 844 | fn baz() -> Baz { Baz } |
845 | fn foo() { | 845 | fn foo() { |
846 | <|>bar(baz(), baz(), "foo", "bar") | 846 | $0bar(baz(), baz(), "foo", "bar") |
847 | } | 847 | } |
848 | "#, | 848 | "#, |
849 | r#" | 849 | r#" |
@@ -868,7 +868,7 @@ fn bar(baz_1: Baz, baz_2: Baz, arg_1: &str, arg_2: &str) ${0:-> ()} { | |||
868 | mod bar {} | 868 | mod bar {} |
869 | 869 | ||
870 | fn foo() { | 870 | fn foo() { |
871 | bar::my_fn<|>() | 871 | bar::my_fn$0() |
872 | } | 872 | } |
873 | ", | 873 | ", |
874 | r" | 874 | r" |
@@ -899,7 +899,7 @@ mod foo { | |||
899 | fn bar() { | 899 | fn bar() { |
900 | use foo::Foo; | 900 | use foo::Foo; |
901 | let foo = Foo; | 901 | let foo = Foo; |
902 | baz<|>(foo) | 902 | baz$0(foo) |
903 | } | 903 | } |
904 | ", | 904 | ", |
905 | " | 905 | " |
@@ -929,7 +929,7 @@ mod bar { | |||
929 | } | 929 | } |
930 | 930 | ||
931 | fn foo() { | 931 | fn foo() { |
932 | bar::my_fn<|>() | 932 | bar::my_fn$0() |
933 | } | 933 | } |
934 | ", | 934 | ", |
935 | r" | 935 | r" |
@@ -958,7 +958,7 @@ mod bar { | |||
958 | } | 958 | } |
959 | 959 | ||
960 | fn foo() { | 960 | fn foo() { |
961 | bar::baz::my_fn<|>() | 961 | bar::baz::my_fn$0() |
962 | } | 962 | } |
963 | ", | 963 | ", |
964 | r" | 964 | r" |
@@ -986,7 +986,7 @@ fn foo() { | |||
986 | mod foo; | 986 | mod foo; |
987 | 987 | ||
988 | fn main() { | 988 | fn main() { |
989 | foo::bar<|>() | 989 | foo::bar$0() |
990 | } | 990 | } |
991 | //- /foo.rs | 991 | //- /foo.rs |
992 | ", | 992 | ", |
@@ -1005,7 +1005,7 @@ pub(crate) fn bar() ${0:-> ()} { | |||
1005 | generate_function, | 1005 | generate_function, |
1006 | r" | 1006 | r" |
1007 | fn foo() { | 1007 | fn foo() { |
1008 | bar<|>(); | 1008 | bar$0(); |
1009 | } | 1009 | } |
1010 | 1010 | ||
1011 | fn bar() {} | 1011 | fn bar() {} |
@@ -1022,7 +1022,7 @@ fn bar() {} | |||
1022 | generate_function, | 1022 | generate_function, |
1023 | r" | 1023 | r" |
1024 | fn foo() { | 1024 | fn foo() { |
1025 | bar(b<|>az); | 1025 | bar(b$0az); |
1026 | } | 1026 | } |
1027 | 1027 | ||
1028 | fn bar(baz: ()) {} | 1028 | fn bar(baz: ()) {} |
@@ -1039,7 +1039,7 @@ fn bar(baz: ()) {} | |||
1039 | struct Foo; | 1039 | struct Foo; |
1040 | impl Foo { | 1040 | impl Foo { |
1041 | fn foo(&self) { | 1041 | fn foo(&self) { |
1042 | self.bar()<|>; | 1042 | self.bar()$0; |
1043 | } | 1043 | } |
1044 | } | 1044 | } |
1045 | ", | 1045 | ", |
diff --git a/crates/assists/src/handlers/generate_impl.rs b/crates/assists/src/handlers/generate_impl.rs index 960af5ab3..9af45192b 100644 --- a/crates/assists/src/handlers/generate_impl.rs +++ b/crates/assists/src/handlers/generate_impl.rs | |||
@@ -10,7 +10,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
10 | // | 10 | // |
11 | // ``` | 11 | // ``` |
12 | // struct Ctx<T: Clone> { | 12 | // struct Ctx<T: Clone> { |
13 | // data: T,<|> | 13 | // data: T,$0 |
14 | // } | 14 | // } |
15 | // ``` | 15 | // ``` |
16 | // -> | 16 | // -> |
@@ -87,24 +87,24 @@ mod tests { | |||
87 | fn test_add_impl() { | 87 | fn test_add_impl() { |
88 | check_assist( | 88 | check_assist( |
89 | generate_impl, | 89 | generate_impl, |
90 | "struct Foo {<|>}\n", | 90 | "struct Foo {$0}\n", |
91 | "struct Foo {}\n\nimpl Foo {\n $0\n}\n", | 91 | "struct Foo {}\n\nimpl Foo {\n $0\n}\n", |
92 | ); | 92 | ); |
93 | check_assist( | 93 | check_assist( |
94 | generate_impl, | 94 | generate_impl, |
95 | "struct Foo<T: Clone> {<|>}", | 95 | "struct Foo<T: Clone> {$0}", |
96 | "struct Foo<T: Clone> {}\n\nimpl<T: Clone> Foo<T> {\n $0\n}", | 96 | "struct Foo<T: Clone> {}\n\nimpl<T: Clone> Foo<T> {\n $0\n}", |
97 | ); | 97 | ); |
98 | check_assist( | 98 | check_assist( |
99 | generate_impl, | 99 | generate_impl, |
100 | "struct Foo<'a, T: Foo<'a>> {<|>}", | 100 | "struct Foo<'a, T: Foo<'a>> {$0}", |
101 | "struct Foo<'a, T: Foo<'a>> {}\n\nimpl<'a, T: Foo<'a>> Foo<'a, T> {\n $0\n}", | 101 | "struct Foo<'a, T: Foo<'a>> {}\n\nimpl<'a, T: Foo<'a>> Foo<'a, T> {\n $0\n}", |
102 | ); | 102 | ); |
103 | check_assist( | 103 | check_assist( |
104 | generate_impl, | 104 | generate_impl, |
105 | r#" | 105 | r#" |
106 | #[cfg(feature = "foo")] | 106 | #[cfg(feature = "foo")] |
107 | struct Foo<'a, T: Foo<'a>> {<|>}"#, | 107 | struct Foo<'a, T: Foo<'a>> {$0}"#, |
108 | r#" | 108 | r#" |
109 | #[cfg(feature = "foo")] | 109 | #[cfg(feature = "foo")] |
110 | struct Foo<'a, T: Foo<'a>> {} | 110 | struct Foo<'a, T: Foo<'a>> {} |
@@ -119,7 +119,7 @@ mod tests { | |||
119 | generate_impl, | 119 | generate_impl, |
120 | r#" | 120 | r#" |
121 | #[cfg(not(feature = "foo"))] | 121 | #[cfg(not(feature = "foo"))] |
122 | struct Foo<'a, T: Foo<'a>> {<|>}"#, | 122 | struct Foo<'a, T: Foo<'a>> {$0}"#, |
123 | r#" | 123 | r#" |
124 | #[cfg(not(feature = "foo"))] | 124 | #[cfg(not(feature = "foo"))] |
125 | struct Foo<'a, T: Foo<'a>> {} | 125 | struct Foo<'a, T: Foo<'a>> {} |
@@ -138,7 +138,7 @@ mod tests { | |||
138 | " | 138 | " |
139 | struct SomeThingIrrelevant; | 139 | struct SomeThingIrrelevant; |
140 | /// Has a lifetime parameter | 140 | /// Has a lifetime parameter |
141 | struct Foo<'a, T: Foo<'a>> {<|>} | 141 | struct Foo<'a, T: Foo<'a>> {$0} |
142 | struct EvenMoreIrrelevant; | 142 | struct EvenMoreIrrelevant; |
143 | ", | 143 | ", |
144 | "/// Has a lifetime parameter | 144 | "/// Has a lifetime parameter |
diff --git a/crates/assists/src/handlers/generate_new.rs b/crates/assists/src/handlers/generate_new.rs index c5fec4e0a..5c52b2bc8 100644 --- a/crates/assists/src/handlers/generate_new.rs +++ b/crates/assists/src/handlers/generate_new.rs | |||
@@ -14,7 +14,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
14 | // | 14 | // |
15 | // ``` | 15 | // ``` |
16 | // struct Ctx<T: Clone> { | 16 | // struct Ctx<T: Clone> { |
17 | // data: T,<|> | 17 | // data: T,$0 |
18 | // } | 18 | // } |
19 | // ``` | 19 | // ``` |
20 | // -> | 20 | // -> |
@@ -182,7 +182,7 @@ mod tests { | |||
182 | // Check output of generation | 182 | // Check output of generation |
183 | check_assist( | 183 | check_assist( |
184 | generate_new, | 184 | generate_new, |
185 | "struct Foo {<|>}", | 185 | "struct Foo {$0}", |
186 | "struct Foo {} | 186 | "struct Foo {} |
187 | 187 | ||
188 | impl Foo { | 188 | impl Foo { |
@@ -192,7 +192,7 @@ impl Foo { | |||
192 | ); | 192 | ); |
193 | check_assist( | 193 | check_assist( |
194 | generate_new, | 194 | generate_new, |
195 | "struct Foo<T: Clone> {<|>}", | 195 | "struct Foo<T: Clone> {$0}", |
196 | "struct Foo<T: Clone> {} | 196 | "struct Foo<T: Clone> {} |
197 | 197 | ||
198 | impl<T: Clone> Foo<T> { | 198 | impl<T: Clone> Foo<T> { |
@@ -202,7 +202,7 @@ impl<T: Clone> Foo<T> { | |||
202 | ); | 202 | ); |
203 | check_assist( | 203 | check_assist( |
204 | generate_new, | 204 | generate_new, |
205 | "struct Foo<'a, T: Foo<'a>> {<|>}", | 205 | "struct Foo<'a, T: Foo<'a>> {$0}", |
206 | "struct Foo<'a, T: Foo<'a>> {} | 206 | "struct Foo<'a, T: Foo<'a>> {} |
207 | 207 | ||
208 | impl<'a, T: Foo<'a>> Foo<'a, T> { | 208 | impl<'a, T: Foo<'a>> Foo<'a, T> { |
@@ -212,7 +212,7 @@ impl<'a, T: Foo<'a>> Foo<'a, T> { | |||
212 | ); | 212 | ); |
213 | check_assist( | 213 | check_assist( |
214 | generate_new, | 214 | generate_new, |
215 | "struct Foo { baz: String <|>}", | 215 | "struct Foo { baz: String $0}", |
216 | "struct Foo { baz: String } | 216 | "struct Foo { baz: String } |
217 | 217 | ||
218 | impl Foo { | 218 | impl Foo { |
@@ -222,7 +222,7 @@ impl Foo { | |||
222 | ); | 222 | ); |
223 | check_assist( | 223 | check_assist( |
224 | generate_new, | 224 | generate_new, |
225 | "struct Foo { baz: String, qux: Vec<i32> <|>}", | 225 | "struct Foo { baz: String, qux: Vec<i32> $0}", |
226 | "struct Foo { baz: String, qux: Vec<i32> } | 226 | "struct Foo { baz: String, qux: Vec<i32> } |
227 | 227 | ||
228 | impl Foo { | 228 | impl Foo { |
@@ -234,7 +234,7 @@ impl Foo { | |||
234 | // Check that visibility modifiers don't get brought in for fields | 234 | // Check that visibility modifiers don't get brought in for fields |
235 | check_assist( | 235 | check_assist( |
236 | generate_new, | 236 | generate_new, |
237 | "struct Foo { pub baz: String, pub qux: Vec<i32> <|>}", | 237 | "struct Foo { pub baz: String, pub qux: Vec<i32> $0}", |
238 | "struct Foo { pub baz: String, pub qux: Vec<i32> } | 238 | "struct Foo { pub baz: String, pub qux: Vec<i32> } |
239 | 239 | ||
240 | impl Foo { | 240 | impl Foo { |
@@ -246,7 +246,7 @@ impl Foo { | |||
246 | // Check that it reuses existing impls | 246 | // Check that it reuses existing impls |
247 | check_assist( | 247 | check_assist( |
248 | generate_new, | 248 | generate_new, |
249 | "struct Foo {<|>} | 249 | "struct Foo {$0} |
250 | 250 | ||
251 | impl Foo {} | 251 | impl Foo {} |
252 | ", | 252 | ", |
@@ -259,7 +259,7 @@ impl Foo { | |||
259 | ); | 259 | ); |
260 | check_assist( | 260 | check_assist( |
261 | generate_new, | 261 | generate_new, |
262 | "struct Foo {<|>} | 262 | "struct Foo {$0} |
263 | 263 | ||
264 | impl Foo { | 264 | impl Foo { |
265 | fn qux(&self) {} | 265 | fn qux(&self) {} |
@@ -277,7 +277,7 @@ impl Foo { | |||
277 | 277 | ||
278 | check_assist( | 278 | check_assist( |
279 | generate_new, | 279 | generate_new, |
280 | "struct Foo {<|>} | 280 | "struct Foo {$0} |
281 | 281 | ||
282 | impl Foo { | 282 | impl Foo { |
283 | fn qux(&self) {} | 283 | fn qux(&self) {} |
@@ -302,7 +302,7 @@ impl Foo { | |||
302 | // Check visibility of new fn based on struct | 302 | // Check visibility of new fn based on struct |
303 | check_assist( | 303 | check_assist( |
304 | generate_new, | 304 | generate_new, |
305 | "pub struct Foo {<|>}", | 305 | "pub struct Foo {$0}", |
306 | "pub struct Foo {} | 306 | "pub struct Foo {} |
307 | 307 | ||
308 | impl Foo { | 308 | impl Foo { |
@@ -312,7 +312,7 @@ impl Foo { | |||
312 | ); | 312 | ); |
313 | check_assist( | 313 | check_assist( |
314 | generate_new, | 314 | generate_new, |
315 | "pub(crate) struct Foo {<|>}", | 315 | "pub(crate) struct Foo {$0}", |
316 | "pub(crate) struct Foo {} | 316 | "pub(crate) struct Foo {} |
317 | 317 | ||
318 | impl Foo { | 318 | impl Foo { |
@@ -327,7 +327,7 @@ impl Foo { | |||
327 | check_assist_not_applicable( | 327 | check_assist_not_applicable( |
328 | generate_new, | 328 | generate_new, |
329 | " | 329 | " |
330 | struct Foo {<|>} | 330 | struct Foo {$0} |
331 | 331 | ||
332 | impl Foo { | 332 | impl Foo { |
333 | fn new() -> Self { | 333 | fn new() -> Self { |
@@ -339,7 +339,7 @@ impl Foo { | |||
339 | check_assist_not_applicable( | 339 | check_assist_not_applicable( |
340 | generate_new, | 340 | generate_new, |
341 | " | 341 | " |
342 | struct Foo {<|>} | 342 | struct Foo {$0} |
343 | 343 | ||
344 | impl Foo { | 344 | impl Foo { |
345 | fn New() -> Self { | 345 | fn New() -> Self { |
@@ -356,7 +356,7 @@ impl Foo { | |||
356 | " | 356 | " |
357 | struct SomeThingIrrelevant; | 357 | struct SomeThingIrrelevant; |
358 | /// Has a lifetime parameter | 358 | /// Has a lifetime parameter |
359 | struct Foo<'a, T: Foo<'a>> {<|>} | 359 | struct Foo<'a, T: Foo<'a>> {$0} |
360 | struct EvenMoreIrrelevant; | 360 | struct EvenMoreIrrelevant; |
361 | ", | 361 | ", |
362 | "/// Has a lifetime parameter | 362 | "/// Has a lifetime parameter |
@@ -381,7 +381,7 @@ impl<N: AstNode> AstId<N> { | |||
381 | } | 381 | } |
382 | 382 | ||
383 | pub struct Source<T> { | 383 | pub struct Source<T> { |
384 | pub file_id: HirFileId,<|> | 384 | pub file_id: HirFileId,$0 |
385 | pub ast: T, | 385 | pub ast: T, |
386 | } | 386 | } |
387 | 387 | ||
diff --git a/crates/assists/src/handlers/infer_function_return_type.rs b/crates/assists/src/handlers/infer_function_return_type.rs index f499cdfdc..5279af1f3 100644 --- a/crates/assists/src/handlers/infer_function_return_type.rs +++ b/crates/assists/src/handlers/infer_function_return_type.rs | |||
@@ -10,7 +10,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
10 | // type specified. This assists is useable in a functions or closures tail expression or return type position. | 10 | // type specified. This assists is useable in a functions or closures tail expression or return type position. |
11 | // | 11 | // |
12 | // ``` | 12 | // ``` |
13 | // fn foo() { 4<|>2i32 } | 13 | // fn foo() { 4$02i32 } |
14 | // ``` | 14 | // ``` |
15 | // -> | 15 | // -> |
16 | // ``` | 16 | // ``` |
@@ -131,7 +131,7 @@ mod tests { | |||
131 | mark::check!(existing_infer_ret_type); | 131 | mark::check!(existing_infer_ret_type); |
132 | check_assist( | 132 | check_assist( |
133 | infer_function_return_type, | 133 | infer_function_return_type, |
134 | r#"fn foo() -> <|>_ { | 134 | r#"fn foo() -> $0_ { |
135 | 45 | 135 | 45 |
136 | }"#, | 136 | }"#, |
137 | r#"fn foo() -> i32 { | 137 | r#"fn foo() -> i32 { |
@@ -146,7 +146,7 @@ mod tests { | |||
146 | check_assist( | 146 | check_assist( |
147 | infer_function_return_type, | 147 | infer_function_return_type, |
148 | r#"fn foo() { | 148 | r#"fn foo() { |
149 | || -> _ {<|>45}; | 149 | || -> _ {$045}; |
150 | }"#, | 150 | }"#, |
151 | r#"fn foo() { | 151 | r#"fn foo() { |
152 | || -> i32 {45}; | 152 | || -> i32 {45}; |
@@ -159,7 +159,7 @@ mod tests { | |||
159 | mark::check!(cursor_in_ret_position); | 159 | mark::check!(cursor_in_ret_position); |
160 | check_assist( | 160 | check_assist( |
161 | infer_function_return_type, | 161 | infer_function_return_type, |
162 | r#"fn foo() <|>{ | 162 | r#"fn foo() $0{ |
163 | 45 | 163 | 45 |
164 | }"#, | 164 | }"#, |
165 | r#"fn foo() -> i32 { | 165 | r#"fn foo() -> i32 { |
@@ -174,7 +174,7 @@ mod tests { | |||
174 | check_assist( | 174 | check_assist( |
175 | infer_function_return_type, | 175 | infer_function_return_type, |
176 | r#"fn foo() { | 176 | r#"fn foo() { |
177 | || <|>45 | 177 | || $045 |
178 | }"#, | 178 | }"#, |
179 | r#"fn foo() { | 179 | r#"fn foo() { |
180 | || -> i32 {45} | 180 | || -> i32 {45} |
@@ -188,7 +188,7 @@ mod tests { | |||
188 | check_assist( | 188 | check_assist( |
189 | infer_function_return_type, | 189 | infer_function_return_type, |
190 | r#"fn foo() { | 190 | r#"fn foo() { |
191 | 45<|> | 191 | 45$0 |
192 | }"#, | 192 | }"#, |
193 | r#"fn foo() -> i32 { | 193 | r#"fn foo() -> i32 { |
194 | 45 | 194 | 45 |
@@ -202,7 +202,7 @@ mod tests { | |||
202 | infer_function_return_type, | 202 | infer_function_return_type, |
203 | r#"fn foo() { | 203 | r#"fn foo() { |
204 | if true { | 204 | if true { |
205 | 3<|> | 205 | 3$0 |
206 | } else { | 206 | } else { |
207 | 5 | 207 | 5 |
208 | } | 208 | } |
@@ -223,7 +223,7 @@ mod tests { | |||
223 | check_assist_not_applicable( | 223 | check_assist_not_applicable( |
224 | infer_function_return_type, | 224 | infer_function_return_type, |
225 | r#"fn foo() -> i32 { | 225 | r#"fn foo() -> i32 { |
226 | ( 45<|> + 32 ) * 123 | 226 | ( 45$0 + 32 ) * 123 |
227 | }"#, | 227 | }"#, |
228 | ); | 228 | ); |
229 | } | 229 | } |
@@ -233,7 +233,7 @@ mod tests { | |||
233 | check_assist_not_applicable( | 233 | check_assist_not_applicable( |
234 | infer_function_return_type, | 234 | infer_function_return_type, |
235 | r#"fn foo() { | 235 | r#"fn foo() { |
236 | let x = <|>3; | 236 | let x = $03; |
237 | ( 45 + 32 ) * 123 | 237 | ( 45 + 32 ) * 123 |
238 | }"#, | 238 | }"#, |
239 | ); | 239 | ); |
@@ -244,7 +244,7 @@ mod tests { | |||
244 | check_assist_not_applicable( | 244 | check_assist_not_applicable( |
245 | infer_function_return_type, | 245 | infer_function_return_type, |
246 | r#"fn foo() { | 246 | r#"fn foo() { |
247 | (<|>) | 247 | ($0) |
248 | }"#, | 248 | }"#, |
249 | ); | 249 | ); |
250 | } | 250 | } |
@@ -256,7 +256,7 @@ mod tests { | |||
256 | infer_function_return_type, | 256 | infer_function_return_type, |
257 | r#"fn foo() { | 257 | r#"fn foo() { |
258 | |x: i32| { | 258 | |x: i32| { |
259 | x<|> | 259 | x$0 |
260 | }; | 260 | }; |
261 | }"#, | 261 | }"#, |
262 | r#"fn foo() { | 262 | r#"fn foo() { |
@@ -272,7 +272,7 @@ mod tests { | |||
272 | check_assist( | 272 | check_assist( |
273 | infer_function_return_type, | 273 | infer_function_return_type, |
274 | r#"fn foo() { | 274 | r#"fn foo() { |
275 | |x: i32| { x<|> }; | 275 | |x: i32| { x$0 }; |
276 | }"#, | 276 | }"#, |
277 | r#"fn foo() { | 277 | r#"fn foo() { |
278 | |x: i32| -> i32 { x }; | 278 | |x: i32| -> i32 { x }; |
@@ -286,7 +286,7 @@ mod tests { | |||
286 | check_assist( | 286 | check_assist( |
287 | infer_function_return_type, | 287 | infer_function_return_type, |
288 | r#"fn foo() { | 288 | r#"fn foo() { |
289 | |x: i32| x<|>; | 289 | |x: i32| x$0; |
290 | }"#, | 290 | }"#, |
291 | r#"fn foo() { | 291 | r#"fn foo() { |
292 | |x: i32| -> i32 {x}; | 292 | |x: i32| -> i32 {x}; |
@@ -301,7 +301,7 @@ mod tests { | |||
301 | r#"fn foo() { | 301 | r#"fn foo() { |
302 | || { | 302 | || { |
303 | if true { | 303 | if true { |
304 | 3<|> | 304 | 3$0 |
305 | } else { | 305 | } else { |
306 | 5 | 306 | 5 |
307 | } | 307 | } |
@@ -325,7 +325,7 @@ mod tests { | |||
325 | check_assist_not_applicable( | 325 | check_assist_not_applicable( |
326 | infer_function_return_type, | 326 | infer_function_return_type, |
327 | r#"fn foo() { | 327 | r#"fn foo() { |
328 | || -> i32 { 3<|> } | 328 | || -> i32 { 3$0 } |
329 | }"#, | 329 | }"#, |
330 | ); | 330 | ); |
331 | } | 331 | } |
@@ -336,7 +336,7 @@ mod tests { | |||
336 | infer_function_return_type, | 336 | infer_function_return_type, |
337 | r#"fn foo() { | 337 | r#"fn foo() { |
338 | || -> i32 { | 338 | || -> i32 { |
339 | let x = 3<|>; | 339 | let x = 3$0; |
340 | 6 | 340 | 6 |
341 | } | 341 | } |
342 | }"#, | 342 | }"#, |
diff --git a/crates/assists/src/handlers/inline_function.rs b/crates/assists/src/handlers/inline_function.rs index 6e351bdcd..6ec99b09b 100644 --- a/crates/assists/src/handlers/inline_function.rs +++ b/crates/assists/src/handlers/inline_function.rs | |||
@@ -18,7 +18,7 @@ use crate::{ | |||
18 | // ``` | 18 | // ``` |
19 | // fn add(a: u32, b: u32) -> u32 { a + b } | 19 | // fn add(a: u32, b: u32) -> u32 { a + b } |
20 | // fn main() { | 20 | // fn main() { |
21 | // let x = add<|>(1, 2); | 21 | // let x = add$0(1, 2); |
22 | // } | 22 | // } |
23 | // ``` | 23 | // ``` |
24 | // -> | 24 | // -> |
@@ -104,7 +104,7 @@ mod tests { | |||
104 | r#" | 104 | r#" |
105 | fn foo() { println!("Hello, World!"); } | 105 | fn foo() { println!("Hello, World!"); } |
106 | fn main() { | 106 | fn main() { |
107 | fo<|>o(); | 107 | fo$0o(); |
108 | } | 108 | } |
109 | "#, | 109 | "#, |
110 | r#" | 110 | r#" |
@@ -125,7 +125,7 @@ fn main() { | |||
125 | r#" | 125 | r#" |
126 | fn foo(name: String) { println!("Hello, {}!", name); } | 126 | fn foo(name: String) { println!("Hello, {}!", name); } |
127 | fn main() { | 127 | fn main() { |
128 | foo<|>(String::from("Michael")); | 128 | foo$0(String::from("Michael")); |
129 | } | 129 | } |
130 | "#, | 130 | "#, |
131 | r#" | 131 | r#" |
@@ -148,7 +148,7 @@ fn main() { | |||
148 | struct Foo; | 148 | struct Foo; |
149 | impl Foo { fn bar(&self) {} } | 149 | impl Foo { fn bar(&self) {} } |
150 | 150 | ||
151 | fn main() { Foo.bar<|>(); } | 151 | fn main() { Foo.bar$0(); } |
152 | ", | 152 | ", |
153 | ); | 153 | ); |
154 | } | 154 | } |
@@ -160,7 +160,7 @@ fn main() { Foo.bar<|>(); } | |||
160 | inline_function, | 160 | inline_function, |
161 | r#" | 161 | r#" |
162 | fn add(a: u32, b: u32) -> u32 { a + b } | 162 | fn add(a: u32, b: u32) -> u32 { a + b } |
163 | fn main() { let x = add<|>(42); } | 163 | fn main() { let x = add$0(42); } |
164 | "#, | 164 | "#, |
165 | ); | 165 | ); |
166 | } | 166 | } |
@@ -177,7 +177,7 @@ fn foo(a: u32, b: u32) -> u32 { | |||
177 | } | 177 | } |
178 | 178 | ||
179 | fn main() { | 179 | fn main() { |
180 | let x = foo<|>(1, 2); | 180 | let x = foo$0(1, 2); |
181 | } | 181 | } |
182 | "#, | 182 | "#, |
183 | r#" | 183 | r#" |
diff --git a/crates/assists/src/handlers/inline_local_variable.rs b/crates/assists/src/handlers/inline_local_variable.rs index 587eb5feb..d559be9cb 100644 --- a/crates/assists/src/handlers/inline_local_variable.rs +++ b/crates/assists/src/handlers/inline_local_variable.rs | |||
@@ -16,7 +16,7 @@ use crate::{ | |||
16 | // | 16 | // |
17 | // ``` | 17 | // ``` |
18 | // fn main() { | 18 | // fn main() { |
19 | // let x<|> = 1 + 2; | 19 | // let x$0 = 1 + 2; |
20 | // x * 4; | 20 | // x * 4; |
21 | // } | 21 | // } |
22 | // ``` | 22 | // ``` |
@@ -146,7 +146,7 @@ mod tests { | |||
146 | r" | 146 | r" |
147 | fn bar(a: usize) {} | 147 | fn bar(a: usize) {} |
148 | fn foo() { | 148 | fn foo() { |
149 | let a<|> = 1; | 149 | let a$0 = 1; |
150 | a + 1; | 150 | a + 1; |
151 | if a > 10 { | 151 | if a > 10 { |
152 | } | 152 | } |
@@ -180,7 +180,7 @@ fn foo() { | |||
180 | r" | 180 | r" |
181 | fn bar(a: usize) {} | 181 | fn bar(a: usize) {} |
182 | fn foo() { | 182 | fn foo() { |
183 | let a<|> = 1 + 1; | 183 | let a$0 = 1 + 1; |
184 | a + 1; | 184 | a + 1; |
185 | if a > 10 { | 185 | if a > 10 { |
186 | } | 186 | } |
@@ -214,7 +214,7 @@ fn foo() { | |||
214 | r" | 214 | r" |
215 | fn bar(a: usize) {} | 215 | fn bar(a: usize) {} |
216 | fn foo() { | 216 | fn foo() { |
217 | let a<|> = bar(1); | 217 | let a$0 = bar(1); |
218 | a + 1; | 218 | a + 1; |
219 | if a > 10 { | 219 | if a > 10 { |
220 | } | 220 | } |
@@ -248,7 +248,7 @@ fn foo() { | |||
248 | r" | 248 | r" |
249 | fn bar(a: usize): usize { a } | 249 | fn bar(a: usize): usize { a } |
250 | fn foo() { | 250 | fn foo() { |
251 | let a<|> = bar(1) as u64; | 251 | let a$0 = bar(1) as u64; |
252 | a + 1; | 252 | a + 1; |
253 | if a > 10 { | 253 | if a > 10 { |
254 | } | 254 | } |
@@ -281,7 +281,7 @@ fn foo() { | |||
281 | inline_local_variable, | 281 | inline_local_variable, |
282 | r" | 282 | r" |
283 | fn foo() { | 283 | fn foo() { |
284 | let a<|> = { 10 + 1 }; | 284 | let a$0 = { 10 + 1 }; |
285 | a + 1; | 285 | a + 1; |
286 | if a > 10 { | 286 | if a > 10 { |
287 | } | 287 | } |
@@ -313,7 +313,7 @@ fn foo() { | |||
313 | inline_local_variable, | 313 | inline_local_variable, |
314 | r" | 314 | r" |
315 | fn foo() { | 315 | fn foo() { |
316 | let a<|> = ( 10 + 1 ); | 316 | let a$0 = ( 10 + 1 ); |
317 | a + 1; | 317 | a + 1; |
318 | if a > 10 { | 318 | if a > 10 { |
319 | } | 319 | } |
@@ -346,7 +346,7 @@ fn foo() { | |||
346 | inline_local_variable, | 346 | inline_local_variable, |
347 | r" | 347 | r" |
348 | fn foo() { | 348 | fn foo() { |
349 | let mut a<|> = 1 + 1; | 349 | let mut a$0 = 1 + 1; |
350 | a + 1; | 350 | a + 1; |
351 | }", | 351 | }", |
352 | ); | 352 | ); |
@@ -358,7 +358,7 @@ fn foo() { | |||
358 | inline_local_variable, | 358 | inline_local_variable, |
359 | r" | 359 | r" |
360 | fn foo() { | 360 | fn foo() { |
361 | let a<|> = bar(10 + 1); | 361 | let a$0 = bar(10 + 1); |
362 | let b = a * 10; | 362 | let b = a * 10; |
363 | let c = a as usize; | 363 | let c = a as usize; |
364 | }", | 364 | }", |
@@ -377,7 +377,7 @@ fn foo() { | |||
377 | r" | 377 | r" |
378 | fn foo() { | 378 | fn foo() { |
379 | let x = vec![1, 2, 3]; | 379 | let x = vec![1, 2, 3]; |
380 | let a<|> = x[0]; | 380 | let a$0 = x[0]; |
381 | let b = a * 10; | 381 | let b = a * 10; |
382 | let c = a as usize; | 382 | let c = a as usize; |
383 | }", | 383 | }", |
@@ -397,7 +397,7 @@ fn foo() { | |||
397 | r" | 397 | r" |
398 | fn foo() { | 398 | fn foo() { |
399 | let bar = vec![1]; | 399 | let bar = vec![1]; |
400 | let a<|> = bar.len(); | 400 | let a$0 = bar.len(); |
401 | let b = a * 10; | 401 | let b = a * 10; |
402 | let c = a as usize; | 402 | let c = a as usize; |
403 | }", | 403 | }", |
@@ -421,7 +421,7 @@ struct Bar { | |||
421 | 421 | ||
422 | fn foo() { | 422 | fn foo() { |
423 | let bar = Bar { foo: 1 }; | 423 | let bar = Bar { foo: 1 }; |
424 | let a<|> = bar.foo; | 424 | let a$0 = bar.foo; |
425 | let b = a * 10; | 425 | let b = a * 10; |
426 | let c = a as usize; | 426 | let c = a as usize; |
427 | }", | 427 | }", |
@@ -445,7 +445,7 @@ fn foo() { | |||
445 | r" | 445 | r" |
446 | fn foo() -> Option<usize> { | 446 | fn foo() -> Option<usize> { |
447 | let bar = Some(1); | 447 | let bar = Some(1); |
448 | let a<|> = bar?; | 448 | let a$0 = bar?; |
449 | let b = a * 10; | 449 | let b = a * 10; |
450 | let c = a as usize; | 450 | let c = a as usize; |
451 | None | 451 | None |
@@ -467,7 +467,7 @@ fn foo() -> Option<usize> { | |||
467 | r" | 467 | r" |
468 | fn foo() { | 468 | fn foo() { |
469 | let bar = 10; | 469 | let bar = 10; |
470 | let a<|> = &bar; | 470 | let a$0 = &bar; |
471 | let b = a * 10; | 471 | let b = a * 10; |
472 | }", | 472 | }", |
473 | r" | 473 | r" |
@@ -484,7 +484,7 @@ fn foo() { | |||
484 | inline_local_variable, | 484 | inline_local_variable, |
485 | r" | 485 | r" |
486 | fn foo() { | 486 | fn foo() { |
487 | let a<|> = (10, 20); | 487 | let a$0 = (10, 20); |
488 | let b = a[0]; | 488 | let b = a[0]; |
489 | }", | 489 | }", |
490 | r" | 490 | r" |
@@ -500,7 +500,7 @@ fn foo() { | |||
500 | inline_local_variable, | 500 | inline_local_variable, |
501 | r" | 501 | r" |
502 | fn foo() { | 502 | fn foo() { |
503 | let a<|> = [1, 2, 3]; | 503 | let a$0 = [1, 2, 3]; |
504 | let b = a.len(); | 504 | let b = a.len(); |
505 | }", | 505 | }", |
506 | r" | 506 | r" |
@@ -516,7 +516,7 @@ fn foo() { | |||
516 | inline_local_variable, | 516 | inline_local_variable, |
517 | r" | 517 | r" |
518 | fn foo() { | 518 | fn foo() { |
519 | let a<|> = (10 + 20); | 519 | let a$0 = (10 + 20); |
520 | let b = a * 10; | 520 | let b = a * 10; |
521 | let c = a as usize; | 521 | let c = a as usize; |
522 | }", | 522 | }", |
@@ -535,7 +535,7 @@ fn foo() { | |||
535 | r" | 535 | r" |
536 | fn foo() { | 536 | fn foo() { |
537 | let d = 10; | 537 | let d = 10; |
538 | let a<|> = d; | 538 | let a$0 = d; |
539 | let b = a * 10; | 539 | let b = a * 10; |
540 | let c = a as usize; | 540 | let c = a as usize; |
541 | }", | 541 | }", |
@@ -554,7 +554,7 @@ fn foo() { | |||
554 | inline_local_variable, | 554 | inline_local_variable, |
555 | r" | 555 | r" |
556 | fn foo() { | 556 | fn foo() { |
557 | let a<|> = { 10 }; | 557 | let a$0 = { 10 }; |
558 | let b = a * 10; | 558 | let b = a * 10; |
559 | let c = a as usize; | 559 | let c = a as usize; |
560 | }", | 560 | }", |
@@ -572,7 +572,7 @@ fn foo() { | |||
572 | inline_local_variable, | 572 | inline_local_variable, |
573 | r" | 573 | r" |
574 | fn foo() { | 574 | fn foo() { |
575 | let a<|> = 10 + 20; | 575 | let a$0 = 10 + 20; |
576 | let b = a * 10; | 576 | let b = a * 10; |
577 | let c = (a, 20); | 577 | let c = (a, 20); |
578 | let d = [a, 10]; | 578 | let d = [a, 10]; |
@@ -594,7 +594,7 @@ fn foo() { | |||
594 | inline_local_variable, | 594 | inline_local_variable, |
595 | r" | 595 | r" |
596 | fn foo() { | 596 | fn foo() { |
597 | let a<|> = vec![10, 20]; | 597 | let a$0 = vec![10, 20]; |
598 | for i in a {} | 598 | for i in a {} |
599 | }", | 599 | }", |
600 | r" | 600 | r" |
@@ -610,7 +610,7 @@ fn foo() { | |||
610 | inline_local_variable, | 610 | inline_local_variable, |
611 | r" | 611 | r" |
612 | fn foo() { | 612 | fn foo() { |
613 | let a<|> = 1 > 0; | 613 | let a$0 = 1 > 0; |
614 | while a {} | 614 | while a {} |
615 | }", | 615 | }", |
616 | r" | 616 | r" |
@@ -626,7 +626,7 @@ fn foo() { | |||
626 | inline_local_variable, | 626 | inline_local_variable, |
627 | r" | 627 | r" |
628 | fn foo() { | 628 | fn foo() { |
629 | let a<|> = 1 + 1; | 629 | let a$0 = 1 + 1; |
630 | loop { | 630 | loop { |
631 | break a; | 631 | break a; |
632 | } | 632 | } |
@@ -646,7 +646,7 @@ fn foo() { | |||
646 | inline_local_variable, | 646 | inline_local_variable, |
647 | r" | 647 | r" |
648 | fn foo() { | 648 | fn foo() { |
649 | let a<|> = 1 > 0; | 649 | let a$0 = 1 > 0; |
650 | return a; | 650 | return a; |
651 | }", | 651 | }", |
652 | r" | 652 | r" |
@@ -662,7 +662,7 @@ fn foo() { | |||
662 | inline_local_variable, | 662 | inline_local_variable, |
663 | r" | 663 | r" |
664 | fn foo() { | 664 | fn foo() { |
665 | let a<|> = 1 > 0; | 665 | let a$0 = 1 > 0; |
666 | match a {} | 666 | match a {} |
667 | }", | 667 | }", |
668 | r" | 668 | r" |
@@ -680,7 +680,7 @@ fn foo() { | |||
680 | r" | 680 | r" |
681 | struct S { foo: i32} | 681 | struct S { foo: i32} |
682 | fn main() { | 682 | fn main() { |
683 | let <|>foo = 92; | 683 | let $0foo = 92; |
684 | S { foo } | 684 | S { foo } |
685 | } | 685 | } |
686 | ", | 686 | ", |
@@ -700,7 +700,7 @@ fn main() { | |||
700 | inline_local_variable, | 700 | inline_local_variable, |
701 | r" | 701 | r" |
702 | fn foo() { | 702 | fn foo() { |
703 | let <|>a = 0; | 703 | let $0a = 0; |
704 | } | 704 | } |
705 | ", | 705 | ", |
706 | ) | 706 | ) |
@@ -713,7 +713,7 @@ fn foo() { | |||
713 | inline_local_variable, | 713 | inline_local_variable, |
714 | r" | 714 | r" |
715 | fn main() { | 715 | fn main() { |
716 | let x = <|>1 + 2; | 716 | let x = $01 + 2; |
717 | x * 4; | 717 | x * 4; |
718 | } | 718 | } |
719 | ", | 719 | ", |
diff --git a/crates/assists/src/handlers/introduce_named_lifetime.rs b/crates/assists/src/handlers/introduce_named_lifetime.rs index ab8fe3ea9..3f5f44d69 100644 --- a/crates/assists/src/handlers/introduce_named_lifetime.rs +++ b/crates/assists/src/handlers/introduce_named_lifetime.rs | |||
@@ -14,7 +14,7 @@ static ASSIST_LABEL: &str = "Introduce named lifetime"; | |||
14 | // Change an anonymous lifetime to a named lifetime. | 14 | // Change an anonymous lifetime to a named lifetime. |
15 | // | 15 | // |
16 | // ``` | 16 | // ``` |
17 | // impl Cursor<'_<|>> { | 17 | // impl Cursor<'_$0> { |
18 | // fn node(self) -> &SyntaxNode { | 18 | // fn node(self) -> &SyntaxNode { |
19 | // match self { | 19 | // match self { |
20 | // Cursor::Replace(node) | Cursor::Before(node) => node, | 20 | // Cursor::Replace(node) | Cursor::Before(node) => node, |
@@ -33,7 +33,7 @@ static ASSIST_LABEL: &str = "Introduce named lifetime"; | |||
33 | // } | 33 | // } |
34 | // ``` | 34 | // ``` |
35 | // FIXME: How can we handle renaming any one of multiple anonymous lifetimes? | 35 | // FIXME: How can we handle renaming any one of multiple anonymous lifetimes? |
36 | // FIXME: should also add support for the case fun(f: &Foo) -> &<|>Foo | 36 | // FIXME: should also add support for the case fun(f: &Foo) -> &$0Foo |
37 | pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | 37 | pub(crate) fn introduce_named_lifetime(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { |
38 | let lifetime = | 38 | let lifetime = |
39 | ctx.find_node_at_offset::<ast::Lifetime>().filter(|lifetime| lifetime.text() == "'_")?; | 39 | ctx.find_node_at_offset::<ast::Lifetime>().filter(|lifetime| lifetime.text() == "'_")?; |
@@ -150,7 +150,7 @@ mod tests { | |||
150 | fn test_example_case() { | 150 | fn test_example_case() { |
151 | check_assist( | 151 | check_assist( |
152 | introduce_named_lifetime, | 152 | introduce_named_lifetime, |
153 | r#"impl Cursor<'_<|>> { | 153 | r#"impl Cursor<'_$0> { |
154 | fn node(self) -> &SyntaxNode { | 154 | fn node(self) -> &SyntaxNode { |
155 | match self { | 155 | match self { |
156 | Cursor::Replace(node) | Cursor::Before(node) => node, | 156 | Cursor::Replace(node) | Cursor::Before(node) => node, |
@@ -171,7 +171,7 @@ mod tests { | |||
171 | fn test_example_case_simplified() { | 171 | fn test_example_case_simplified() { |
172 | check_assist( | 172 | check_assist( |
173 | introduce_named_lifetime, | 173 | introduce_named_lifetime, |
174 | r#"impl Cursor<'_<|>> {"#, | 174 | r#"impl Cursor<'_$0> {"#, |
175 | r#"impl<'a> Cursor<'a> {"#, | 175 | r#"impl<'a> Cursor<'a> {"#, |
176 | ); | 176 | ); |
177 | } | 177 | } |
@@ -180,7 +180,7 @@ mod tests { | |||
180 | fn test_example_case_cursor_after_tick() { | 180 | fn test_example_case_cursor_after_tick() { |
181 | check_assist( | 181 | check_assist( |
182 | introduce_named_lifetime, | 182 | introduce_named_lifetime, |
183 | r#"impl Cursor<'<|>_> {"#, | 183 | r#"impl Cursor<'$0_> {"#, |
184 | r#"impl<'a> Cursor<'a> {"#, | 184 | r#"impl<'a> Cursor<'a> {"#, |
185 | ); | 185 | ); |
186 | } | 186 | } |
@@ -189,7 +189,7 @@ mod tests { | |||
189 | fn test_impl_with_other_type_param() { | 189 | fn test_impl_with_other_type_param() { |
190 | check_assist( | 190 | check_assist( |
191 | introduce_named_lifetime, | 191 | introduce_named_lifetime, |
192 | "impl<I> fmt::Display for SepByBuilder<'_<|>, I> | 192 | "impl<I> fmt::Display for SepByBuilder<'_$0, I> |
193 | where | 193 | where |
194 | I: Iterator, | 194 | I: Iterator, |
195 | I::Item: fmt::Display, | 195 | I::Item: fmt::Display, |
@@ -206,28 +206,28 @@ mod tests { | |||
206 | fn test_example_case_cursor_before_tick() { | 206 | fn test_example_case_cursor_before_tick() { |
207 | check_assist( | 207 | check_assist( |
208 | introduce_named_lifetime, | 208 | introduce_named_lifetime, |
209 | r#"impl Cursor<<|>'_> {"#, | 209 | r#"impl Cursor<$0'_> {"#, |
210 | r#"impl<'a> Cursor<'a> {"#, | 210 | r#"impl<'a> Cursor<'a> {"#, |
211 | ); | 211 | ); |
212 | } | 212 | } |
213 | 213 | ||
214 | #[test] | 214 | #[test] |
215 | fn test_not_applicable_cursor_position() { | 215 | fn test_not_applicable_cursor_position() { |
216 | check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<'_><|> {"#); | 216 | check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<'_>$0 {"#); |
217 | check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<|><'_> {"#); | 217 | check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor$0<'_> {"#); |
218 | } | 218 | } |
219 | 219 | ||
220 | #[test] | 220 | #[test] |
221 | fn test_not_applicable_lifetime_already_name() { | 221 | fn test_not_applicable_lifetime_already_name() { |
222 | check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<'a<|>> {"#); | 222 | check_assist_not_applicable(introduce_named_lifetime, r#"impl Cursor<'a$0> {"#); |
223 | check_assist_not_applicable(introduce_named_lifetime, r#"fn my_fun<'a>() -> X<'a<|>>"#); | 223 | check_assist_not_applicable(introduce_named_lifetime, r#"fn my_fun<'a>() -> X<'a$0>"#); |
224 | } | 224 | } |
225 | 225 | ||
226 | #[test] | 226 | #[test] |
227 | fn test_with_type_parameter() { | 227 | fn test_with_type_parameter() { |
228 | check_assist( | 228 | check_assist( |
229 | introduce_named_lifetime, | 229 | introduce_named_lifetime, |
230 | r#"impl<T> Cursor<T, '_<|>>"#, | 230 | r#"impl<T> Cursor<T, '_$0>"#, |
231 | r#"impl<T, 'a> Cursor<T, 'a>"#, | 231 | r#"impl<T, 'a> Cursor<T, 'a>"#, |
232 | ); | 232 | ); |
233 | } | 233 | } |
@@ -236,7 +236,7 @@ mod tests { | |||
236 | fn test_with_existing_lifetime_name_conflict() { | 236 | fn test_with_existing_lifetime_name_conflict() { |
237 | check_assist( | 237 | check_assist( |
238 | introduce_named_lifetime, | 238 | introduce_named_lifetime, |
239 | r#"impl<'a, 'b> Cursor<'a, 'b, '_<|>>"#, | 239 | r#"impl<'a, 'b> Cursor<'a, 'b, '_$0>"#, |
240 | r#"impl<'a, 'b, 'c> Cursor<'a, 'b, 'c>"#, | 240 | r#"impl<'a, 'b, 'c> Cursor<'a, 'b, 'c>"#, |
241 | ); | 241 | ); |
242 | } | 242 | } |
@@ -245,7 +245,7 @@ mod tests { | |||
245 | fn test_function_return_value_anon_lifetime_param() { | 245 | fn test_function_return_value_anon_lifetime_param() { |
246 | check_assist( | 246 | check_assist( |
247 | introduce_named_lifetime, | 247 | introduce_named_lifetime, |
248 | r#"fn my_fun() -> X<'_<|>>"#, | 248 | r#"fn my_fun() -> X<'_$0>"#, |
249 | r#"fn my_fun<'a>() -> X<'a>"#, | 249 | r#"fn my_fun<'a>() -> X<'a>"#, |
250 | ); | 250 | ); |
251 | } | 251 | } |
@@ -254,7 +254,7 @@ mod tests { | |||
254 | fn test_function_return_value_anon_reference_lifetime() { | 254 | fn test_function_return_value_anon_reference_lifetime() { |
255 | check_assist( | 255 | check_assist( |
256 | introduce_named_lifetime, | 256 | introduce_named_lifetime, |
257 | r#"fn my_fun() -> &'_<|> X"#, | 257 | r#"fn my_fun() -> &'_$0 X"#, |
258 | r#"fn my_fun<'a>() -> &'a X"#, | 258 | r#"fn my_fun<'a>() -> &'a X"#, |
259 | ); | 259 | ); |
260 | } | 260 | } |
@@ -263,7 +263,7 @@ mod tests { | |||
263 | fn test_function_param_anon_lifetime() { | 263 | fn test_function_param_anon_lifetime() { |
264 | check_assist( | 264 | check_assist( |
265 | introduce_named_lifetime, | 265 | introduce_named_lifetime, |
266 | r#"fn my_fun(x: X<'_<|>>)"#, | 266 | r#"fn my_fun(x: X<'_$0>)"#, |
267 | r#"fn my_fun<'a>(x: X<'a>)"#, | 267 | r#"fn my_fun<'a>(x: X<'a>)"#, |
268 | ); | 268 | ); |
269 | } | 269 | } |
@@ -272,7 +272,7 @@ mod tests { | |||
272 | fn test_function_add_lifetime_to_params() { | 272 | fn test_function_add_lifetime_to_params() { |
273 | check_assist( | 273 | check_assist( |
274 | introduce_named_lifetime, | 274 | introduce_named_lifetime, |
275 | r#"fn my_fun(f: &Foo) -> X<'_<|>>"#, | 275 | r#"fn my_fun(f: &Foo) -> X<'_$0>"#, |
276 | r#"fn my_fun<'a>(f: &'a Foo) -> X<'a>"#, | 276 | r#"fn my_fun<'a>(f: &'a Foo) -> X<'a>"#, |
277 | ); | 277 | ); |
278 | } | 278 | } |
@@ -281,7 +281,7 @@ mod tests { | |||
281 | fn test_function_add_lifetime_to_params_in_presence_of_other_lifetime() { | 281 | fn test_function_add_lifetime_to_params_in_presence_of_other_lifetime() { |
282 | check_assist( | 282 | check_assist( |
283 | introduce_named_lifetime, | 283 | introduce_named_lifetime, |
284 | r#"fn my_fun<'other>(f: &Foo, b: &'other Bar) -> X<'_<|>>"#, | 284 | r#"fn my_fun<'other>(f: &Foo, b: &'other Bar) -> X<'_$0>"#, |
285 | r#"fn my_fun<'other, 'a>(f: &'a Foo, b: &'other Bar) -> X<'a>"#, | 285 | r#"fn my_fun<'other, 'a>(f: &'a Foo, b: &'other Bar) -> X<'a>"#, |
286 | ); | 286 | ); |
287 | } | 287 | } |
@@ -291,7 +291,7 @@ mod tests { | |||
291 | // this is not permitted under lifetime elision rules | 291 | // this is not permitted under lifetime elision rules |
292 | check_assist_not_applicable( | 292 | check_assist_not_applicable( |
293 | introduce_named_lifetime, | 293 | introduce_named_lifetime, |
294 | r#"fn my_fun(f: &Foo, b: &Bar) -> X<'_<|>>"#, | 294 | r#"fn my_fun(f: &Foo, b: &Bar) -> X<'_$0>"#, |
295 | ); | 295 | ); |
296 | } | 296 | } |
297 | 297 | ||
@@ -299,7 +299,7 @@ mod tests { | |||
299 | fn test_function_add_lifetime_to_self_ref_param() { | 299 | fn test_function_add_lifetime_to_self_ref_param() { |
300 | check_assist( | 300 | check_assist( |
301 | introduce_named_lifetime, | 301 | introduce_named_lifetime, |
302 | r#"fn my_fun<'other>(&self, f: &Foo, b: &'other Bar) -> X<'_<|>>"#, | 302 | r#"fn my_fun<'other>(&self, f: &Foo, b: &'other Bar) -> X<'_$0>"#, |
303 | r#"fn my_fun<'other, 'a>(&'a self, f: &Foo, b: &'other Bar) -> X<'a>"#, | 303 | r#"fn my_fun<'other, 'a>(&'a self, f: &Foo, b: &'other Bar) -> X<'a>"#, |
304 | ); | 304 | ); |
305 | } | 305 | } |
@@ -308,7 +308,7 @@ mod tests { | |||
308 | fn test_function_add_lifetime_to_param_with_non_ref_self() { | 308 | fn test_function_add_lifetime_to_param_with_non_ref_self() { |
309 | check_assist( | 309 | check_assist( |
310 | introduce_named_lifetime, | 310 | introduce_named_lifetime, |
311 | r#"fn my_fun<'other>(self, f: &Foo, b: &'other Bar) -> X<'_<|>>"#, | 311 | r#"fn my_fun<'other>(self, f: &Foo, b: &'other Bar) -> X<'_$0>"#, |
312 | r#"fn my_fun<'other, 'a>(self, f: &'a Foo, b: &'other Bar) -> X<'a>"#, | 312 | r#"fn my_fun<'other, 'a>(self, f: &'a Foo, b: &'other Bar) -> X<'a>"#, |
313 | ); | 313 | ); |
314 | } | 314 | } |
diff --git a/crates/assists/src/handlers/invert_if.rs b/crates/assists/src/handlers/invert_if.rs index f9c33b3f7..5b69dafd4 100644 --- a/crates/assists/src/handlers/invert_if.rs +++ b/crates/assists/src/handlers/invert_if.rs | |||
@@ -18,7 +18,7 @@ use crate::{ | |||
18 | // | 18 | // |
19 | // ``` | 19 | // ``` |
20 | // fn main() { | 20 | // fn main() { |
21 | // if<|> !y { A } else { B } | 21 | // if$0 !y { A } else { B } |
22 | // } | 22 | // } |
23 | // ``` | 23 | // ``` |
24 | // -> | 24 | // -> |
@@ -72,7 +72,7 @@ mod tests { | |||
72 | fn invert_if_composite_condition() { | 72 | fn invert_if_composite_condition() { |
73 | check_assist( | 73 | check_assist( |
74 | invert_if, | 74 | invert_if, |
75 | "fn f() { i<|>f x == 3 || x == 4 || x == 5 { 1 } else { 3 * 2 } }", | 75 | "fn f() { i$0f x == 3 || x == 4 || x == 5 { 1 } else { 3 * 2 } }", |
76 | "fn f() { if !(x == 3 || x == 4 || x == 5) { 3 * 2 } else { 1 } }", | 76 | "fn f() { if !(x == 3 || x == 4 || x == 5) { 3 * 2 } else { 1 } }", |
77 | ) | 77 | ) |
78 | } | 78 | } |
@@ -81,7 +81,7 @@ mod tests { | |||
81 | fn invert_if_remove_not_parentheses() { | 81 | fn invert_if_remove_not_parentheses() { |
82 | check_assist( | 82 | check_assist( |
83 | invert_if, | 83 | invert_if, |
84 | "fn f() { i<|>f !(x == 3 || x == 4 || x == 5) { 3 * 2 } else { 1 } }", | 84 | "fn f() { i$0f !(x == 3 || x == 4 || x == 5) { 3 * 2 } else { 1 } }", |
85 | "fn f() { if x == 3 || x == 4 || x == 5 { 1 } else { 3 * 2 } }", | 85 | "fn f() { if x == 3 || x == 4 || x == 5 { 1 } else { 3 * 2 } }", |
86 | ) | 86 | ) |
87 | } | 87 | } |
@@ -90,7 +90,7 @@ mod tests { | |||
90 | fn invert_if_remove_inequality() { | 90 | fn invert_if_remove_inequality() { |
91 | check_assist( | 91 | check_assist( |
92 | invert_if, | 92 | invert_if, |
93 | "fn f() { i<|>f x != 3 { 1 } else { 3 + 2 } }", | 93 | "fn f() { i$0f x != 3 { 1 } else { 3 + 2 } }", |
94 | "fn f() { if x == 3 { 3 + 2 } else { 1 } }", | 94 | "fn f() { if x == 3 { 3 + 2 } else { 1 } }", |
95 | ) | 95 | ) |
96 | } | 96 | } |
@@ -99,7 +99,7 @@ mod tests { | |||
99 | fn invert_if_remove_not() { | 99 | fn invert_if_remove_not() { |
100 | check_assist( | 100 | check_assist( |
101 | invert_if, | 101 | invert_if, |
102 | "fn f() { <|>if !cond { 3 * 2 } else { 1 } }", | 102 | "fn f() { $0if !cond { 3 * 2 } else { 1 } }", |
103 | "fn f() { if cond { 1 } else { 3 * 2 } }", | 103 | "fn f() { if cond { 1 } else { 3 * 2 } }", |
104 | ) | 104 | ) |
105 | } | 105 | } |
@@ -108,21 +108,21 @@ mod tests { | |||
108 | fn invert_if_general_case() { | 108 | fn invert_if_general_case() { |
109 | check_assist( | 109 | check_assist( |
110 | invert_if, | 110 | invert_if, |
111 | "fn f() { i<|>f cond { 3 * 2 } else { 1 } }", | 111 | "fn f() { i$0f cond { 3 * 2 } else { 1 } }", |
112 | "fn f() { if !cond { 1 } else { 3 * 2 } }", | 112 | "fn f() { if !cond { 1 } else { 3 * 2 } }", |
113 | ) | 113 | ) |
114 | } | 114 | } |
115 | 115 | ||
116 | #[test] | 116 | #[test] |
117 | fn invert_if_doesnt_apply_with_cursor_not_on_if() { | 117 | fn invert_if_doesnt_apply_with_cursor_not_on_if() { |
118 | check_assist_not_applicable(invert_if, "fn f() { if !<|>cond { 3 * 2 } else { 1 } }") | 118 | check_assist_not_applicable(invert_if, "fn f() { if !$0cond { 3 * 2 } else { 1 } }") |
119 | } | 119 | } |
120 | 120 | ||
121 | #[test] | 121 | #[test] |
122 | fn invert_if_doesnt_apply_with_if_let() { | 122 | fn invert_if_doesnt_apply_with_if_let() { |
123 | check_assist_not_applicable( | 123 | check_assist_not_applicable( |
124 | invert_if, | 124 | invert_if, |
125 | "fn f() { i<|>f let Some(_) = Some(1) { 1 } else { 0 } }", | 125 | "fn f() { i$0f let Some(_) = Some(1) { 1 } else { 0 } }", |
126 | ) | 126 | ) |
127 | } | 127 | } |
128 | 128 | ||
@@ -130,7 +130,7 @@ mod tests { | |||
130 | fn invert_if_option_case() { | 130 | fn invert_if_option_case() { |
131 | check_assist( | 131 | check_assist( |
132 | invert_if, | 132 | invert_if, |
133 | "fn f() { if<|> doc_style.is_some() { Class::DocComment } else { Class::Comment } }", | 133 | "fn f() { if$0 doc_style.is_some() { Class::DocComment } else { Class::Comment } }", |
134 | "fn f() { if doc_style.is_none() { Class::Comment } else { Class::DocComment } }", | 134 | "fn f() { if doc_style.is_none() { Class::Comment } else { Class::DocComment } }", |
135 | ) | 135 | ) |
136 | } | 136 | } |
@@ -139,7 +139,7 @@ mod tests { | |||
139 | fn invert_if_result_case() { | 139 | fn invert_if_result_case() { |
140 | check_assist( | 140 | check_assist( |
141 | invert_if, | 141 | invert_if, |
142 | "fn f() { i<|>f doc_style.is_err() { Class::Err } else { Class::Ok } }", | 142 | "fn f() { i$0f doc_style.is_err() { Class::Err } else { Class::Ok } }", |
143 | "fn f() { if doc_style.is_ok() { Class::Ok } else { Class::Err } }", | 143 | "fn f() { if doc_style.is_ok() { Class::Ok } else { Class::Err } }", |
144 | ) | 144 | ) |
145 | } | 145 | } |
diff --git a/crates/assists/src/handlers/merge_imports.rs b/crates/assists/src/handlers/merge_imports.rs index 2f0dc7831..7bd7e1e36 100644 --- a/crates/assists/src/handlers/merge_imports.rs +++ b/crates/assists/src/handlers/merge_imports.rs | |||
@@ -15,7 +15,7 @@ use crate::{ | |||
15 | // Merges two imports with a common prefix. | 15 | // Merges two imports with a common prefix. |
16 | // | 16 | // |
17 | // ``` | 17 | // ``` |
18 | // use std::<|>fmt::Formatter; | 18 | // use std::$0fmt::Formatter; |
19 | // use std::io; | 19 | // use std::io; |
20 | // ``` | 20 | // ``` |
21 | // -> | 21 | // -> |
@@ -75,7 +75,7 @@ mod tests { | |||
75 | check_assist( | 75 | check_assist( |
76 | merge_imports, | 76 | merge_imports, |
77 | r" | 77 | r" |
78 | use std::fmt<|>::{Display, Debug}; | 78 | use std::fmt$0::{Display, Debug}; |
79 | use std::fmt::{Display, Debug}; | 79 | use std::fmt::{Display, Debug}; |
80 | ", | 80 | ", |
81 | r" | 81 | r" |
@@ -89,7 +89,7 @@ use std::fmt::{Debug, Display}; | |||
89 | check_assist( | 89 | check_assist( |
90 | merge_imports, | 90 | merge_imports, |
91 | r" | 91 | r" |
92 | use std::fmt<|>::Debug; | 92 | use std::fmt$0::Debug; |
93 | use std::fmt::Display; | 93 | use std::fmt::Display; |
94 | ", | 94 | ", |
95 | r" | 95 | r" |
@@ -104,7 +104,7 @@ use std::fmt::{Debug, Display}; | |||
104 | merge_imports, | 104 | merge_imports, |
105 | r" | 105 | r" |
106 | use std::fmt::Debug; | 106 | use std::fmt::Debug; |
107 | use std::fmt<|>::Display; | 107 | use std::fmt$0::Display; |
108 | ", | 108 | ", |
109 | r" | 109 | r" |
110 | use std::fmt::{Debug, Display}; | 110 | use std::fmt::{Debug, Display}; |
@@ -117,7 +117,7 @@ use std::fmt::{Debug, Display}; | |||
117 | check_assist( | 117 | check_assist( |
118 | merge_imports, | 118 | merge_imports, |
119 | r" | 119 | r" |
120 | use std::fmt<|>; | 120 | use std::fmt$0; |
121 | use std::fmt::Display; | 121 | use std::fmt::Display; |
122 | ", | 122 | ", |
123 | r" | 123 | r" |
@@ -131,7 +131,7 @@ use std::fmt::{self, Display}; | |||
131 | check_assist( | 131 | check_assist( |
132 | merge_imports, | 132 | merge_imports, |
133 | r" | 133 | r" |
134 | use std::{fmt, <|>fmt::Display}; | 134 | use std::{fmt, $0fmt::Display}; |
135 | ", | 135 | ", |
136 | r" | 136 | r" |
137 | use std::{fmt::{self, Display}}; | 137 | use std::{fmt::{self, Display}}; |
@@ -144,7 +144,7 @@ use std::{fmt::{self, Display}}; | |||
144 | check_assist_not_applicable( | 144 | check_assist_not_applicable( |
145 | merge_imports, | 145 | merge_imports, |
146 | r" | 146 | r" |
147 | pub use std::fmt<|>::Debug; | 147 | pub use std::fmt$0::Debug; |
148 | use std::fmt::Display; | 148 | use std::fmt::Display; |
149 | ", | 149 | ", |
150 | ); | 150 | ); |
@@ -155,7 +155,7 @@ use std::fmt::Display; | |||
155 | check_assist_not_applicable( | 155 | check_assist_not_applicable( |
156 | merge_imports, | 156 | merge_imports, |
157 | r" | 157 | r" |
158 | use std::fmt<|>::Debug; | 158 | use std::fmt$0::Debug; |
159 | pub use std::fmt::Display; | 159 | pub use std::fmt::Display; |
160 | ", | 160 | ", |
161 | ); | 161 | ); |
@@ -166,7 +166,7 @@ pub use std::fmt::Display; | |||
166 | check_assist_not_applicable( | 166 | check_assist_not_applicable( |
167 | merge_imports, | 167 | merge_imports, |
168 | r" | 168 | r" |
169 | pub(crate) use std::fmt<|>::Debug; | 169 | pub(crate) use std::fmt$0::Debug; |
170 | pub use std::fmt::Display; | 170 | pub use std::fmt::Display; |
171 | ", | 171 | ", |
172 | ); | 172 | ); |
@@ -177,7 +177,7 @@ pub use std::fmt::Display; | |||
177 | check_assist_not_applicable( | 177 | check_assist_not_applicable( |
178 | merge_imports, | 178 | merge_imports, |
179 | r" | 179 | r" |
180 | pub use std::fmt<|>::Debug; | 180 | pub use std::fmt$0::Debug; |
181 | pub(crate) use std::fmt::Display; | 181 | pub(crate) use std::fmt::Display; |
182 | ", | 182 | ", |
183 | ); | 183 | ); |
@@ -188,7 +188,7 @@ pub(crate) use std::fmt::Display; | |||
188 | check_assist( | 188 | check_assist( |
189 | merge_imports, | 189 | merge_imports, |
190 | r" | 190 | r" |
191 | pub use std::fmt<|>::Debug; | 191 | pub use std::fmt$0::Debug; |
192 | pub use std::fmt::Display; | 192 | pub use std::fmt::Display; |
193 | ", | 193 | ", |
194 | r" | 194 | r" |
@@ -202,7 +202,7 @@ pub use std::fmt::{Debug, Display}; | |||
202 | check_assist( | 202 | check_assist( |
203 | merge_imports, | 203 | merge_imports, |
204 | r" | 204 | r" |
205 | pub(crate) use std::fmt<|>::Debug; | 205 | pub(crate) use std::fmt$0::Debug; |
206 | pub(crate) use std::fmt::Display; | 206 | pub(crate) use std::fmt::Display; |
207 | ", | 207 | ", |
208 | r" | 208 | r" |
@@ -216,7 +216,7 @@ pub(crate) use std::fmt::{Debug, Display}; | |||
216 | check_assist( | 216 | check_assist( |
217 | merge_imports, | 217 | merge_imports, |
218 | r" | 218 | r" |
219 | use std::{fmt<|>::Debug, fmt::Display}; | 219 | use std::{fmt$0::Debug, fmt::Display}; |
220 | ", | 220 | ", |
221 | r" | 221 | r" |
222 | use std::{fmt::{Debug, Display}}; | 222 | use std::{fmt::{Debug, Display}}; |
@@ -229,7 +229,7 @@ use std::{fmt::{Debug, Display}}; | |||
229 | check_assist( | 229 | check_assist( |
230 | merge_imports, | 230 | merge_imports, |
231 | r" | 231 | r" |
232 | use std::{fmt::Debug, fmt<|>::Display}; | 232 | use std::{fmt::Debug, fmt$0::Display}; |
233 | ", | 233 | ", |
234 | r" | 234 | r" |
235 | use std::{fmt::{Debug, Display}}; | 235 | use std::{fmt::{Debug, Display}}; |
@@ -242,7 +242,7 @@ use std::{fmt::{Debug, Display}}; | |||
242 | check_assist( | 242 | check_assist( |
243 | merge_imports, | 243 | merge_imports, |
244 | r" | 244 | r" |
245 | use std<|>::cell::*; | 245 | use std$0::cell::*; |
246 | use std::str; | 246 | use std::str; |
247 | ", | 247 | ", |
248 | r" | 248 | r" |
@@ -256,7 +256,7 @@ use std::{cell::*, str}; | |||
256 | check_assist( | 256 | check_assist( |
257 | merge_imports, | 257 | merge_imports, |
258 | r" | 258 | r" |
259 | use std<|>::cell::*; | 259 | use std$0::cell::*; |
260 | use std::str::*; | 260 | use std::str::*; |
261 | ", | 261 | ", |
262 | r" | 262 | r" |
@@ -270,7 +270,7 @@ use std::{cell::*, str::*}; | |||
270 | check_assist( | 270 | check_assist( |
271 | merge_imports, | 271 | merge_imports, |
272 | r" | 272 | r" |
273 | use foo<|>::bar; | 273 | use foo$0::bar; |
274 | use foo::baz; | 274 | use foo::baz; |
275 | 275 | ||
276 | /// Doc comment | 276 | /// Doc comment |
@@ -289,7 +289,7 @@ use foo::{bar, baz}; | |||
289 | merge_imports, | 289 | merge_imports, |
290 | r" | 290 | r" |
291 | use { | 291 | use { |
292 | foo<|>::bar, | 292 | foo$0::bar, |
293 | foo::baz, | 293 | foo::baz, |
294 | }; | 294 | }; |
295 | ", | 295 | ", |
@@ -304,7 +304,7 @@ use { | |||
304 | r" | 304 | r" |
305 | use { | 305 | use { |
306 | foo::baz, | 306 | foo::baz, |
307 | foo<|>::bar, | 307 | foo$0::bar, |
308 | }; | 308 | }; |
309 | ", | 309 | ", |
310 | r" | 310 | r" |
@@ -321,7 +321,7 @@ use { | |||
321 | merge_imports, | 321 | merge_imports, |
322 | r" | 322 | r" |
323 | use foo::bar::baz; | 323 | use foo::bar::baz; |
324 | use foo::<|>{ | 324 | use foo::$0{ |
325 | FooBar, | 325 | FooBar, |
326 | }; | 326 | }; |
327 | ", | 327 | ", |
@@ -336,7 +336,7 @@ use foo::{FooBar, bar::baz}; | |||
336 | check_assist_not_applicable( | 336 | check_assist_not_applicable( |
337 | merge_imports, | 337 | merge_imports, |
338 | r" | 338 | r" |
339 | use std::<|> | 339 | use std::$0 |
340 | fn main() {}", | 340 | fn main() {}", |
341 | ); | 341 | ); |
342 | } | 342 | } |
diff --git a/crates/assists/src/handlers/merge_match_arms.rs b/crates/assists/src/handlers/merge_match_arms.rs index c347eb40e..9bf076cb9 100644 --- a/crates/assists/src/handlers/merge_match_arms.rs +++ b/crates/assists/src/handlers/merge_match_arms.rs | |||
@@ -17,7 +17,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists, TextRange}; | |||
17 | // | 17 | // |
18 | // fn handle(action: Action) { | 18 | // fn handle(action: Action) { |
19 | // match action { | 19 | // match action { |
20 | // <|>Action::Move(..) => foo(), | 20 | // $0Action::Move(..) => foo(), |
21 | // Action::Stop => foo(), | 21 | // Action::Stop => foo(), |
22 | // } | 22 | // } |
23 | // } | 23 | // } |
@@ -106,7 +106,7 @@ mod tests { | |||
106 | fn main() { | 106 | fn main() { |
107 | let x = X::A; | 107 | let x = X::A; |
108 | let y = match x { | 108 | let y = match x { |
109 | X::A => { 1i32<|> } | 109 | X::A => { 1i32$0 } |
110 | X::B => { 1i32 } | 110 | X::B => { 1i32 } |
111 | X::C => { 2i32 } | 111 | X::C => { 2i32 } |
112 | } | 112 | } |
@@ -138,7 +138,7 @@ mod tests { | |||
138 | fn main() { | 138 | fn main() { |
139 | let x = X::A; | 139 | let x = X::A; |
140 | let y = match x { | 140 | let y = match x { |
141 | X::A | X::B => {<|> 1i32 }, | 141 | X::A | X::B => {$0 1i32 }, |
142 | X::C | X::D => { 1i32 }, | 142 | X::C | X::D => { 1i32 }, |
143 | X::E => { 2i32 }, | 143 | X::E => { 2i32 }, |
144 | } | 144 | } |
@@ -171,7 +171,7 @@ mod tests { | |||
171 | let x = X::A; | 171 | let x = X::A; |
172 | let y = match x { | 172 | let y = match x { |
173 | X::A => { 1i32 }, | 173 | X::A => { 1i32 }, |
174 | X::B => { 2i<|>32 }, | 174 | X::B => { 2i$032 }, |
175 | _ => { 2i32 } | 175 | _ => { 2i32 } |
176 | } | 176 | } |
177 | } | 177 | } |
@@ -200,7 +200,7 @@ mod tests { | |||
200 | 200 | ||
201 | fn main() { | 201 | fn main() { |
202 | match X::A { | 202 | match X::A { |
203 | X::A<|> => 92, | 203 | X::A$0 => 92, |
204 | X::B => 92, | 204 | X::B => 92, |
205 | X::C => 92, | 205 | X::C => 92, |
206 | X::D => 62, | 206 | X::D => 62, |
@@ -237,7 +237,7 @@ mod tests { | |||
237 | fn main() { | 237 | fn main() { |
238 | let x = X::A; | 238 | let x = X::A; |
239 | let y = match x { | 239 | let y = match x { |
240 | X::A(a) if a > 5 => { <|>1i32 }, | 240 | X::A(a) if a > 5 => { $01i32 }, |
241 | X::B => { 1i32 }, | 241 | X::B => { 1i32 }, |
242 | X::C => { 2i32 } | 242 | X::C => { 2i32 } |
243 | } | 243 | } |
diff --git a/crates/assists/src/handlers/move_bounds.rs b/crates/assists/src/handlers/move_bounds.rs index e2e461520..cf260c6f8 100644 --- a/crates/assists/src/handlers/move_bounds.rs +++ b/crates/assists/src/handlers/move_bounds.rs | |||
@@ -12,7 +12,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
12 | // Moves inline type bounds to a where clause. | 12 | // Moves inline type bounds to a where clause. |
13 | // | 13 | // |
14 | // ``` | 14 | // ``` |
15 | // fn apply<T, U, <|>F: FnOnce(T) -> U>(f: F, x: T) -> U { | 15 | // fn apply<T, U, $0F: FnOnce(T) -> U>(f: F, x: T) -> U { |
16 | // f(x) | 16 | // f(x) |
17 | // } | 17 | // } |
18 | // ``` | 18 | // ``` |
@@ -103,7 +103,7 @@ mod tests { | |||
103 | check_assist( | 103 | check_assist( |
104 | move_bounds_to_where_clause, | 104 | move_bounds_to_where_clause, |
105 | r#" | 105 | r#" |
106 | fn foo<T: u32, <|>F: FnOnce(T) -> T>() {} | 106 | fn foo<T: u32, $0F: FnOnce(T) -> T>() {} |
107 | "#, | 107 | "#, |
108 | r#" | 108 | r#" |
109 | fn foo<T, F>() where T: u32, F: FnOnce(T) -> T {} | 109 | fn foo<T, F>() where T: u32, F: FnOnce(T) -> T {} |
@@ -116,7 +116,7 @@ mod tests { | |||
116 | check_assist( | 116 | check_assist( |
117 | move_bounds_to_where_clause, | 117 | move_bounds_to_where_clause, |
118 | r#" | 118 | r#" |
119 | impl<U: u32, <|>T> A<U, T> {} | 119 | impl<U: u32, $0T> A<U, T> {} |
120 | "#, | 120 | "#, |
121 | r#" | 121 | r#" |
122 | impl<U, T> A<U, T> where U: u32 {} | 122 | impl<U, T> A<U, T> where U: u32 {} |
@@ -129,7 +129,7 @@ mod tests { | |||
129 | check_assist( | 129 | check_assist( |
130 | move_bounds_to_where_clause, | 130 | move_bounds_to_where_clause, |
131 | r#" | 131 | r#" |
132 | struct A<<|>T: Iterator<Item = u32>> {} | 132 | struct A<$0T: Iterator<Item = u32>> {} |
133 | "#, | 133 | "#, |
134 | r#" | 134 | r#" |
135 | struct A<T> where T: Iterator<Item = u32> {} | 135 | struct A<T> where T: Iterator<Item = u32> {} |
@@ -142,7 +142,7 @@ mod tests { | |||
142 | check_assist( | 142 | check_assist( |
143 | move_bounds_to_where_clause, | 143 | move_bounds_to_where_clause, |
144 | r#" | 144 | r#" |
145 | struct Pair<<|>T: u32>(T, T); | 145 | struct Pair<$0T: u32>(T, T); |
146 | "#, | 146 | "#, |
147 | r#" | 147 | r#" |
148 | struct Pair<T>(T, T) where T: u32; | 148 | struct Pair<T>(T, T) where T: u32; |
diff --git a/crates/assists/src/handlers/move_guard.rs b/crates/assists/src/handlers/move_guard.rs index 4318ca6dc..3f22302a9 100644 --- a/crates/assists/src/handlers/move_guard.rs +++ b/crates/assists/src/handlers/move_guard.rs | |||
@@ -14,7 +14,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
14 | // | 14 | // |
15 | // fn handle(action: Action) { | 15 | // fn handle(action: Action) { |
16 | // match action { | 16 | // match action { |
17 | // Action::Move { distance } <|>if distance > 10 => foo(), | 17 | // Action::Move { distance } $0if distance > 10 => foo(), |
18 | // _ => (), | 18 | // _ => (), |
19 | // } | 19 | // } |
20 | // } | 20 | // } |
@@ -74,7 +74,7 @@ pub(crate) fn move_guard_to_arm_body(acc: &mut Assists, ctx: &AssistContext) -> | |||
74 | // | 74 | // |
75 | // fn handle(action: Action) { | 75 | // fn handle(action: Action) { |
76 | // match action { | 76 | // match action { |
77 | // Action::Move { distance } => <|>if distance > 10 { foo() }, | 77 | // Action::Move { distance } => $0if distance > 10 { foo() }, |
78 | // _ => (), | 78 | // _ => (), |
79 | // } | 79 | // } |
80 | // } | 80 | // } |
@@ -158,7 +158,7 @@ mod tests { | |||
158 | r#" | 158 | r#" |
159 | fn main() { | 159 | fn main() { |
160 | match 92 { | 160 | match 92 { |
161 | x <|>if x > 10 => false, | 161 | x $0if x > 10 => false, |
162 | _ => true | 162 | _ => true |
163 | } | 163 | } |
164 | } | 164 | } |
@@ -174,7 +174,7 @@ fn main() { | |||
174 | r#" | 174 | r#" |
175 | fn main() { | 175 | fn main() { |
176 | match 92 { | 176 | match 92 { |
177 | x <|>if x > 10 => false, | 177 | x $0if x > 10 => false, |
178 | _ => true | 178 | _ => true |
179 | } | 179 | } |
180 | } | 180 | } |
@@ -199,7 +199,7 @@ fn main() { | |||
199 | r#" | 199 | r#" |
200 | fn main() { | 200 | fn main() { |
201 | match 92 { | 201 | match 92 { |
202 | <|>x @ 4 | x @ 5 if x > 5 => true, | 202 | $0x @ 4 | x @ 5 if x > 5 => true, |
203 | _ => false | 203 | _ => false |
204 | } | 204 | } |
205 | } | 205 | } |
@@ -224,7 +224,7 @@ fn main() { | |||
224 | r#" | 224 | r#" |
225 | fn main() { | 225 | fn main() { |
226 | match 92 { | 226 | match 92 { |
227 | x => if x > 10 { <|>false }, | 227 | x => if x > 10 { $0false }, |
228 | _ => true | 228 | _ => true |
229 | } | 229 | } |
230 | } | 230 | } |
@@ -248,7 +248,7 @@ fn main() { | |||
248 | fn main() { | 248 | fn main() { |
249 | match 92 { | 249 | match 92 { |
250 | x => { | 250 | x => { |
251 | <|>if x > 10 { | 251 | $0if x > 10 { |
252 | false | 252 | false |
253 | } | 253 | } |
254 | }, | 254 | }, |
@@ -274,7 +274,7 @@ fn main() { | |||
274 | r#" | 274 | r#" |
275 | fn main() { | 275 | fn main() { |
276 | match 92 { | 276 | match 92 { |
277 | x => if let 62 = x { <|>false }, | 277 | x => if let 62 = x { $0false }, |
278 | _ => true | 278 | _ => true |
279 | } | 279 | } |
280 | } | 280 | } |
@@ -289,7 +289,7 @@ fn main() { | |||
289 | r#" | 289 | r#" |
290 | fn main() { | 290 | fn main() { |
291 | match 92 { | 291 | match 92 { |
292 | x => if x > 10 { <|> }, | 292 | x => if x > 10 { $0 }, |
293 | _ => true | 293 | _ => true |
294 | } | 294 | } |
295 | } | 295 | } |
@@ -313,7 +313,7 @@ fn main() { | |||
313 | fn main() { | 313 | fn main() { |
314 | match 92 { | 314 | match 92 { |
315 | x => if x > 10 { | 315 | x => if x > 10 { |
316 | 92;<|> | 316 | 92;$0 |
317 | false | 317 | false |
318 | }, | 318 | }, |
319 | _ => true | 319 | _ => true |
@@ -343,7 +343,7 @@ fn main() { | |||
343 | match 92 { | 343 | match 92 { |
344 | x => { | 344 | x => { |
345 | if x > 10 { | 345 | if x > 10 { |
346 | 92;<|> | 346 | 92;$0 |
347 | false | 347 | false |
348 | } | 348 | } |
349 | } | 349 | } |
diff --git a/crates/assists/src/handlers/move_module_to_file.rs b/crates/assists/src/handlers/move_module_to_file.rs index 165faaf61..9d8579f47 100644 --- a/crates/assists/src/handlers/move_module_to_file.rs +++ b/crates/assists/src/handlers/move_module_to_file.rs | |||
@@ -13,7 +13,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
13 | // Moves inline module's contents to a separate file. | 13 | // Moves inline module's contents to a separate file. |
14 | // | 14 | // |
15 | // ``` | 15 | // ``` |
16 | // mod <|>foo { | 16 | // mod $0foo { |
17 | // fn t() {} | 17 | // fn t() {} |
18 | // } | 18 | // } |
19 | // ``` | 19 | // ``` |
@@ -78,7 +78,7 @@ mod tests { | |||
78 | check_assist( | 78 | check_assist( |
79 | move_module_to_file, | 79 | move_module_to_file, |
80 | r#" | 80 | r#" |
81 | mod <|>tests { | 81 | mod $0tests { |
82 | #[test] fn t() {} | 82 | #[test] fn t() {} |
83 | } | 83 | } |
84 | "#, | 84 | "#, |
@@ -99,7 +99,7 @@ mod tests; | |||
99 | //- /main.rs | 99 | //- /main.rs |
100 | mod submod; | 100 | mod submod; |
101 | //- /submod.rs | 101 | //- /submod.rs |
102 | <|>mod inner { | 102 | $0mod inner { |
103 | fn f() {} | 103 | fn f() {} |
104 | } | 104 | } |
105 | fn g() {} | 105 | fn g() {} |
@@ -122,7 +122,7 @@ fn f() {} | |||
122 | //- /main.rs | 122 | //- /main.rs |
123 | mod submodule; | 123 | mod submodule; |
124 | //- /submodule/mod.rs | 124 | //- /submodule/mod.rs |
125 | mod inner<|> { | 125 | mod inner$0 { |
126 | fn f() {} | 126 | fn f() {} |
127 | } | 127 | } |
128 | fn g() {} | 128 | fn g() {} |
@@ -140,6 +140,6 @@ fn f() {} | |||
140 | #[test] | 140 | #[test] |
141 | fn available_before_curly() { | 141 | fn available_before_curly() { |
142 | mark::check!(available_before_curly); | 142 | mark::check!(available_before_curly); |
143 | check_assist_not_applicable(move_module_to_file, r#"mod m { <|> }"#); | 143 | check_assist_not_applicable(move_module_to_file, r#"mod m { $0 }"#); |
144 | } | 144 | } |
145 | } | 145 | } |
diff --git a/crates/assists/src/handlers/pull_assignment_up.rs b/crates/assists/src/handlers/pull_assignment_up.rs index 63b662fad..13e1cb754 100644 --- a/crates/assists/src/handlers/pull_assignment_up.rs +++ b/crates/assists/src/handlers/pull_assignment_up.rs | |||
@@ -18,7 +18,7 @@ use crate::{ | |||
18 | // let mut foo = 6; | 18 | // let mut foo = 6; |
19 | // | 19 | // |
20 | // if true { | 20 | // if true { |
21 | // <|>foo = 5; | 21 | // $0foo = 5; |
22 | // } else { | 22 | // } else { |
23 | // foo = 4; | 23 | // foo = 4; |
24 | // } | 24 | // } |
@@ -175,7 +175,7 @@ fn foo() { | |||
175 | let mut a = 1; | 175 | let mut a = 1; |
176 | 176 | ||
177 | if true { | 177 | if true { |
178 | <|>a = 2; | 178 | $0a = 2; |
179 | } else { | 179 | } else { |
180 | a = 3; | 180 | a = 3; |
181 | } | 181 | } |
@@ -203,7 +203,7 @@ fn foo() { | |||
203 | 203 | ||
204 | match 1 { | 204 | match 1 { |
205 | 1 => { | 205 | 1 => { |
206 | <|>a = 2; | 206 | $0a = 2; |
207 | }, | 207 | }, |
208 | 2 => { | 208 | 2 => { |
209 | a = 3; | 209 | a = 3; |
@@ -241,7 +241,7 @@ fn foo() { | |||
241 | let mut a = 1; | 241 | let mut a = 1; |
242 | 242 | ||
243 | if true { | 243 | if true { |
244 | <|>a = 2; | 244 | $0a = 2; |
245 | b = a; | 245 | b = a; |
246 | } else { | 246 | } else { |
247 | a = 3; | 247 | a = 3; |
@@ -260,7 +260,7 @@ fn foo() { | |||
260 | let mut a = 1; | 260 | let mut a = 1; |
261 | 261 | ||
262 | if true { | 262 | if true { |
263 | <|>a = 2; | 263 | $0a = 2; |
264 | } else if false { | 264 | } else if false { |
265 | a = 3; | 265 | a = 3; |
266 | } else { | 266 | } else { |
@@ -292,7 +292,7 @@ fn foo() { | |||
292 | 292 | ||
293 | if true { | 293 | if true { |
294 | let b = 2; | 294 | let b = 2; |
295 | <|>a = 2; | 295 | $0a = 2; |
296 | } else { | 296 | } else { |
297 | let b = 3; | 297 | let b = 3; |
298 | a = 3; | 298 | a = 3; |
@@ -322,7 +322,7 @@ fn foo() { | |||
322 | let mut a = 1; | 322 | let mut a = 1; |
323 | 323 | ||
324 | let b = if true { | 324 | let b = if true { |
325 | <|>a = 2 | 325 | $0a = 2 |
326 | } else { | 326 | } else { |
327 | a = 3 | 327 | a = 3 |
328 | }; | 328 | }; |
@@ -339,7 +339,7 @@ fn foo() { | |||
339 | let mut a = 1; | 339 | let mut a = 1; |
340 | 340 | ||
341 | if true { | 341 | if true { |
342 | <|>a = 2; | 342 | $0a = 2; |
343 | } else {} | 343 | } else {} |
344 | }"#, | 344 | }"#, |
345 | ) | 345 | ) |
@@ -355,7 +355,7 @@ fn foo() { | |||
355 | 355 | ||
356 | match 1 { | 356 | match 1 { |
357 | 1 => { | 357 | 1 => { |
358 | <|>a = 2; | 358 | $0a = 2; |
359 | }, | 359 | }, |
360 | 2 => { | 360 | 2 => { |
361 | a = 3; | 361 | a = 3; |
@@ -378,7 +378,7 @@ fn foo() { | |||
378 | let mut a = A(1); | 378 | let mut a = A(1); |
379 | 379 | ||
380 | if true { | 380 | if true { |
381 | <|>a.0 = 2; | 381 | $0a.0 = 2; |
382 | } else { | 382 | } else { |
383 | a.0 = 3; | 383 | a.0 = 3; |
384 | } | 384 | } |
diff --git a/crates/assists/src/handlers/qualify_path.rs b/crates/assists/src/handlers/qualify_path.rs index 98cb09214..f7fbf37f4 100644 --- a/crates/assists/src/handlers/qualify_path.rs +++ b/crates/assists/src/handlers/qualify_path.rs | |||
@@ -22,7 +22,7 @@ use crate::{ | |||
22 | // | 22 | // |
23 | // ``` | 23 | // ``` |
24 | // fn main() { | 24 | // fn main() { |
25 | // let map = HashMap<|>::new(); | 25 | // let map = HashMap$0::new(); |
26 | // } | 26 | // } |
27 | // # pub mod std { pub mod collections { pub struct HashMap { } } } | 27 | // # pub mod std { pub mod collections { pub struct HashMap { } } } |
28 | // ``` | 28 | // ``` |
@@ -221,7 +221,7 @@ mod tests { | |||
221 | 221 | ||
222 | use std::fmt; | 222 | use std::fmt; |
223 | 223 | ||
224 | <|>Formatter | 224 | $0Formatter |
225 | ", | 225 | ", |
226 | r" | 226 | r" |
227 | mod std { | 227 | mod std { |
@@ -242,7 +242,7 @@ mod tests { | |||
242 | check_assist( | 242 | check_assist( |
243 | qualify_path, | 243 | qualify_path, |
244 | r" | 244 | r" |
245 | <|>PubStruct | 245 | $0PubStruct |
246 | 246 | ||
247 | pub mod PubMod { | 247 | pub mod PubMod { |
248 | pub struct PubStruct; | 248 | pub struct PubStruct; |
@@ -266,7 +266,7 @@ mod tests { | |||
266 | macro_rules! foo { | 266 | macro_rules! foo { |
267 | ($i:ident) => { fn foo(a: $i) {} } | 267 | ($i:ident) => { fn foo(a: $i) {} } |
268 | } | 268 | } |
269 | foo!(Pub<|>Struct); | 269 | foo!(Pub$0Struct); |
270 | 270 | ||
271 | pub mod PubMod { | 271 | pub mod PubMod { |
272 | pub struct PubStruct; | 272 | pub struct PubStruct; |
@@ -290,7 +290,7 @@ mod tests { | |||
290 | check_assist( | 290 | check_assist( |
291 | qualify_path, | 291 | qualify_path, |
292 | r" | 292 | r" |
293 | PubSt<|>ruct | 293 | PubSt$0ruct |
294 | 294 | ||
295 | pub mod PubMod1 { | 295 | pub mod PubMod1 { |
296 | pub struct PubStruct; | 296 | pub struct PubStruct; |
@@ -325,7 +325,7 @@ mod tests { | |||
325 | r" | 325 | r" |
326 | use PubMod::PubStruct; | 326 | use PubMod::PubStruct; |
327 | 327 | ||
328 | PubStruct<|> | 328 | PubStruct$0 |
329 | 329 | ||
330 | pub mod PubMod { | 330 | pub mod PubMod { |
331 | pub struct PubStruct; | 331 | pub struct PubStruct; |
@@ -339,7 +339,7 @@ mod tests { | |||
339 | check_assist_not_applicable( | 339 | check_assist_not_applicable( |
340 | qualify_path, | 340 | qualify_path, |
341 | r" | 341 | r" |
342 | PrivateStruct<|> | 342 | PrivateStruct$0 |
343 | 343 | ||
344 | pub mod PubMod { | 344 | pub mod PubMod { |
345 | struct PrivateStruct; | 345 | struct PrivateStruct; |
@@ -353,7 +353,7 @@ mod tests { | |||
353 | check_assist_not_applicable( | 353 | check_assist_not_applicable( |
354 | qualify_path, | 354 | qualify_path, |
355 | " | 355 | " |
356 | PubStruct<|>", | 356 | PubStruct$0", |
357 | ); | 357 | ); |
358 | } | 358 | } |
359 | 359 | ||
@@ -362,7 +362,7 @@ mod tests { | |||
362 | check_assist_not_applicable( | 362 | check_assist_not_applicable( |
363 | qualify_path, | 363 | qualify_path, |
364 | r" | 364 | r" |
365 | use PubStruct<|>; | 365 | use PubStruct$0; |
366 | 366 | ||
367 | pub mod PubMod { | 367 | pub mod PubMod { |
368 | pub struct PubStruct; | 368 | pub struct PubStruct; |
@@ -375,7 +375,7 @@ mod tests { | |||
375 | check_assist( | 375 | check_assist( |
376 | qualify_path, | 376 | qualify_path, |
377 | r" | 377 | r" |
378 | test_function<|> | 378 | test_function$0 |
379 | 379 | ||
380 | pub mod PubMod { | 380 | pub mod PubMod { |
381 | pub fn test_function() {}; | 381 | pub fn test_function() {}; |
@@ -404,7 +404,7 @@ macro_rules! foo { | |||
404 | 404 | ||
405 | //- /main.rs crate:main deps:crate_with_macro | 405 | //- /main.rs crate:main deps:crate_with_macro |
406 | fn main() { | 406 | fn main() { |
407 | foo<|> | 407 | foo$0 |
408 | } | 408 | } |
409 | ", | 409 | ", |
410 | r" | 410 | r" |
@@ -421,7 +421,7 @@ fn main() { | |||
421 | qualify_path, | 421 | qualify_path, |
422 | r" | 422 | r" |
423 | struct AssistInfo { | 423 | struct AssistInfo { |
424 | group_label: Option<<|>GroupLabel>, | 424 | group_label: Option<$0GroupLabel>, |
425 | } | 425 | } |
426 | 426 | ||
427 | mod m { pub struct GroupLabel; } | 427 | mod m { pub struct GroupLabel; } |
@@ -445,7 +445,7 @@ fn main() { | |||
445 | 445 | ||
446 | use mod1::mod2; | 446 | use mod1::mod2; |
447 | fn main() { | 447 | fn main() { |
448 | mod2::mod3::TestStruct<|> | 448 | mod2::mod3::TestStruct$0 |
449 | } | 449 | } |
450 | ", | 450 | ", |
451 | ); | 451 | ); |
@@ -462,7 +462,7 @@ fn main() { | |||
462 | 462 | ||
463 | use test_mod::test_function; | 463 | use test_mod::test_function; |
464 | fn main() { | 464 | fn main() { |
465 | test_function<|> | 465 | test_function$0 |
466 | } | 466 | } |
467 | ", | 467 | ", |
468 | ); | 468 | ); |
@@ -481,7 +481,7 @@ fn main() { | |||
481 | } | 481 | } |
482 | 482 | ||
483 | fn main() { | 483 | fn main() { |
484 | TestStruct::test_function<|> | 484 | TestStruct::test_function$0 |
485 | } | 485 | } |
486 | ", | 486 | ", |
487 | r" | 487 | r" |
@@ -513,7 +513,7 @@ fn main() { | |||
513 | } | 513 | } |
514 | 514 | ||
515 | fn main() { | 515 | fn main() { |
516 | TestStruct::TEST_CONST<|> | 516 | TestStruct::TEST_CONST$0 |
517 | } | 517 | } |
518 | ", | 518 | ", |
519 | r" | 519 | r" |
@@ -547,7 +547,7 @@ fn main() { | |||
547 | } | 547 | } |
548 | 548 | ||
549 | fn main() { | 549 | fn main() { |
550 | test_mod::TestStruct::test_function<|> | 550 | test_mod::TestStruct::test_function$0 |
551 | } | 551 | } |
552 | ", | 552 | ", |
553 | r" | 553 | r" |
@@ -594,7 +594,7 @@ fn main() { | |||
594 | 594 | ||
595 | use test_mod::TestTrait2; | 595 | use test_mod::TestTrait2; |
596 | fn main() { | 596 | fn main() { |
597 | test_mod::TestEnum::test_function<|>; | 597 | test_mod::TestEnum::test_function$0; |
598 | } | 598 | } |
599 | ", | 599 | ", |
600 | ) | 600 | ) |
@@ -617,7 +617,7 @@ fn main() { | |||
617 | } | 617 | } |
618 | 618 | ||
619 | fn main() { | 619 | fn main() { |
620 | test_mod::TestStruct::TEST_CONST<|> | 620 | test_mod::TestStruct::TEST_CONST$0 |
621 | } | 621 | } |
622 | ", | 622 | ", |
623 | r" | 623 | r" |
@@ -664,7 +664,7 @@ fn main() { | |||
664 | 664 | ||
665 | use test_mod::TestTrait2; | 665 | use test_mod::TestTrait2; |
666 | fn main() { | 666 | fn main() { |
667 | test_mod::TestEnum::TEST_CONST<|>; | 667 | test_mod::TestEnum::TEST_CONST$0; |
668 | } | 668 | } |
669 | ", | 669 | ", |
670 | ) | 670 | ) |
@@ -688,7 +688,7 @@ fn main() { | |||
688 | 688 | ||
689 | fn main() { | 689 | fn main() { |
690 | let test_struct = test_mod::TestStruct {}; | 690 | let test_struct = test_mod::TestStruct {}; |
691 | test_struct.test_meth<|>od() | 691 | test_struct.test_meth$0od() |
692 | } | 692 | } |
693 | ", | 693 | ", |
694 | r" | 694 | r" |
@@ -727,7 +727,7 @@ fn main() { | |||
727 | 727 | ||
728 | fn main() { | 728 | fn main() { |
729 | let test_struct = test_mod::TestStruct {}; | 729 | let test_struct = test_mod::TestStruct {}; |
730 | test_struct.test_meth<|>od(42) | 730 | test_struct.test_meth$0od(42) |
731 | } | 731 | } |
732 | ", | 732 | ", |
733 | r" | 733 | r" |
@@ -766,7 +766,7 @@ fn main() { | |||
766 | 766 | ||
767 | fn main() { | 767 | fn main() { |
768 | let test_struct = test_mod::TestStruct {}; | 768 | let test_struct = test_mod::TestStruct {}; |
769 | test_struct.test_meth<|>od() | 769 | test_struct.test_meth$0od() |
770 | } | 770 | } |
771 | ", | 771 | ", |
772 | r" | 772 | r" |
@@ -796,7 +796,7 @@ fn main() { | |||
796 | //- /main.rs crate:main deps:dep | 796 | //- /main.rs crate:main deps:dep |
797 | fn main() { | 797 | fn main() { |
798 | let test_struct = dep::test_mod::TestStruct {}; | 798 | let test_struct = dep::test_mod::TestStruct {}; |
799 | test_struct.test_meth<|>od() | 799 | test_struct.test_meth$0od() |
800 | } | 800 | } |
801 | //- /dep.rs crate:dep | 801 | //- /dep.rs crate:dep |
802 | pub mod test_mod { | 802 | pub mod test_mod { |
@@ -825,7 +825,7 @@ fn main() { | |||
825 | r" | 825 | r" |
826 | //- /main.rs crate:main deps:dep | 826 | //- /main.rs crate:main deps:dep |
827 | fn main() { | 827 | fn main() { |
828 | dep::test_mod::TestStruct::test_func<|>tion | 828 | dep::test_mod::TestStruct::test_func$0tion |
829 | } | 829 | } |
830 | //- /dep.rs crate:dep | 830 | //- /dep.rs crate:dep |
831 | pub mod test_mod { | 831 | pub mod test_mod { |
@@ -853,7 +853,7 @@ fn main() { | |||
853 | r" | 853 | r" |
854 | //- /main.rs crate:main deps:dep | 854 | //- /main.rs crate:main deps:dep |
855 | fn main() { | 855 | fn main() { |
856 | dep::test_mod::TestStruct::CONST<|> | 856 | dep::test_mod::TestStruct::CONST$0 |
857 | } | 857 | } |
858 | //- /dep.rs crate:dep | 858 | //- /dep.rs crate:dep |
859 | pub mod test_mod { | 859 | pub mod test_mod { |
@@ -882,7 +882,7 @@ fn main() { | |||
882 | //- /main.rs crate:main deps:dep | 882 | //- /main.rs crate:main deps:dep |
883 | fn main() { | 883 | fn main() { |
884 | let test_struct = dep::test_mod::TestStruct {}; | 884 | let test_struct = dep::test_mod::TestStruct {}; |
885 | test_struct.test_func<|>tion() | 885 | test_struct.test_func$0tion() |
886 | } | 886 | } |
887 | //- /dep.rs crate:dep | 887 | //- /dep.rs crate:dep |
888 | pub mod test_mod { | 888 | pub mod test_mod { |
@@ -906,7 +906,7 @@ fn main() { | |||
906 | //- /main.rs crate:main deps:dep | 906 | //- /main.rs crate:main deps:dep |
907 | fn main() { | 907 | fn main() { |
908 | let test_struct = dep::test_mod::TestStruct {}; | 908 | let test_struct = dep::test_mod::TestStruct {}; |
909 | test_struct.test_meth<|>od() | 909 | test_struct.test_meth$0od() |
910 | } | 910 | } |
911 | //- /dep.rs crate:dep | 911 | //- /dep.rs crate:dep |
912 | pub mod test_mod { | 912 | pub mod test_mod { |
@@ -949,7 +949,7 @@ fn main() { | |||
949 | use test_mod::TestTrait2; | 949 | use test_mod::TestTrait2; |
950 | fn main() { | 950 | fn main() { |
951 | let one = test_mod::TestEnum::One; | 951 | let one = test_mod::TestEnum::One; |
952 | one.test<|>_method(); | 952 | one.test$0_method(); |
953 | } | 953 | } |
954 | ", | 954 | ", |
955 | ) | 955 | ) |
@@ -965,7 +965,7 @@ pub struct Struct; | |||
965 | 965 | ||
966 | //- /main.rs crate:main deps:dep | 966 | //- /main.rs crate:main deps:dep |
967 | fn main() { | 967 | fn main() { |
968 | Struct<|> | 968 | Struct$0 |
969 | } | 969 | } |
970 | ", | 970 | ", |
971 | r" | 971 | r" |
@@ -992,7 +992,7 @@ pub fn panic_fmt() {} | |||
992 | //- /main.rs crate:main deps:dep | 992 | //- /main.rs crate:main deps:dep |
993 | struct S; | 993 | struct S; |
994 | 994 | ||
995 | impl f<|>mt::Display for S {} | 995 | impl f$0mt::Display for S {} |
996 | ", | 996 | ", |
997 | r" | 997 | r" |
998 | struct S; | 998 | struct S; |
@@ -1019,7 +1019,7 @@ mac!(); | |||
1019 | 1019 | ||
1020 | //- /main.rs crate:main deps:dep | 1020 | //- /main.rs crate:main deps:dep |
1021 | fn main() { | 1021 | fn main() { |
1022 | Cheese<|>; | 1022 | Cheese$0; |
1023 | } | 1023 | } |
1024 | ", | 1024 | ", |
1025 | r" | 1025 | r" |
@@ -1042,7 +1042,7 @@ pub struct fmt; | |||
1042 | 1042 | ||
1043 | //- /main.rs crate:main deps:dep | 1043 | //- /main.rs crate:main deps:dep |
1044 | fn main() { | 1044 | fn main() { |
1045 | FMT<|>; | 1045 | FMT$0; |
1046 | } | 1046 | } |
1047 | ", | 1047 | ", |
1048 | r" | 1048 | r" |
@@ -1062,7 +1062,7 @@ fn main() { | |||
1062 | pub mod generic { pub struct Thing<'a, T>(&'a T); } | 1062 | pub mod generic { pub struct Thing<'a, T>(&'a T); } |
1063 | 1063 | ||
1064 | //- /main.rs crate:main deps:dep | 1064 | //- /main.rs crate:main deps:dep |
1065 | fn foo() -> Thin<|>g<'static, ()> {} | 1065 | fn foo() -> Thin$0g<'static, ()> {} |
1066 | 1066 | ||
1067 | fn main() {} | 1067 | fn main() {} |
1068 | ", | 1068 | ", |
@@ -1083,7 +1083,7 @@ fn main() {} | |||
1083 | pub mod generic { pub struct Thing<'a, T>(&'a T); } | 1083 | pub mod generic { pub struct Thing<'a, T>(&'a T); } |
1084 | 1084 | ||
1085 | //- /main.rs crate:main deps:dep | 1085 | //- /main.rs crate:main deps:dep |
1086 | fn foo() -> Thin<|>g::<'static, ()> {} | 1086 | fn foo() -> Thin$0g::<'static, ()> {} |
1087 | 1087 | ||
1088 | fn main() {} | 1088 | fn main() {} |
1089 | ", | 1089 | ", |
@@ -1108,7 +1108,7 @@ fn main() {} | |||
1108 | } | 1108 | } |
1109 | 1109 | ||
1110 | fn main() { | 1110 | fn main() { |
1111 | TestStruct::<()>::TEST_CONST<|> | 1111 | TestStruct::<()>::TEST_CONST$0 |
1112 | } | 1112 | } |
1113 | ", | 1113 | ", |
1114 | r" | 1114 | r" |
@@ -1142,7 +1142,7 @@ fn main() {} | |||
1142 | } | 1142 | } |
1143 | 1143 | ||
1144 | fn main() { | 1144 | fn main() { |
1145 | test_mod::TestStruct::<()>::TEST_CONST<|> | 1145 | test_mod::TestStruct::<()>::TEST_CONST$0 |
1146 | } | 1146 | } |
1147 | ", | 1147 | ", |
1148 | r" | 1148 | r" |
@@ -1180,7 +1180,7 @@ fn main() {} | |||
1180 | 1180 | ||
1181 | fn main() { | 1181 | fn main() { |
1182 | let test_struct = test_mod::TestStruct {}; | 1182 | let test_struct = test_mod::TestStruct {}; |
1183 | test_struct.test_meth<|>od::<()>() | 1183 | test_struct.test_meth$0od::<()>() |
1184 | } | 1184 | } |
1185 | ", | 1185 | ", |
1186 | r" | 1186 | r" |
diff --git a/crates/assists/src/handlers/raw_string.rs b/crates/assists/src/handlers/raw_string.rs index 4c759cc25..be963f162 100644 --- a/crates/assists/src/handlers/raw_string.rs +++ b/crates/assists/src/handlers/raw_string.rs | |||
@@ -11,7 +11,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
11 | // | 11 | // |
12 | // ``` | 12 | // ``` |
13 | // fn main() { | 13 | // fn main() { |
14 | // "Hello,<|> World!"; | 14 | // "Hello,$0 World!"; |
15 | // } | 15 | // } |
16 | // ``` | 16 | // ``` |
17 | // -> | 17 | // -> |
@@ -53,7 +53,7 @@ pub(crate) fn make_raw_string(acc: &mut Assists, ctx: &AssistContext) -> Option< | |||
53 | // | 53 | // |
54 | // ``` | 54 | // ``` |
55 | // fn main() { | 55 | // fn main() { |
56 | // r#"Hello,<|> "World!""#; | 56 | // r#"Hello,$0 "World!""#; |
57 | // } | 57 | // } |
58 | // ``` | 58 | // ``` |
59 | // -> | 59 | // -> |
@@ -95,7 +95,7 @@ pub(crate) fn make_usual_string(acc: &mut Assists, ctx: &AssistContext) -> Optio | |||
95 | // | 95 | // |
96 | // ``` | 96 | // ``` |
97 | // fn main() { | 97 | // fn main() { |
98 | // r#"Hello,<|> World!"#; | 98 | // r#"Hello,$0 World!"#; |
99 | // } | 99 | // } |
100 | // ``` | 100 | // ``` |
101 | // -> | 101 | // -> |
@@ -123,7 +123,7 @@ pub(crate) fn add_hash(acc: &mut Assists, ctx: &AssistContext) -> Option<()> { | |||
123 | // | 123 | // |
124 | // ``` | 124 | // ``` |
125 | // fn main() { | 125 | // fn main() { |
126 | // r#"Hello,<|> World!"#; | 126 | // r#"Hello,$0 World!"#; |
127 | // } | 127 | // } |
128 | // ``` | 128 | // ``` |
129 | // -> | 129 | // -> |
@@ -194,7 +194,7 @@ mod tests { | |||
194 | make_raw_string, | 194 | make_raw_string, |
195 | r#" | 195 | r#" |
196 | fn f() { | 196 | fn f() { |
197 | let s = <|>"random\nstring"; | 197 | let s = $0"random\nstring"; |
198 | } | 198 | } |
199 | "#, | 199 | "#, |
200 | r#""random\nstring""#, | 200 | r#""random\nstring""#, |
@@ -207,7 +207,7 @@ mod tests { | |||
207 | make_raw_string, | 207 | make_raw_string, |
208 | r#" | 208 | r#" |
209 | fn f() { | 209 | fn f() { |
210 | let s = <|>"random\nstring"; | 210 | let s = $0"random\nstring"; |
211 | } | 211 | } |
212 | "#, | 212 | "#, |
213 | r##" | 213 | r##" |
@@ -225,7 +225,7 @@ string"#; | |||
225 | make_raw_string, | 225 | make_raw_string, |
226 | r#" | 226 | r#" |
227 | fn f() { | 227 | fn f() { |
228 | format!(<|>"x = {}", 92) | 228 | format!($0"x = {}", 92) |
229 | } | 229 | } |
230 | "#, | 230 | "#, |
231 | r##" | 231 | r##" |
@@ -242,7 +242,7 @@ string"#; | |||
242 | make_raw_string, | 242 | make_raw_string, |
243 | r###" | 243 | r###" |
244 | fn f() { | 244 | fn f() { |
245 | let s = <|>"#random##\nstring"; | 245 | let s = $0"#random##\nstring"; |
246 | } | 246 | } |
247 | "###, | 247 | "###, |
248 | r####" | 248 | r####" |
@@ -260,7 +260,7 @@ string"#; | |||
260 | make_raw_string, | 260 | make_raw_string, |
261 | r###" | 261 | r###" |
262 | fn f() { | 262 | fn f() { |
263 | let s = <|>"#random\"##\nstring"; | 263 | let s = $0"#random\"##\nstring"; |
264 | } | 264 | } |
265 | "###, | 265 | "###, |
266 | r####" | 266 | r####" |
@@ -278,7 +278,7 @@ string"###; | |||
278 | make_raw_string, | 278 | make_raw_string, |
279 | r#" | 279 | r#" |
280 | fn f() { | 280 | fn f() { |
281 | let s = <|>"random string"; | 281 | let s = $0"random string"; |
282 | } | 282 | } |
283 | "#, | 283 | "#, |
284 | r##" | 284 | r##" |
@@ -295,7 +295,7 @@ string"###; | |||
295 | make_raw_string, | 295 | make_raw_string, |
296 | r#" | 296 | r#" |
297 | fn f() { | 297 | fn f() { |
298 | let s = "foo<|> | 298 | let s = "foo$0 |
299 | } | 299 | } |
300 | "#, | 300 | "#, |
301 | ) | 301 | ) |
@@ -307,7 +307,7 @@ string"###; | |||
307 | make_usual_string, | 307 | make_usual_string, |
308 | r#" | 308 | r#" |
309 | fn main() { | 309 | fn main() { |
310 | let s = r#"bar<|> | 310 | let s = r#"bar$0 |
311 | } | 311 | } |
312 | "#, | 312 | "#, |
313 | ) | 313 | ) |
@@ -319,7 +319,7 @@ string"###; | |||
319 | add_hash, | 319 | add_hash, |
320 | r#" | 320 | r#" |
321 | fn f() { | 321 | fn f() { |
322 | let s = <|>r"random string"; | 322 | let s = $0r"random string"; |
323 | } | 323 | } |
324 | "#, | 324 | "#, |
325 | r#"r"random string""#, | 325 | r#"r"random string""#, |
@@ -332,7 +332,7 @@ string"###; | |||
332 | add_hash, | 332 | add_hash, |
333 | r#" | 333 | r#" |
334 | fn f() { | 334 | fn f() { |
335 | let s = <|>r"random string"; | 335 | let s = $0r"random string"; |
336 | } | 336 | } |
337 | "#, | 337 | "#, |
338 | r##" | 338 | r##" |
@@ -349,7 +349,7 @@ string"###; | |||
349 | add_hash, | 349 | add_hash, |
350 | r##" | 350 | r##" |
351 | fn f() { | 351 | fn f() { |
352 | let s = <|>r#"random"string"#; | 352 | let s = $0r#"random"string"#; |
353 | } | 353 | } |
354 | "##, | 354 | "##, |
355 | r###" | 355 | r###" |
@@ -366,7 +366,7 @@ string"###; | |||
366 | add_hash, | 366 | add_hash, |
367 | r#" | 367 | r#" |
368 | fn f() { | 368 | fn f() { |
369 | let s = <|>"random string"; | 369 | let s = $0"random string"; |
370 | } | 370 | } |
371 | "#, | 371 | "#, |
372 | ); | 372 | ); |
@@ -378,7 +378,7 @@ string"###; | |||
378 | remove_hash, | 378 | remove_hash, |
379 | r##" | 379 | r##" |
380 | fn f() { | 380 | fn f() { |
381 | let s = <|>r#"random string"#; | 381 | let s = $0r#"random string"#; |
382 | } | 382 | } |
383 | "##, | 383 | "##, |
384 | r##"r#"random string"#"##, | 384 | r##"r#"random string"#"##, |
@@ -389,7 +389,7 @@ string"###; | |||
389 | fn remove_hash_works() { | 389 | fn remove_hash_works() { |
390 | check_assist( | 390 | check_assist( |
391 | remove_hash, | 391 | remove_hash, |
392 | r##"fn f() { let s = <|>r#"random string"#; }"##, | 392 | r##"fn f() { let s = $0r#"random string"#; }"##, |
393 | r#"fn f() { let s = r"random string"; }"#, | 393 | r#"fn f() { let s = r"random string"; }"#, |
394 | ) | 394 | ) |
395 | } | 395 | } |
@@ -401,7 +401,7 @@ string"###; | |||
401 | remove_hash, | 401 | remove_hash, |
402 | r##" | 402 | r##" |
403 | fn f() { | 403 | fn f() { |
404 | let s = <|>r#"random"str"ing"#; | 404 | let s = $0r#"random"str"ing"#; |
405 | } | 405 | } |
406 | "##, | 406 | "##, |
407 | ) | 407 | ) |
@@ -413,7 +413,7 @@ string"###; | |||
413 | remove_hash, | 413 | remove_hash, |
414 | r###" | 414 | r###" |
415 | fn f() { | 415 | fn f() { |
416 | let s = <|>r##"random string"##; | 416 | let s = $0r##"random string"##; |
417 | } | 417 | } |
418 | "###, | 418 | "###, |
419 | r##" | 419 | r##" |
@@ -426,12 +426,12 @@ string"###; | |||
426 | 426 | ||
427 | #[test] | 427 | #[test] |
428 | fn remove_hash_doesnt_work() { | 428 | fn remove_hash_doesnt_work() { |
429 | check_assist_not_applicable(remove_hash, r#"fn f() { let s = <|>"random string"; }"#); | 429 | check_assist_not_applicable(remove_hash, r#"fn f() { let s = $0"random string"; }"#); |
430 | } | 430 | } |
431 | 431 | ||
432 | #[test] | 432 | #[test] |
433 | fn remove_hash_no_hash_doesnt_work() { | 433 | fn remove_hash_no_hash_doesnt_work() { |
434 | check_assist_not_applicable(remove_hash, r#"fn f() { let s = <|>r"random string"; }"#); | 434 | check_assist_not_applicable(remove_hash, r#"fn f() { let s = $0r"random string"; }"#); |
435 | } | 435 | } |
436 | 436 | ||
437 | #[test] | 437 | #[test] |
@@ -440,7 +440,7 @@ string"###; | |||
440 | make_usual_string, | 440 | make_usual_string, |
441 | r##" | 441 | r##" |
442 | fn f() { | 442 | fn f() { |
443 | let s = <|>r#"random string"#; | 443 | let s = $0r#"random string"#; |
444 | } | 444 | } |
445 | "##, | 445 | "##, |
446 | r##"r#"random string"#"##, | 446 | r##"r#"random string"#"##, |
@@ -453,7 +453,7 @@ string"###; | |||
453 | make_usual_string, | 453 | make_usual_string, |
454 | r##" | 454 | r##" |
455 | fn f() { | 455 | fn f() { |
456 | let s = <|>r#"random string"#; | 456 | let s = $0r#"random string"#; |
457 | } | 457 | } |
458 | "##, | 458 | "##, |
459 | r#" | 459 | r#" |
@@ -470,7 +470,7 @@ string"###; | |||
470 | make_usual_string, | 470 | make_usual_string, |
471 | r##" | 471 | r##" |
472 | fn f() { | 472 | fn f() { |
473 | let s = <|>r#"random"str"ing"#; | 473 | let s = $0r#"random"str"ing"#; |
474 | } | 474 | } |
475 | "##, | 475 | "##, |
476 | r#" | 476 | r#" |
@@ -487,7 +487,7 @@ string"###; | |||
487 | make_usual_string, | 487 | make_usual_string, |
488 | r###" | 488 | r###" |
489 | fn f() { | 489 | fn f() { |
490 | let s = <|>r##"random string"##; | 490 | let s = $0r##"random string"##; |
491 | } | 491 | } |
492 | "###, | 492 | "###, |
493 | r##" | 493 | r##" |
@@ -504,7 +504,7 @@ string"###; | |||
504 | make_usual_string, | 504 | make_usual_string, |
505 | r#" | 505 | r#" |
506 | fn f() { | 506 | fn f() { |
507 | let s = <|>"random string"; | 507 | let s = $0"random string"; |
508 | } | 508 | } |
509 | "#, | 509 | "#, |
510 | ); | 510 | ); |
diff --git a/crates/assists/src/handlers/remove_dbg.rs b/crates/assists/src/handlers/remove_dbg.rs index eae6367c1..0320c2f12 100644 --- a/crates/assists/src/handlers/remove_dbg.rs +++ b/crates/assists/src/handlers/remove_dbg.rs | |||
@@ -11,7 +11,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
11 | // | 11 | // |
12 | // ``` | 12 | // ``` |
13 | // fn main() { | 13 | // fn main() { |
14 | // <|>dbg!(92); | 14 | // $0dbg!(92); |
15 | // } | 15 | // } |
16 | // ``` | 16 | // ``` |
17 | // -> | 17 | // -> |
@@ -161,19 +161,19 @@ mod tests { | |||
161 | 161 | ||
162 | #[test] | 162 | #[test] |
163 | fn test_remove_dbg() { | 163 | fn test_remove_dbg() { |
164 | check_assist(remove_dbg, "<|>dbg!(1 + 1)", "1 + 1"); | 164 | check_assist(remove_dbg, "$0dbg!(1 + 1)", "1 + 1"); |
165 | 165 | ||
166 | check_assist(remove_dbg, "dbg!<|>((1 + 1))", "(1 + 1)"); | 166 | check_assist(remove_dbg, "dbg!$0((1 + 1))", "(1 + 1)"); |
167 | 167 | ||
168 | check_assist(remove_dbg, "dbg!(1 <|>+ 1)", "1 + 1"); | 168 | check_assist(remove_dbg, "dbg!(1 $0+ 1)", "1 + 1"); |
169 | 169 | ||
170 | check_assist(remove_dbg, "let _ = <|>dbg!(1 + 1)", "let _ = 1 + 1"); | 170 | check_assist(remove_dbg, "let _ = $0dbg!(1 + 1)", "let _ = 1 + 1"); |
171 | 171 | ||
172 | check_assist( | 172 | check_assist( |
173 | remove_dbg, | 173 | remove_dbg, |
174 | " | 174 | " |
175 | fn foo(n: usize) { | 175 | fn foo(n: usize) { |
176 | if let Some(_) = dbg!(n.<|>checked_sub(4)) { | 176 | if let Some(_) = dbg!(n.$0checked_sub(4)) { |
177 | // ... | 177 | // ... |
178 | } | 178 | } |
179 | } | 179 | } |
@@ -187,20 +187,20 @@ fn foo(n: usize) { | |||
187 | ", | 187 | ", |
188 | ); | 188 | ); |
189 | 189 | ||
190 | check_assist(remove_dbg, "<|>dbg!(Foo::foo_test()).bar()", "Foo::foo_test().bar()"); | 190 | check_assist(remove_dbg, "$0dbg!(Foo::foo_test()).bar()", "Foo::foo_test().bar()"); |
191 | } | 191 | } |
192 | 192 | ||
193 | #[test] | 193 | #[test] |
194 | fn test_remove_dbg_with_brackets_and_braces() { | 194 | fn test_remove_dbg_with_brackets_and_braces() { |
195 | check_assist(remove_dbg, "dbg![<|>1 + 1]", "1 + 1"); | 195 | check_assist(remove_dbg, "dbg![$01 + 1]", "1 + 1"); |
196 | check_assist(remove_dbg, "dbg!{<|>1 + 1}", "1 + 1"); | 196 | check_assist(remove_dbg, "dbg!{$01 + 1}", "1 + 1"); |
197 | } | 197 | } |
198 | 198 | ||
199 | #[test] | 199 | #[test] |
200 | fn test_remove_dbg_not_applicable() { | 200 | fn test_remove_dbg_not_applicable() { |
201 | check_assist_not_applicable(remove_dbg, "<|>vec![1, 2, 3]"); | 201 | check_assist_not_applicable(remove_dbg, "$0vec![1, 2, 3]"); |
202 | check_assist_not_applicable(remove_dbg, "<|>dbg(5, 6, 7)"); | 202 | check_assist_not_applicable(remove_dbg, "$0dbg(5, 6, 7)"); |
203 | check_assist_not_applicable(remove_dbg, "<|>dbg!(5, 6, 7"); | 203 | check_assist_not_applicable(remove_dbg, "$0dbg!(5, 6, 7"); |
204 | } | 204 | } |
205 | 205 | ||
206 | #[test] | 206 | #[test] |
@@ -209,7 +209,7 @@ fn foo(n: usize) { | |||
209 | remove_dbg, | 209 | remove_dbg, |
210 | " | 210 | " |
211 | fn foo(n: usize) { | 211 | fn foo(n: usize) { |
212 | if let Some(_) = dbg!(n.<|>checked_sub(4)) { | 212 | if let Some(_) = dbg!(n.$0checked_sub(4)) { |
213 | // ... | 213 | // ... |
214 | } | 214 | } |
215 | } | 215 | } |
@@ -226,7 +226,7 @@ fn foo(n: usize) { | |||
226 | // the ast::MacroCall to include the semicolon at the end | 226 | // the ast::MacroCall to include the semicolon at the end |
227 | check_assist( | 227 | check_assist( |
228 | remove_dbg, | 228 | remove_dbg, |
229 | r#"let res = <|>dbg!(1 * 20); // needless comment"#, | 229 | r#"let res = $0dbg!(1 * 20); // needless comment"#, |
230 | r#"let res = 1 * 20; // needless comment"#, | 230 | r#"let res = 1 * 20; // needless comment"#, |
231 | ); | 231 | ); |
232 | } | 232 | } |
@@ -238,7 +238,7 @@ fn foo(n: usize) { | |||
238 | " | 238 | " |
239 | fn main() { | 239 | fn main() { |
240 | let mut a = 1; | 240 | let mut a = 1; |
241 | while dbg!<|>(a) < 10000 { | 241 | while dbg!$0(a) < 10000 { |
242 | a += 1; | 242 | a += 1; |
243 | } | 243 | } |
244 | } | 244 | } |
@@ -258,31 +258,31 @@ fn main() { | |||
258 | fn test_remove_dbg_keep_expression() { | 258 | fn test_remove_dbg_keep_expression() { |
259 | check_assist( | 259 | check_assist( |
260 | remove_dbg, | 260 | remove_dbg, |
261 | r#"let res = <|>dbg!(a + b).foo();"#, | 261 | r#"let res = $0dbg!(a + b).foo();"#, |
262 | r#"let res = (a + b).foo();"#, | 262 | r#"let res = (a + b).foo();"#, |
263 | ); | 263 | ); |
264 | 264 | ||
265 | check_assist(remove_dbg, r#"let res = <|>dbg!(2 + 2) * 5"#, r#"let res = (2 + 2) * 5"#); | 265 | check_assist(remove_dbg, r#"let res = $0dbg!(2 + 2) * 5"#, r#"let res = (2 + 2) * 5"#); |
266 | check_assist(remove_dbg, r#"let res = <|>dbg![2 + 2] * 5"#, r#"let res = (2 + 2) * 5"#); | 266 | check_assist(remove_dbg, r#"let res = $0dbg![2 + 2] * 5"#, r#"let res = (2 + 2) * 5"#); |
267 | } | 267 | } |
268 | 268 | ||
269 | #[test] | 269 | #[test] |
270 | fn test_remove_dbg_method_chaining() { | 270 | fn test_remove_dbg_method_chaining() { |
271 | check_assist( | 271 | check_assist( |
272 | remove_dbg, | 272 | remove_dbg, |
273 | r#"let res = <|>dbg!(foo().bar()).baz();"#, | 273 | r#"let res = $0dbg!(foo().bar()).baz();"#, |
274 | r#"let res = foo().bar().baz();"#, | 274 | r#"let res = foo().bar().baz();"#, |
275 | ); | 275 | ); |
276 | check_assist( | 276 | check_assist( |
277 | remove_dbg, | 277 | remove_dbg, |
278 | r#"let res = <|>dbg!(foo.bar()).baz();"#, | 278 | r#"let res = $0dbg!(foo.bar()).baz();"#, |
279 | r#"let res = foo.bar().baz();"#, | 279 | r#"let res = foo.bar().baz();"#, |
280 | ); | 280 | ); |
281 | } | 281 | } |
282 | 282 | ||
283 | #[test] | 283 | #[test] |
284 | fn test_remove_dbg_field_chaining() { | 284 | fn test_remove_dbg_field_chaining() { |
285 | check_assist(remove_dbg, r#"let res = <|>dbg!(foo.bar).baz;"#, r#"let res = foo.bar.baz;"#); | 285 | check_assist(remove_dbg, r#"let res = $0dbg!(foo.bar).baz;"#, r#"let res = foo.bar.baz;"#); |
286 | } | 286 | } |
287 | 287 | ||
288 | #[test] | 288 | #[test] |
@@ -295,7 +295,7 @@ fn square(x: u32) -> u32 { | |||
295 | } | 295 | } |
296 | 296 | ||
297 | fn main() { | 297 | fn main() { |
298 | let x = square(dbg<|>!(5 + 10)); | 298 | let x = square(dbg$0!(5 + 10)); |
299 | println!("{}", x); | 299 | println!("{}", x); |
300 | }"#, | 300 | }"#, |
301 | "dbg!(5 + 10)", | 301 | "dbg!(5 + 10)", |
@@ -309,7 +309,7 @@ fn square(x: u32) -> u32 { | |||
309 | } | 309 | } |
310 | 310 | ||
311 | fn main() { | 311 | fn main() { |
312 | let x = square(dbg<|>!(5 + 10)); | 312 | let x = square(dbg$0!(5 + 10)); |
313 | println!("{}", x); | 313 | println!("{}", x); |
314 | }"#, | 314 | }"#, |
315 | r#" | 315 | r#" |
@@ -328,7 +328,7 @@ fn main() { | |||
328 | fn test_remove_dbg_try_expr() { | 328 | fn test_remove_dbg_try_expr() { |
329 | check_assist( | 329 | check_assist( |
330 | remove_dbg, | 330 | remove_dbg, |
331 | r#"let res = <|>dbg!(result?).foo();"#, | 331 | r#"let res = $0dbg!(result?).foo();"#, |
332 | r#"let res = result?.foo();"#, | 332 | r#"let res = result?.foo();"#, |
333 | ); | 333 | ); |
334 | } | 334 | } |
@@ -337,7 +337,7 @@ fn main() { | |||
337 | fn test_remove_dbg_await_expr() { | 337 | fn test_remove_dbg_await_expr() { |
338 | check_assist( | 338 | check_assist( |
339 | remove_dbg, | 339 | remove_dbg, |
340 | r#"let res = <|>dbg!(fut.await).foo();"#, | 340 | r#"let res = $0dbg!(fut.await).foo();"#, |
341 | r#"let res = fut.await.foo();"#, | 341 | r#"let res = fut.await.foo();"#, |
342 | ); | 342 | ); |
343 | } | 343 | } |
@@ -346,7 +346,7 @@ fn main() { | |||
346 | fn test_remove_dbg_as_cast() { | 346 | fn test_remove_dbg_as_cast() { |
347 | check_assist( | 347 | check_assist( |
348 | remove_dbg, | 348 | remove_dbg, |
349 | r#"let res = <|>dbg!(3 as usize).foo();"#, | 349 | r#"let res = $0dbg!(3 as usize).foo();"#, |
350 | r#"let res = (3 as usize).foo();"#, | 350 | r#"let res = (3 as usize).foo();"#, |
351 | ); | 351 | ); |
352 | } | 352 | } |
@@ -355,12 +355,12 @@ fn main() { | |||
355 | fn test_remove_dbg_index_expr() { | 355 | fn test_remove_dbg_index_expr() { |
356 | check_assist( | 356 | check_assist( |
357 | remove_dbg, | 357 | remove_dbg, |
358 | r#"let res = <|>dbg!(array[3]).foo();"#, | 358 | r#"let res = $0dbg!(array[3]).foo();"#, |
359 | r#"let res = array[3].foo();"#, | 359 | r#"let res = array[3].foo();"#, |
360 | ); | 360 | ); |
361 | check_assist( | 361 | check_assist( |
362 | remove_dbg, | 362 | remove_dbg, |
363 | r#"let res = <|>dbg!(tuple.3).foo();"#, | 363 | r#"let res = $0dbg!(tuple.3).foo();"#, |
364 | r#"let res = tuple.3.foo();"#, | 364 | r#"let res = tuple.3.foo();"#, |
365 | ); | 365 | ); |
366 | } | 366 | } |
@@ -369,12 +369,12 @@ fn main() { | |||
369 | fn test_remove_dbg_range_expr() { | 369 | fn test_remove_dbg_range_expr() { |
370 | check_assist( | 370 | check_assist( |
371 | remove_dbg, | 371 | remove_dbg, |
372 | r#"let res = <|>dbg!(foo..bar).foo();"#, | 372 | r#"let res = $0dbg!(foo..bar).foo();"#, |
373 | r#"let res = (foo..bar).foo();"#, | 373 | r#"let res = (foo..bar).foo();"#, |
374 | ); | 374 | ); |
375 | check_assist( | 375 | check_assist( |
376 | remove_dbg, | 376 | remove_dbg, |
377 | r#"let res = <|>dbg!(foo..=bar).foo();"#, | 377 | r#"let res = $0dbg!(foo..=bar).foo();"#, |
378 | r#"let res = (foo..=bar).foo();"#, | 378 | r#"let res = (foo..=bar).foo();"#, |
379 | ); | 379 | ); |
380 | } | 380 | } |
@@ -384,7 +384,7 @@ fn main() { | |||
384 | check_assist( | 384 | check_assist( |
385 | remove_dbg, | 385 | remove_dbg, |
386 | r#"fn foo() { | 386 | r#"fn foo() { |
387 | if <|>dbg!(x || y) {} | 387 | if $0dbg!(x || y) {} |
388 | }"#, | 388 | }"#, |
389 | r#"fn foo() { | 389 | r#"fn foo() { |
390 | if x || y {} | 390 | if x || y {} |
@@ -393,7 +393,7 @@ fn main() { | |||
393 | check_assist( | 393 | check_assist( |
394 | remove_dbg, | 394 | remove_dbg, |
395 | r#"fn foo() { | 395 | r#"fn foo() { |
396 | while let foo = <|>dbg!(&x) {} | 396 | while let foo = $0dbg!(&x) {} |
397 | }"#, | 397 | }"#, |
398 | r#"fn foo() { | 398 | r#"fn foo() { |
399 | while let foo = &x {} | 399 | while let foo = &x {} |
@@ -402,7 +402,7 @@ fn main() { | |||
402 | check_assist( | 402 | check_assist( |
403 | remove_dbg, | 403 | remove_dbg, |
404 | r#"fn foo() { | 404 | r#"fn foo() { |
405 | if let foo = <|>dbg!(&x) {} | 405 | if let foo = $0dbg!(&x) {} |
406 | }"#, | 406 | }"#, |
407 | r#"fn foo() { | 407 | r#"fn foo() { |
408 | if let foo = &x {} | 408 | if let foo = &x {} |
@@ -411,7 +411,7 @@ fn main() { | |||
411 | check_assist( | 411 | check_assist( |
412 | remove_dbg, | 412 | remove_dbg, |
413 | r#"fn foo() { | 413 | r#"fn foo() { |
414 | match <|>dbg!(&x) {} | 414 | match $0dbg!(&x) {} |
415 | }"#, | 415 | }"#, |
416 | r#"fn foo() { | 416 | r#"fn foo() { |
417 | match &x {} | 417 | match &x {} |
diff --git a/crates/assists/src/handlers/remove_mut.rs b/crates/assists/src/handlers/remove_mut.rs index 575b271f7..30d36dacd 100644 --- a/crates/assists/src/handlers/remove_mut.rs +++ b/crates/assists/src/handlers/remove_mut.rs | |||
@@ -8,7 +8,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
8 | // | 8 | // |
9 | // ``` | 9 | // ``` |
10 | // impl Walrus { | 10 | // impl Walrus { |
11 | // fn feed(&mut<|> self, amount: u32) {} | 11 | // fn feed(&mut$0 self, amount: u32) {} |
12 | // } | 12 | // } |
13 | // ``` | 13 | // ``` |
14 | // -> | 14 | // -> |
diff --git a/crates/assists/src/handlers/remove_unused_param.rs b/crates/assists/src/handlers/remove_unused_param.rs index f72dd49ed..56e8b5229 100644 --- a/crates/assists/src/handlers/remove_unused_param.rs +++ b/crates/assists/src/handlers/remove_unused_param.rs | |||
@@ -16,7 +16,7 @@ use crate::{ | |||
16 | // Removes unused function parameter. | 16 | // Removes unused function parameter. |
17 | // | 17 | // |
18 | // ``` | 18 | // ``` |
19 | // fn frobnicate(x: i32<|>) {} | 19 | // fn frobnicate(x: i32$0) {} |
20 | // | 20 | // |
21 | // fn main() { | 21 | // fn main() { |
22 | // frobnicate(92); | 22 | // frobnicate(92); |
@@ -123,7 +123,7 @@ mod tests { | |||
123 | remove_unused_param, | 123 | remove_unused_param, |
124 | r#" | 124 | r#" |
125 | fn a() { foo(9, 2) } | 125 | fn a() { foo(9, 2) } |
126 | fn foo(x: i32, <|>y: i32) { x; } | 126 | fn foo(x: i32, $0y: i32) { x; } |
127 | fn b() { foo(9, 2,) } | 127 | fn b() { foo(9, 2,) } |
128 | "#, | 128 | "#, |
129 | r#" | 129 | r#" |
@@ -139,7 +139,7 @@ fn b() { foo(9, ) } | |||
139 | check_assist( | 139 | check_assist( |
140 | remove_unused_param, | 140 | remove_unused_param, |
141 | r#" | 141 | r#" |
142 | fn foo(<|>x: i32, y: i32) { y; } | 142 | fn foo($0x: i32, y: i32) { y; } |
143 | fn a() { foo(1, 2) } | 143 | fn a() { foo(1, 2) } |
144 | fn b() { foo(1, 2,) } | 144 | fn b() { foo(1, 2,) } |
145 | "#, | 145 | "#, |
@@ -156,7 +156,7 @@ fn b() { foo(2,) } | |||
156 | check_assist( | 156 | check_assist( |
157 | remove_unused_param, | 157 | remove_unused_param, |
158 | r#" | 158 | r#" |
159 | fn foo(<|>x: i32) { 0; } | 159 | fn foo($0x: i32) { 0; } |
160 | fn a() { foo(1) } | 160 | fn a() { foo(1) } |
161 | fn b() { foo(1, ) } | 161 | fn b() { foo(1, ) } |
162 | "#, | 162 | "#, |
@@ -173,7 +173,7 @@ fn b() { foo( ) } | |||
173 | check_assist( | 173 | check_assist( |
174 | remove_unused_param, | 174 | remove_unused_param, |
175 | r#" | 175 | r#" |
176 | fn foo(x: i32, <|>y: i32, z: i32) { x; } | 176 | fn foo(x: i32, $0y: i32, z: i32) { x; } |
177 | fn a() { foo(1, 2, 3) } | 177 | fn a() { foo(1, 2, 3) } |
178 | fn b() { foo(1, 2, 3,) } | 178 | fn b() { foo(1, 2, 3,) } |
179 | "#, | 179 | "#, |
@@ -190,7 +190,7 @@ fn b() { foo(1, 3,) } | |||
190 | check_assist( | 190 | check_assist( |
191 | remove_unused_param, | 191 | remove_unused_param, |
192 | r#" | 192 | r#" |
193 | mod bar { pub fn foo(x: i32, <|>y: i32) { x; } } | 193 | mod bar { pub fn foo(x: i32, $0y: i32) { x; } } |
194 | fn b() { bar::foo(9, 2) } | 194 | fn b() { bar::foo(9, 2) } |
195 | "#, | 195 | "#, |
196 | r#" | 196 | r#" |
@@ -205,7 +205,7 @@ fn b() { bar::foo(9) } | |||
205 | check_assist( | 205 | check_assist( |
206 | remove_unused_param, | 206 | remove_unused_param, |
207 | r#" | 207 | r#" |
208 | pub fn foo<T>(x: T, <|>y: i32) { x; } | 208 | pub fn foo<T>(x: T, $0y: i32) { x; } |
209 | fn b() { foo::<i32>(9, 2) } | 209 | fn b() { foo::<i32>(9, 2) } |
210 | "#, | 210 | "#, |
211 | r#" | 211 | r#" |
@@ -220,7 +220,7 @@ fn b() { foo::<i32>(9) } | |||
220 | check_assist( | 220 | check_assist( |
221 | remove_unused_param, | 221 | remove_unused_param, |
222 | r#" | 222 | r#" |
223 | pub fn foo<T>(x: i32, <|>y: T) { x; } | 223 | pub fn foo<T>(x: i32, $0y: T) { x; } |
224 | fn b() { foo::<i32>(9, 2) } | 224 | fn b() { foo::<i32>(9, 2) } |
225 | fn b2() { foo(9, 2) } | 225 | fn b2() { foo(9, 2) } |
226 | "#, | 226 | "#, |
@@ -238,7 +238,7 @@ fn b2() { foo(9) } | |||
238 | check_assist_not_applicable( | 238 | check_assist_not_applicable( |
239 | remove_unused_param, | 239 | remove_unused_param, |
240 | r#" | 240 | r#" |
241 | fn foo(x: i32, <|>y: i32) { y; } | 241 | fn foo(x: i32, $0y: i32) { y; } |
242 | fn main() { foo(9, 2) } | 242 | fn main() { foo(9, 2) } |
243 | "#, | 243 | "#, |
244 | ); | 244 | ); |
@@ -250,7 +250,7 @@ fn main() { foo(9, 2) } | |||
250 | remove_unused_param, | 250 | remove_unused_param, |
251 | r#" | 251 | r#" |
252 | //- /main.rs | 252 | //- /main.rs |
253 | fn foo(x: i32, <|>y: i32) { x; } | 253 | fn foo(x: i32, $0y: i32) { x; } |
254 | 254 | ||
255 | mod foo; | 255 | mod foo; |
256 | 256 | ||
diff --git a/crates/assists/src/handlers/reorder_fields.rs b/crates/assists/src/handlers/reorder_fields.rs index fe5574242..fba7d6ddb 100644 --- a/crates/assists/src/handlers/reorder_fields.rs +++ b/crates/assists/src/handlers/reorder_fields.rs | |||
@@ -15,7 +15,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
15 | // | 15 | // |
16 | // ``` | 16 | // ``` |
17 | // struct Foo {foo: i32, bar: i32}; | 17 | // struct Foo {foo: i32, bar: i32}; |
18 | // const test: Foo = <|>Foo {bar: 0, foo: 1} | 18 | // const test: Foo = $0Foo {bar: 0, foo: 1} |
19 | // ``` | 19 | // ``` |
20 | // -> | 20 | // -> |
21 | // ``` | 21 | // ``` |
@@ -126,7 +126,7 @@ struct Foo { | |||
126 | bar: i32, | 126 | bar: i32, |
127 | } | 127 | } |
128 | 128 | ||
129 | const test: Foo = <|>Foo { foo: 0, bar: 0 }; | 129 | const test: Foo = $0Foo { foo: 0, bar: 0 }; |
130 | "#, | 130 | "#, |
131 | ) | 131 | ) |
132 | } | 132 | } |
@@ -137,7 +137,7 @@ const test: Foo = <|>Foo { foo: 0, bar: 0 }; | |||
137 | reorder_fields, | 137 | reorder_fields, |
138 | r#" | 138 | r#" |
139 | struct Foo {}; | 139 | struct Foo {}; |
140 | const test: Foo = <|>Foo {} | 140 | const test: Foo = $0Foo {} |
141 | "#, | 141 | "#, |
142 | ) | 142 | ) |
143 | } | 143 | } |
@@ -148,7 +148,7 @@ const test: Foo = <|>Foo {} | |||
148 | reorder_fields, | 148 | reorder_fields, |
149 | r#" | 149 | r#" |
150 | struct Foo {foo: i32, bar: i32}; | 150 | struct Foo {foo: i32, bar: i32}; |
151 | const test: Foo = <|>Foo {bar: 0, foo: 1} | 151 | const test: Foo = $0Foo {bar: 0, foo: 1} |
152 | "#, | 152 | "#, |
153 | r#" | 153 | r#" |
154 | struct Foo {foo: i32, bar: i32}; | 154 | struct Foo {foo: i32, bar: i32}; |
@@ -166,7 +166,7 @@ struct Foo { foo: i64, bar: i64, baz: i64 } | |||
166 | 166 | ||
167 | fn f(f: Foo) -> { | 167 | fn f(f: Foo) -> { |
168 | match f { | 168 | match f { |
169 | <|>Foo { baz: 0, ref mut bar, .. } => (), | 169 | $0Foo { baz: 0, ref mut bar, .. } => (), |
170 | _ => () | 170 | _ => () |
171 | } | 171 | } |
172 | } | 172 | } |
@@ -197,7 +197,7 @@ struct Foo { | |||
197 | impl Foo { | 197 | impl Foo { |
198 | fn new() -> Foo { | 198 | fn new() -> Foo { |
199 | let foo = String::new(); | 199 | let foo = String::new(); |
200 | <|>Foo { | 200 | $0Foo { |
201 | bar: foo.clone(), | 201 | bar: foo.clone(), |
202 | extra: "Extra field", | 202 | extra: "Extra field", |
203 | foo, | 203 | foo, |
diff --git a/crates/assists/src/handlers/replace_derive_with_manual_impl.rs b/crates/assists/src/handlers/replace_derive_with_manual_impl.rs index cb7a5c104..bd4c1c806 100644 --- a/crates/assists/src/handlers/replace_derive_with_manual_impl.rs +++ b/crates/assists/src/handlers/replace_derive_with_manual_impl.rs | |||
@@ -22,7 +22,7 @@ use crate::{ | |||
22 | // | 22 | // |
23 | // ``` | 23 | // ``` |
24 | // # trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } | 24 | // # trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } |
25 | // #[derive(Deb<|>ug, Display)] | 25 | // #[derive(Deb$0ug, Display)] |
26 | // struct S; | 26 | // struct S; |
27 | // ``` | 27 | // ``` |
28 | // -> | 28 | // -> |
@@ -219,7 +219,7 @@ mod fmt { | |||
219 | } | 219 | } |
220 | } | 220 | } |
221 | 221 | ||
222 | #[derive(Debu<|>g)] | 222 | #[derive(Debu$0g)] |
223 | struct Foo { | 223 | struct Foo { |
224 | bar: String, | 224 | bar: String, |
225 | } | 225 | } |
@@ -261,7 +261,7 @@ mod foo { | |||
261 | } | 261 | } |
262 | } | 262 | } |
263 | 263 | ||
264 | #[derive(<|>Bar)] | 264 | #[derive($0Bar)] |
265 | struct Foo { | 265 | struct Foo { |
266 | bar: String, | 266 | bar: String, |
267 | } | 267 | } |
@@ -300,7 +300,7 @@ impl foo::Bar for Foo { | |||
300 | check_assist( | 300 | check_assist( |
301 | replace_derive_with_manual_impl, | 301 | replace_derive_with_manual_impl, |
302 | " | 302 | " |
303 | #[derive(Debu<|>g)] | 303 | #[derive(Debu$0g)] |
304 | struct Foo { | 304 | struct Foo { |
305 | bar: String, | 305 | bar: String, |
306 | } | 306 | } |
@@ -322,7 +322,7 @@ impl Debug for Foo { | |||
322 | check_assist( | 322 | check_assist( |
323 | replace_derive_with_manual_impl, | 323 | replace_derive_with_manual_impl, |
324 | " | 324 | " |
325 | #[derive(Debug<|>)] | 325 | #[derive(Debug$0)] |
326 | pub struct Foo { | 326 | pub struct Foo { |
327 | bar: String, | 327 | bar: String, |
328 | } | 328 | } |
@@ -344,7 +344,7 @@ impl Debug for Foo { | |||
344 | check_assist( | 344 | check_assist( |
345 | replace_derive_with_manual_impl, | 345 | replace_derive_with_manual_impl, |
346 | " | 346 | " |
347 | #[derive(Display, Debug<|>, Serialize)] | 347 | #[derive(Display, Debug$0, Serialize)] |
348 | struct Foo {} | 348 | struct Foo {} |
349 | ", | 349 | ", |
350 | " | 350 | " |
@@ -363,7 +363,7 @@ impl Debug for Foo { | |||
363 | check_assist_not_applicable( | 363 | check_assist_not_applicable( |
364 | replace_derive_with_manual_impl, | 364 | replace_derive_with_manual_impl, |
365 | " | 365 | " |
366 | #[derive(<|>)] | 366 | #[derive($0)] |
367 | struct Foo {} | 367 | struct Foo {} |
368 | ", | 368 | ", |
369 | ) | 369 | ) |
@@ -374,7 +374,7 @@ struct Foo {} | |||
374 | check_assist_not_applicable( | 374 | check_assist_not_applicable( |
375 | replace_derive_with_manual_impl, | 375 | replace_derive_with_manual_impl, |
376 | " | 376 | " |
377 | #[derive<|>(Debug)] | 377 | #[derive$0(Debug)] |
378 | struct Foo {} | 378 | struct Foo {} |
379 | ", | 379 | ", |
380 | ); | 380 | ); |
@@ -382,7 +382,7 @@ struct Foo {} | |||
382 | check_assist_not_applicable( | 382 | check_assist_not_applicable( |
383 | replace_derive_with_manual_impl, | 383 | replace_derive_with_manual_impl, |
384 | " | 384 | " |
385 | #[derive(Debug)<|>] | 385 | #[derive(Debug)$0] |
386 | struct Foo {} | 386 | struct Foo {} |
387 | ", | 387 | ", |
388 | ) | 388 | ) |
@@ -393,7 +393,7 @@ struct Foo {} | |||
393 | check_assist_not_applicable( | 393 | check_assist_not_applicable( |
394 | replace_derive_with_manual_impl, | 394 | replace_derive_with_manual_impl, |
395 | " | 395 | " |
396 | #[allow(non_camel_<|>case_types)] | 396 | #[allow(non_camel_$0case_types)] |
397 | struct Foo {} | 397 | struct Foo {} |
398 | ", | 398 | ", |
399 | ) | 399 | ) |
diff --git a/crates/assists/src/handlers/replace_if_let_with_match.rs b/crates/assists/src/handlers/replace_if_let_with_match.rs index b67219222..aee3397ab 100644 --- a/crates/assists/src/handlers/replace_if_let_with_match.rs +++ b/crates/assists/src/handlers/replace_if_let_with_match.rs | |||
@@ -20,7 +20,7 @@ use crate::{utils::unwrap_trivial_block, AssistContext, AssistId, AssistKind, As | |||
20 | // enum Action { Move { distance: u32 }, Stop } | 20 | // enum Action { Move { distance: u32 }, Stop } |
21 | // | 21 | // |
22 | // fn handle(action: Action) { | 22 | // fn handle(action: Action) { |
23 | // <|>if let Action::Move { distance } = action { | 23 | // $0if let Action::Move { distance } = action { |
24 | // foo(distance) | 24 | // foo(distance) |
25 | // } else { | 25 | // } else { |
26 | // bar() | 26 | // bar() |
@@ -89,7 +89,7 @@ pub(crate) fn replace_if_let_with_match(acc: &mut Assists, ctx: &AssistContext) | |||
89 | // enum Action { Move { distance: u32 }, Stop } | 89 | // enum Action { Move { distance: u32 }, Stop } |
90 | // | 90 | // |
91 | // fn handle(action: Action) { | 91 | // fn handle(action: Action) { |
92 | // <|>match action { | 92 | // $0match action { |
93 | // Action::Move { distance } => foo(distance), | 93 | // Action::Move { distance } => foo(distance), |
94 | // _ => bar(), | 94 | // _ => bar(), |
95 | // } | 95 | // } |
@@ -179,7 +179,7 @@ mod tests { | |||
179 | r#" | 179 | r#" |
180 | impl VariantData { | 180 | impl VariantData { |
181 | pub fn is_struct(&self) -> bool { | 181 | pub fn is_struct(&self) -> bool { |
182 | if <|>let VariantData::Struct(..) = *self { | 182 | if $0let VariantData::Struct(..) = *self { |
183 | true | 183 | true |
184 | } else { | 184 | } else { |
185 | false | 185 | false |
@@ -204,7 +204,7 @@ impl VariantData { | |||
204 | replace_if_let_with_match, | 204 | replace_if_let_with_match, |
205 | r#" | 205 | r#" |
206 | fn foo() { | 206 | fn foo() { |
207 | if <|>let VariantData::Struct(..) = a { | 207 | if $0let VariantData::Struct(..) = a { |
208 | bar( | 208 | bar( |
209 | 123 | 209 | 123 |
210 | ) | 210 | ) |
@@ -233,7 +233,7 @@ fn foo() { | |||
233 | r#" | 233 | r#" |
234 | impl VariantData { | 234 | impl VariantData { |
235 | pub fn is_struct(&self) -> bool { | 235 | pub fn is_struct(&self) -> bool { |
236 | if <|>let VariantData::Struct(..) = *self { | 236 | if $0let VariantData::Struct(..) = *self { |
237 | true | 237 | true |
238 | } else { | 238 | } else { |
239 | false | 239 | false |
@@ -257,7 +257,7 @@ enum Option<T> { Some(T), None } | |||
257 | use Option::*; | 257 | use Option::*; |
258 | 258 | ||
259 | fn foo(x: Option<i32>) { | 259 | fn foo(x: Option<i32>) { |
260 | <|>if let Some(x) = x { | 260 | $0if let Some(x) = x { |
261 | println!("{}", x) | 261 | println!("{}", x) |
262 | } else { | 262 | } else { |
263 | println!("none") | 263 | println!("none") |
@@ -287,7 +287,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
287 | use Result::*; | 287 | use Result::*; |
288 | 288 | ||
289 | fn foo(x: Result<i32, ()>) { | 289 | fn foo(x: Result<i32, ()>) { |
290 | <|>if let Ok(x) = x { | 290 | $0if let Ok(x) = x { |
291 | println!("{}", x) | 291 | println!("{}", x) |
292 | } else { | 292 | } else { |
293 | println!("none") | 293 | println!("none") |
@@ -315,7 +315,7 @@ fn foo(x: Result<i32, ()>) { | |||
315 | r#" | 315 | r#" |
316 | fn main() { | 316 | fn main() { |
317 | if true { | 317 | if true { |
318 | <|>if let Ok(rel_path) = path.strip_prefix(root_path) { | 318 | $0if let Ok(rel_path) = path.strip_prefix(root_path) { |
319 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; | 319 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; |
320 | Some((*id, rel_path)) | 320 | Some((*id, rel_path)) |
321 | } else { | 321 | } else { |
@@ -347,7 +347,7 @@ fn main() { | |||
347 | r#" | 347 | r#" |
348 | impl VariantData { | 348 | impl VariantData { |
349 | pub fn is_struct(&self) -> bool { | 349 | pub fn is_struct(&self) -> bool { |
350 | <|>match *self { | 350 | $0match *self { |
351 | VariantData::Struct(..) => true, | 351 | VariantData::Struct(..) => true, |
352 | _ => false, | 352 | _ => false, |
353 | } | 353 | } |
@@ -372,7 +372,7 @@ impl VariantData { | |||
372 | replace_match_with_if_let, | 372 | replace_match_with_if_let, |
373 | r#" | 373 | r#" |
374 | fn foo() { | 374 | fn foo() { |
375 | <|>match a { | 375 | $0match a { |
376 | VariantData::Struct(..) => { | 376 | VariantData::Struct(..) => { |
377 | bar( | 377 | bar( |
378 | 123 | 378 | 123 |
@@ -401,7 +401,7 @@ fn foo() { | |||
401 | r#" | 401 | r#" |
402 | impl VariantData { | 402 | impl VariantData { |
403 | pub fn is_struct(&self) -> bool { | 403 | pub fn is_struct(&self) -> bool { |
404 | <|>match *self { | 404 | $0match *self { |
405 | VariantData::Struct(..) => true, | 405 | VariantData::Struct(..) => true, |
406 | _ => false, | 406 | _ => false, |
407 | } | 407 | } |
@@ -423,7 +423,7 @@ enum Option<T> { Some(T), None } | |||
423 | use Option::*; | 423 | use Option::*; |
424 | 424 | ||
425 | fn foo(x: Option<i32>) { | 425 | fn foo(x: Option<i32>) { |
426 | <|>match x { | 426 | $0match x { |
427 | Some(x) => println!("{}", x), | 427 | Some(x) => println!("{}", x), |
428 | None => println!("none"), | 428 | None => println!("none"), |
429 | } | 429 | } |
@@ -453,7 +453,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
453 | use Result::*; | 453 | use Result::*; |
454 | 454 | ||
455 | fn foo(x: Result<i32, ()>) { | 455 | fn foo(x: Result<i32, ()>) { |
456 | <|>match x { | 456 | $0match x { |
457 | Ok(x) => println!("{}", x), | 457 | Ok(x) => println!("{}", x), |
458 | Err(_) => println!("none"), | 458 | Err(_) => println!("none"), |
459 | } | 459 | } |
@@ -481,7 +481,7 @@ fn foo(x: Result<i32, ()>) { | |||
481 | r#" | 481 | r#" |
482 | fn main() { | 482 | fn main() { |
483 | if true { | 483 | if true { |
484 | <|>match path.strip_prefix(root_path) { | 484 | $0match path.strip_prefix(root_path) { |
485 | Ok(rel_path) => { | 485 | Ok(rel_path) => { |
486 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; | 486 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; |
487 | Some((*id, rel_path)) | 487 | Some((*id, rel_path)) |
@@ -512,7 +512,7 @@ fn main() { | |||
512 | replace_match_with_if_let, | 512 | replace_match_with_if_let, |
513 | r#" | 513 | r#" |
514 | fn main() { | 514 | fn main() { |
515 | <|>match path.strip_prefix(root_path) { | 515 | $0match path.strip_prefix(root_path) { |
516 | Ok(rel_path) => println!("{}", rel_path), | 516 | Ok(rel_path) => println!("{}", rel_path), |
517 | _ => (), | 517 | _ => (), |
518 | } | 518 | } |
diff --git a/crates/assists/src/handlers/replace_impl_trait_with_generic.rs b/crates/assists/src/handlers/replace_impl_trait_with_generic.rs index 6738bc134..ff25b61ea 100644 --- a/crates/assists/src/handlers/replace_impl_trait_with_generic.rs +++ b/crates/assists/src/handlers/replace_impl_trait_with_generic.rs | |||
@@ -7,7 +7,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
7 | // Replaces `impl Trait` function argument with the named generic. | 7 | // Replaces `impl Trait` function argument with the named generic. |
8 | // | 8 | // |
9 | // ``` | 9 | // ``` |
10 | // fn foo(bar: <|>impl Bar) {} | 10 | // fn foo(bar: $0impl Bar) {} |
11 | // ``` | 11 | // ``` |
12 | // -> | 12 | // -> |
13 | // ``` | 13 | // ``` |
@@ -56,7 +56,7 @@ mod tests { | |||
56 | check_assist( | 56 | check_assist( |
57 | replace_impl_trait_with_generic, | 57 | replace_impl_trait_with_generic, |
58 | r#" | 58 | r#" |
59 | fn foo<G>(bar: <|>impl Bar) {} | 59 | fn foo<G>(bar: $0impl Bar) {} |
60 | "#, | 60 | "#, |
61 | r#" | 61 | r#" |
62 | fn foo<G, B: Bar>(bar: B) {} | 62 | fn foo<G, B: Bar>(bar: B) {} |
@@ -69,7 +69,7 @@ mod tests { | |||
69 | check_assist( | 69 | check_assist( |
70 | replace_impl_trait_with_generic, | 70 | replace_impl_trait_with_generic, |
71 | r#" | 71 | r#" |
72 | fn foo(bar: <|>impl Bar) {} | 72 | fn foo(bar: $0impl Bar) {} |
73 | "#, | 73 | "#, |
74 | r#" | 74 | r#" |
75 | fn foo<B: Bar>(bar: B) {} | 75 | fn foo<B: Bar>(bar: B) {} |
@@ -82,7 +82,7 @@ mod tests { | |||
82 | check_assist( | 82 | check_assist( |
83 | replace_impl_trait_with_generic, | 83 | replace_impl_trait_with_generic, |
84 | r#" | 84 | r#" |
85 | fn foo<G>(foo: impl Foo, bar: <|>impl Bar) {} | 85 | fn foo<G>(foo: impl Foo, bar: $0impl Bar) {} |
86 | "#, | 86 | "#, |
87 | r#" | 87 | r#" |
88 | fn foo<G, B: Bar>(foo: impl Foo, bar: B) {} | 88 | fn foo<G, B: Bar>(foo: impl Foo, bar: B) {} |
@@ -95,7 +95,7 @@ mod tests { | |||
95 | check_assist( | 95 | check_assist( |
96 | replace_impl_trait_with_generic, | 96 | replace_impl_trait_with_generic, |
97 | r#" | 97 | r#" |
98 | fn foo<>(bar: <|>impl Bar) {} | 98 | fn foo<>(bar: $0impl Bar) {} |
99 | "#, | 99 | "#, |
100 | r#" | 100 | r#" |
101 | fn foo<B: Bar>(bar: B) {} | 101 | fn foo<B: Bar>(bar: B) {} |
@@ -109,7 +109,7 @@ mod tests { | |||
109 | replace_impl_trait_with_generic, | 109 | replace_impl_trait_with_generic, |
110 | r#" | 110 | r#" |
111 | fn foo< | 111 | fn foo< |
112 | >(bar: <|>impl Bar) {} | 112 | >(bar: $0impl Bar) {} |
113 | "#, | 113 | "#, |
114 | r#" | 114 | r#" |
115 | fn foo<B: Bar | 115 | fn foo<B: Bar |
@@ -124,7 +124,7 @@ mod tests { | |||
124 | check_assist( | 124 | check_assist( |
125 | replace_impl_trait_with_generic, | 125 | replace_impl_trait_with_generic, |
126 | r#" | 126 | r#" |
127 | fn foo<B>(bar: <|>impl Bar) {} | 127 | fn foo<B>(bar: $0impl Bar) {} |
128 | "#, | 128 | "#, |
129 | r#" | 129 | r#" |
130 | fn foo<B, C: Bar>(bar: C) {} | 130 | fn foo<B, C: Bar>(bar: C) {} |
@@ -141,7 +141,7 @@ mod tests { | |||
141 | G: Foo, | 141 | G: Foo, |
142 | F, | 142 | F, |
143 | H, | 143 | H, |
144 | >(bar: <|>impl Bar) {} | 144 | >(bar: $0impl Bar) {} |
145 | "#, | 145 | "#, |
146 | r#" | 146 | r#" |
147 | fn foo< | 147 | fn foo< |
@@ -158,7 +158,7 @@ mod tests { | |||
158 | check_assist( | 158 | check_assist( |
159 | replace_impl_trait_with_generic, | 159 | replace_impl_trait_with_generic, |
160 | r#" | 160 | r#" |
161 | fn foo(bar: <|>impl Foo + Bar) {} | 161 | fn foo(bar: $0impl Foo + Bar) {} |
162 | "#, | 162 | "#, |
163 | r#" | 163 | r#" |
164 | fn foo<F: Foo + Bar>(bar: F) {} | 164 | fn foo<F: Foo + Bar>(bar: F) {} |
diff --git a/crates/assists/src/handlers/replace_let_with_if_let.rs b/crates/assists/src/handlers/replace_let_with_if_let.rs index 5970e283c..5a27ada6b 100644 --- a/crates/assists/src/handlers/replace_let_with_if_let.rs +++ b/crates/assists/src/handlers/replace_let_with_if_let.rs | |||
@@ -20,7 +20,7 @@ use ide_db::ty_filter::TryEnum; | |||
20 | // # enum Option<T> { Some(T), None } | 20 | // # enum Option<T> { Some(T), None } |
21 | // | 21 | // |
22 | // fn main(action: Action) { | 22 | // fn main(action: Action) { |
23 | // <|>let x = compute(); | 23 | // $0let x = compute(); |
24 | // } | 24 | // } |
25 | // | 25 | // |
26 | // fn compute() -> Option<i32> { None } | 26 | // fn compute() -> Option<i32> { None } |
@@ -85,7 +85,7 @@ mod tests { | |||
85 | enum E<T> { X(T), Y(T) } | 85 | enum E<T> { X(T), Y(T) } |
86 | 86 | ||
87 | fn main() { | 87 | fn main() { |
88 | <|>let x = E::X(92); | 88 | $0let x = E::X(92); |
89 | } | 89 | } |
90 | ", | 90 | ", |
91 | r" | 91 | r" |
diff --git a/crates/assists/src/handlers/replace_qualified_name_with_use.rs b/crates/assists/src/handlers/replace_qualified_name_with_use.rs index 8193e45a8..f3bc6cf39 100644 --- a/crates/assists/src/handlers/replace_qualified_name_with_use.rs +++ b/crates/assists/src/handlers/replace_qualified_name_with_use.rs | |||
@@ -9,7 +9,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
9 | // Adds a use statement for a given fully-qualified name. | 9 | // Adds a use statement for a given fully-qualified name. |
10 | // | 10 | // |
11 | // ``` | 11 | // ``` |
12 | // fn process(map: std::collections::<|>HashMap<String, String>) {} | 12 | // fn process(map: std::collections::$0HashMap<String, String>) {} |
13 | // ``` | 13 | // ``` |
14 | // -> | 14 | // -> |
15 | // ``` | 15 | // ``` |
@@ -127,7 +127,7 @@ mod tests { | |||
127 | r"use std::fs; | 127 | r"use std::fs; |
128 | 128 | ||
129 | fn main() { | 129 | fn main() { |
130 | std::f<|>s::Path | 130 | std::f$0s::Path |
131 | }", | 131 | }", |
132 | r"use std::fs; | 132 | r"use std::fs; |
133 | 133 | ||
@@ -142,7 +142,7 @@ fn main() { | |||
142 | check_assist( | 142 | check_assist( |
143 | replace_qualified_name_with_use, | 143 | replace_qualified_name_with_use, |
144 | r" | 144 | r" |
145 | std::fmt::Debug<|> | 145 | std::fmt::Debug$0 |
146 | ", | 146 | ", |
147 | r" | 147 | r" |
148 | use std::fmt::Debug; | 148 | use std::fmt::Debug; |
@@ -156,7 +156,7 @@ Debug | |||
156 | check_assist( | 156 | check_assist( |
157 | replace_qualified_name_with_use, | 157 | replace_qualified_name_with_use, |
158 | r" | 158 | r" |
159 | std::fmt::Debug<|> | 159 | std::fmt::Debug$0 |
160 | 160 | ||
161 | fn main() { | 161 | fn main() { |
162 | } | 162 | } |
@@ -180,7 +180,7 @@ fn main() { | |||
180 | fn main() { | 180 | fn main() { |
181 | } | 181 | } |
182 | 182 | ||
183 | std::fmt::Debug<|> | 183 | std::fmt::Debug$0 |
184 | ", | 184 | ", |
185 | r" | 185 | r" |
186 | use std::fmt::Debug; | 186 | use std::fmt::Debug; |
@@ -198,7 +198,7 @@ Debug | |||
198 | check_assist( | 198 | check_assist( |
199 | replace_qualified_name_with_use, | 199 | replace_qualified_name_with_use, |
200 | r" | 200 | r" |
201 | std::fmt<|>::Debug | 201 | std::fmt$0::Debug |
202 | ", | 202 | ", |
203 | r" | 203 | r" |
204 | use std::fmt; | 204 | use std::fmt; |
@@ -215,7 +215,7 @@ fmt::Debug | |||
215 | r" | 215 | r" |
216 | use stdx; | 216 | use stdx; |
217 | 217 | ||
218 | impl std::fmt::Debug<|> for Foo { | 218 | impl std::fmt::Debug$0 for Foo { |
219 | } | 219 | } |
220 | ", | 220 | ", |
221 | r" | 221 | r" |
@@ -234,7 +234,7 @@ impl Debug for Foo { | |||
234 | check_assist( | 234 | check_assist( |
235 | replace_qualified_name_with_use, | 235 | replace_qualified_name_with_use, |
236 | r" | 236 | r" |
237 | impl std::fmt::Debug<|> for Foo { | 237 | impl std::fmt::Debug$0 for Foo { |
238 | } | 238 | } |
239 | ", | 239 | ", |
240 | r" | 240 | r" |
@@ -251,7 +251,7 @@ impl Debug for Foo { | |||
251 | check_assist( | 251 | check_assist( |
252 | replace_qualified_name_with_use, | 252 | replace_qualified_name_with_use, |
253 | r" | 253 | r" |
254 | impl std::fmt::Debug<|> for Foo { | 254 | impl std::fmt::Debug$0 for Foo { |
255 | } | 255 | } |
256 | ", | 256 | ", |
257 | r" | 257 | r" |
@@ -270,7 +270,7 @@ impl Debug for Foo { | |||
270 | r" | 270 | r" |
271 | use std::fmt; | 271 | use std::fmt; |
272 | 272 | ||
273 | impl std::io<|> for Foo { | 273 | impl std::io$0 for Foo { |
274 | } | 274 | } |
275 | ", | 275 | ", |
276 | r" | 276 | r" |
@@ -289,7 +289,7 @@ impl io for Foo { | |||
289 | r" | 289 | r" |
290 | use std::fmt; | 290 | use std::fmt; |
291 | 291 | ||
292 | impl std::fmt::Debug<|> for Foo { | 292 | impl std::fmt::Debug$0 for Foo { |
293 | } | 293 | } |
294 | ", | 294 | ", |
295 | r" | 295 | r" |
@@ -308,7 +308,7 @@ impl Debug for Foo { | |||
308 | r" | 308 | r" |
309 | use std::fmt::Debug; | 309 | use std::fmt::Debug; |
310 | 310 | ||
311 | impl std::fmt<|> for Foo { | 311 | impl std::fmt$0 for Foo { |
312 | } | 312 | } |
313 | ", | 313 | ", |
314 | r" | 314 | r" |
@@ -327,7 +327,7 @@ impl fmt for Foo { | |||
327 | r" | 327 | r" |
328 | use std::fmt::{Debug, nested::{Display}}; | 328 | use std::fmt::{Debug, nested::{Display}}; |
329 | 329 | ||
330 | impl std::fmt::nested<|> for Foo { | 330 | impl std::fmt::nested$0 for Foo { |
331 | } | 331 | } |
332 | ", | 332 | ", |
333 | r" | 333 | r" |
@@ -346,7 +346,7 @@ impl nested for Foo { | |||
346 | r" | 346 | r" |
347 | use std::fmt::{Debug, nested::{self, Display}}; | 347 | use std::fmt::{Debug, nested::{self, Display}}; |
348 | 348 | ||
349 | impl std::fmt::nested<|> for Foo { | 349 | impl std::fmt::nested$0 for Foo { |
350 | } | 350 | } |
351 | ", | 351 | ", |
352 | r" | 352 | r" |
@@ -365,7 +365,7 @@ impl nested for Foo { | |||
365 | r" | 365 | r" |
366 | use std::fmt::{Debug, nested::{Display}}; | 366 | use std::fmt::{Debug, nested::{Display}}; |
367 | 367 | ||
368 | impl std::fmt::nested::Debug<|> for Foo { | 368 | impl std::fmt::nested::Debug$0 for Foo { |
369 | } | 369 | } |
370 | ", | 370 | ", |
371 | r" | 371 | r" |
@@ -384,7 +384,7 @@ impl Debug for Foo { | |||
384 | r" | 384 | r" |
385 | use std::fmt::Debug; | 385 | use std::fmt::Debug; |
386 | 386 | ||
387 | impl std::fmt::nested::Display<|> for Foo { | 387 | impl std::fmt::nested::Display$0 for Foo { |
388 | } | 388 | } |
389 | ", | 389 | ", |
390 | r" | 390 | r" |
@@ -403,7 +403,7 @@ impl Display for Foo { | |||
403 | r" | 403 | r" |
404 | use std::fmt::nested::Debug; | 404 | use std::fmt::nested::Debug; |
405 | 405 | ||
406 | impl std::fmt::Display<|> for Foo { | 406 | impl std::fmt::Display$0 for Foo { |
407 | } | 407 | } |
408 | ", | 408 | ", |
409 | r" | 409 | r" |
@@ -425,7 +425,7 @@ use crate::{ | |||
425 | AssocItem, | 425 | AssocItem, |
426 | }; | 426 | }; |
427 | 427 | ||
428 | fn foo() { crate::ty::lower<|>::trait_env() } | 428 | fn foo() { crate::ty::lower$0::trait_env() } |
429 | ", | 429 | ", |
430 | r" | 430 | r" |
431 | use crate::{AssocItem, ty::{Substs, Ty, lower}}; | 431 | use crate::{AssocItem, ty::{Substs, Ty, lower}}; |
@@ -442,7 +442,7 @@ fn foo() { lower::trait_env() } | |||
442 | r" | 442 | r" |
443 | use std::fmt as foo; | 443 | use std::fmt as foo; |
444 | 444 | ||
445 | impl foo::Debug<|> for Foo { | 445 | impl foo::Debug$0 for Foo { |
446 | } | 446 | } |
447 | ", | 447 | ", |
448 | r" | 448 | r" |
@@ -462,7 +462,7 @@ impl Debug for Foo { | |||
462 | check_assist_not_applicable( | 462 | check_assist_not_applicable( |
463 | replace_qualified_name_with_use, | 463 | replace_qualified_name_with_use, |
464 | r" | 464 | r" |
465 | impl foo<|> for Foo { | 465 | impl foo$0 for Foo { |
466 | } | 466 | } |
467 | ", | 467 | ", |
468 | ); | 468 | ); |
@@ -473,7 +473,7 @@ impl foo<|> for Foo { | |||
473 | check_assist_not_applicable( | 473 | check_assist_not_applicable( |
474 | replace_qualified_name_with_use, | 474 | replace_qualified_name_with_use, |
475 | r" | 475 | r" |
476 | use std::fmt<|>; | 476 | use std::fmt$0; |
477 | ", | 477 | ", |
478 | ); | 478 | ); |
479 | } | 479 | } |
@@ -485,7 +485,7 @@ use std::fmt<|>; | |||
485 | r" | 485 | r" |
486 | mod foo { | 486 | mod foo { |
487 | mod bar { | 487 | mod bar { |
488 | std::fmt::Debug<|> | 488 | std::fmt::Debug$0 |
489 | } | 489 | } |
490 | } | 490 | } |
491 | ", | 491 | ", |
@@ -509,7 +509,7 @@ mod foo { | |||
509 | #![allow(dead_code)] | 509 | #![allow(dead_code)] |
510 | 510 | ||
511 | fn main() { | 511 | fn main() { |
512 | std::fmt::Debug<|> | 512 | std::fmt::Debug$0 |
513 | } | 513 | } |
514 | ", | 514 | ", |
515 | r" | 515 | r" |
@@ -530,7 +530,7 @@ fn main() { | |||
530 | replace_qualified_name_with_use, | 530 | replace_qualified_name_with_use, |
531 | r" | 531 | r" |
532 | fn main() { | 532 | fn main() { |
533 | std::fmt::Debug<|>; | 533 | std::fmt::Debug$0; |
534 | let x: std::fmt::Debug = std::fmt::Debug; | 534 | let x: std::fmt::Debug = std::fmt::Debug; |
535 | } | 535 | } |
536 | ", | 536 | ", |
@@ -552,7 +552,7 @@ fn main() { | |||
552 | r" | 552 | r" |
553 | mod m { | 553 | mod m { |
554 | fn f() { | 554 | fn f() { |
555 | std::fmt::Debug<|>; | 555 | std::fmt::Debug$0; |
556 | let x: std::fmt::Debug = std::fmt::Debug; | 556 | let x: std::fmt::Debug = std::fmt::Debug; |
557 | } | 557 | } |
558 | fn g() { | 558 | fn g() { |
@@ -590,7 +590,7 @@ fn f() { | |||
590 | replace_qualified_name_with_use, | 590 | replace_qualified_name_with_use, |
591 | r" | 591 | r" |
592 | fn main() { | 592 | fn main() { |
593 | std::fmt::Debug<|>; | 593 | std::fmt::Debug$0; |
594 | } | 594 | } |
595 | 595 | ||
596 | mod sub { | 596 | mod sub { |
@@ -623,7 +623,7 @@ mod sub { | |||
623 | use std::fmt::Display; | 623 | use std::fmt::Display; |
624 | 624 | ||
625 | fn main() { | 625 | fn main() { |
626 | std::fmt<|>; | 626 | std::fmt$0; |
627 | } | 627 | } |
628 | ", | 628 | ", |
629 | r" | 629 | r" |
@@ -643,7 +643,7 @@ fn main() { | |||
643 | r" | 643 | r" |
644 | pub use std::fmt; | 644 | pub use std::fmt; |
645 | 645 | ||
646 | impl std::io<|> for Foo { | 646 | impl std::io$0 for Foo { |
647 | } | 647 | } |
648 | ", | 648 | ", |
649 | r" | 649 | r" |
@@ -663,7 +663,7 @@ impl io for Foo { | |||
663 | r" | 663 | r" |
664 | pub(crate) use std::fmt; | 664 | pub(crate) use std::fmt; |
665 | 665 | ||
666 | impl std::io<|> for Foo { | 666 | impl std::io$0 for Foo { |
667 | } | 667 | } |
668 | ", | 668 | ", |
669 | r" | 669 | r" |
diff --git a/crates/assists/src/handlers/replace_string_with_char.rs b/crates/assists/src/handlers/replace_string_with_char.rs index b4b898846..317318c24 100644 --- a/crates/assists/src/handlers/replace_string_with_char.rs +++ b/crates/assists/src/handlers/replace_string_with_char.rs | |||
@@ -8,7 +8,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
8 | // | 8 | // |
9 | // ``` | 9 | // ``` |
10 | // fn main() { | 10 | // fn main() { |
11 | // find("{<|>"); | 11 | // find("{$0"); |
12 | // } | 12 | // } |
13 | // ``` | 13 | // ``` |
14 | // -> | 14 | // -> |
@@ -48,7 +48,7 @@ mod tests { | |||
48 | replace_string_with_char, | 48 | replace_string_with_char, |
49 | r#" | 49 | r#" |
50 | fn f() { | 50 | fn f() { |
51 | let s = "<|>c"; | 51 | let s = "$0c"; |
52 | } | 52 | } |
53 | "#, | 53 | "#, |
54 | r#""c""#, | 54 | r#""c""#, |
@@ -61,7 +61,7 @@ mod tests { | |||
61 | replace_string_with_char, | 61 | replace_string_with_char, |
62 | r#" | 62 | r#" |
63 | fn f() { | 63 | fn f() { |
64 | let s = "<|>c"; | 64 | let s = "$0c"; |
65 | } | 65 | } |
66 | "#, | 66 | "#, |
67 | r##" | 67 | r##" |
@@ -78,7 +78,7 @@ mod tests { | |||
78 | replace_string_with_char, | 78 | replace_string_with_char, |
79 | r#" | 79 | r#" |
80 | fn f() { | 80 | fn f() { |
81 | let s = "<|>😀"; | 81 | let s = "$0😀"; |
82 | } | 82 | } |
83 | "#, | 83 | "#, |
84 | r##" | 84 | r##" |
@@ -95,7 +95,7 @@ mod tests { | |||
95 | replace_string_with_char, | 95 | replace_string_with_char, |
96 | r#" | 96 | r#" |
97 | fn f() { | 97 | fn f() { |
98 | let s = "<|>test"; | 98 | let s = "$0test"; |
99 | } | 99 | } |
100 | "#, | 100 | "#, |
101 | ) | 101 | ) |
@@ -107,7 +107,7 @@ mod tests { | |||
107 | replace_string_with_char, | 107 | replace_string_with_char, |
108 | r#" | 108 | r#" |
109 | fn f() { | 109 | fn f() { |
110 | format!(<|>"x", 92) | 110 | format!($0"x", 92) |
111 | } | 111 | } |
112 | "#, | 112 | "#, |
113 | r##" | 113 | r##" |
@@ -124,7 +124,7 @@ mod tests { | |||
124 | replace_string_with_char, | 124 | replace_string_with_char, |
125 | r#" | 125 | r#" |
126 | fn f() { | 126 | fn f() { |
127 | find(<|>"x"); | 127 | find($0"x"); |
128 | } | 128 | } |
129 | "#, | 129 | "#, |
130 | r##" | 130 | r##" |
diff --git a/crates/assists/src/handlers/replace_unwrap_with_match.rs b/crates/assists/src/handlers/replace_unwrap_with_match.rs index f547066f0..a986a6ae8 100644 --- a/crates/assists/src/handlers/replace_unwrap_with_match.rs +++ b/crates/assists/src/handlers/replace_unwrap_with_match.rs | |||
@@ -23,7 +23,7 @@ use ide_db::ty_filter::TryEnum; | |||
23 | // enum Result<T, E> { Ok(T), Err(E) } | 23 | // enum Result<T, E> { Ok(T), Err(E) } |
24 | // fn main() { | 24 | // fn main() { |
25 | // let x: Result<i32, i32> = Result::Ok(92); | 25 | // let x: Result<i32, i32> = Result::Ok(92); |
26 | // let y = x.<|>unwrap(); | 26 | // let y = x.$0unwrap(); |
27 | // } | 27 | // } |
28 | // ``` | 28 | // ``` |
29 | // -> | 29 | // -> |
@@ -101,7 +101,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
101 | fn i<T>(a: T) -> T { a } | 101 | fn i<T>(a: T) -> T { a } |
102 | fn main() { | 102 | fn main() { |
103 | let x: Result<i32, i32> = Result::Ok(92); | 103 | let x: Result<i32, i32> = Result::Ok(92); |
104 | let y = i(x).<|>unwrap(); | 104 | let y = i(x).$0unwrap(); |
105 | } | 105 | } |
106 | ", | 106 | ", |
107 | r" | 107 | r" |
@@ -127,7 +127,7 @@ enum Option<T> { Some(T), None } | |||
127 | fn i<T>(a: T) -> T { a } | 127 | fn i<T>(a: T) -> T { a } |
128 | fn main() { | 128 | fn main() { |
129 | let x = Option::Some(92); | 129 | let x = Option::Some(92); |
130 | let y = i(x).<|>unwrap(); | 130 | let y = i(x).$0unwrap(); |
131 | } | 131 | } |
132 | ", | 132 | ", |
133 | r" | 133 | r" |
@@ -153,7 +153,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
153 | fn i<T>(a: T) -> T { a } | 153 | fn i<T>(a: T) -> T { a } |
154 | fn main() { | 154 | fn main() { |
155 | let x: Result<i32, i32> = Result::Ok(92); | 155 | let x: Result<i32, i32> = Result::Ok(92); |
156 | let y = i(x).<|>unwrap().count_zeroes(); | 156 | let y = i(x).$0unwrap().count_zeroes(); |
157 | } | 157 | } |
158 | ", | 158 | ", |
159 | r" | 159 | r" |
@@ -179,7 +179,7 @@ enum Option<T> { Some(T), None } | |||
179 | fn i<T>(a: T) -> T { a } | 179 | fn i<T>(a: T) -> T { a } |
180 | fn main() { | 180 | fn main() { |
181 | let x = Option::Some(92); | 181 | let x = Option::Some(92); |
182 | let y = i(x).<|>unwrap(); | 182 | let y = i(x).$0unwrap(); |
183 | } | 183 | } |
184 | ", | 184 | ", |
185 | r"i(x).unwrap()", | 185 | r"i(x).unwrap()", |
diff --git a/crates/assists/src/handlers/split_import.rs b/crates/assists/src/handlers/split_import.rs index ef1f6b8a1..9319a4267 100644 --- a/crates/assists/src/handlers/split_import.rs +++ b/crates/assists/src/handlers/split_import.rs | |||
@@ -9,7 +9,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
9 | // Wraps the tail of import into braces. | 9 | // Wraps the tail of import into braces. |
10 | // | 10 | // |
11 | // ``` | 11 | // ``` |
12 | // use std::<|>collections::HashMap; | 12 | // use std::$0collections::HashMap; |
13 | // ``` | 13 | // ``` |
14 | // -> | 14 | // -> |
15 | // ``` | 15 | // ``` |
@@ -43,7 +43,7 @@ mod tests { | |||
43 | fn test_split_import() { | 43 | fn test_split_import() { |
44 | check_assist( | 44 | check_assist( |
45 | split_import, | 45 | split_import, |
46 | "use crate::<|>db::RootDatabase;", | 46 | "use crate::$0db::RootDatabase;", |
47 | "use crate::{db::RootDatabase};", | 47 | "use crate::{db::RootDatabase};", |
48 | ) | 48 | ) |
49 | } | 49 | } |
@@ -52,19 +52,19 @@ mod tests { | |||
52 | fn split_import_works_with_trees() { | 52 | fn split_import_works_with_trees() { |
53 | check_assist( | 53 | check_assist( |
54 | split_import, | 54 | split_import, |
55 | "use crate:<|>:db::{RootDatabase, FileSymbol}", | 55 | "use crate:$0:db::{RootDatabase, FileSymbol}", |
56 | "use crate::{db::{RootDatabase, FileSymbol}}", | 56 | "use crate::{db::{RootDatabase, FileSymbol}}", |
57 | ) | 57 | ) |
58 | } | 58 | } |
59 | 59 | ||
60 | #[test] | 60 | #[test] |
61 | fn split_import_target() { | 61 | fn split_import_target() { |
62 | check_assist_target(split_import, "use crate::<|>db::{RootDatabase, FileSymbol}", "::"); | 62 | check_assist_target(split_import, "use crate::$0db::{RootDatabase, FileSymbol}", "::"); |
63 | } | 63 | } |
64 | 64 | ||
65 | #[test] | 65 | #[test] |
66 | fn issue4044() { | 66 | fn issue4044() { |
67 | check_assist_not_applicable(split_import, "use crate::<|>:::self;") | 67 | check_assist_not_applicable(split_import, "use crate::$0:::self;") |
68 | } | 68 | } |
69 | 69 | ||
70 | #[test] | 70 | #[test] |
@@ -72,7 +72,7 @@ mod tests { | |||
72 | check_assist_not_applicable( | 72 | check_assist_not_applicable( |
73 | split_import, | 73 | split_import, |
74 | r" | 74 | r" |
75 | use std::<|> | 75 | use std::$0 |
76 | fn main() {}", | 76 | fn main() {}", |
77 | ); | 77 | ); |
78 | } | 78 | } |
diff --git a/crates/assists/src/handlers/toggle_ignore.rs b/crates/assists/src/handlers/toggle_ignore.rs index 14b420421..33e12a7d0 100644 --- a/crates/assists/src/handlers/toggle_ignore.rs +++ b/crates/assists/src/handlers/toggle_ignore.rs | |||
@@ -10,7 +10,7 @@ use crate::{utils::test_related_attribute, AssistContext, AssistId, AssistKind, | |||
10 | // Adds `#[ignore]` attribute to the test. | 10 | // Adds `#[ignore]` attribute to the test. |
11 | // | 11 | // |
12 | // ``` | 12 | // ``` |
13 | // <|>#[test] | 13 | // $0#[test] |
14 | // fn arithmetics { | 14 | // fn arithmetics { |
15 | // assert_eq!(2 + 2, 5); | 15 | // assert_eq!(2 + 2, 5); |
16 | // } | 16 | // } |
@@ -69,7 +69,7 @@ mod tests { | |||
69 | check_assist( | 69 | check_assist( |
70 | toggle_ignore, | 70 | toggle_ignore, |
71 | r#" | 71 | r#" |
72 | #[test<|>] | 72 | #[test$0] |
73 | fn test() {} | 73 | fn test() {} |
74 | "#, | 74 | "#, |
75 | r#" | 75 | r#" |
@@ -85,7 +85,7 @@ mod tests { | |||
85 | check_assist( | 85 | check_assist( |
86 | toggle_ignore, | 86 | toggle_ignore, |
87 | r#" | 87 | r#" |
88 | #[test<|>] | 88 | #[test$0] |
89 | #[ignore] | 89 | #[ignore] |
90 | fn test() {} | 90 | fn test() {} |
91 | "#, | 91 | "#, |
diff --git a/crates/assists/src/handlers/unwrap_block.rs b/crates/assists/src/handlers/unwrap_block.rs index 676db7137..ed6f6177d 100644 --- a/crates/assists/src/handlers/unwrap_block.rs +++ b/crates/assists/src/handlers/unwrap_block.rs | |||
@@ -14,7 +14,7 @@ use crate::{utils::unwrap_trivial_block, AssistContext, AssistId, AssistKind, As | |||
14 | // | 14 | // |
15 | // ``` | 15 | // ``` |
16 | // fn foo() { | 16 | // fn foo() { |
17 | // if true {<|> | 17 | // if true {$0 |
18 | // println!("foo"); | 18 | // println!("foo"); |
19 | // } | 19 | // } |
20 | // } | 20 | // } |
@@ -124,7 +124,7 @@ mod tests { | |||
124 | unwrap_block, | 124 | unwrap_block, |
125 | r#" | 125 | r#" |
126 | fn main() { | 126 | fn main() { |
127 | <|>{ | 127 | $0{ |
128 | 92 | 128 | 92 |
129 | } | 129 | } |
130 | } | 130 | } |
@@ -143,7 +143,7 @@ fn main() { | |||
143 | unwrap_block, | 143 | unwrap_block, |
144 | r#" | 144 | r#" |
145 | fn main() { | 145 | fn main() { |
146 | <|>{ | 146 | $0{ |
147 | 92; | 147 | 92; |
148 | } | 148 | } |
149 | () | 149 | () |
@@ -161,7 +161,7 @@ fn main() { | |||
161 | unwrap_block, | 161 | unwrap_block, |
162 | r#" | 162 | r#" |
163 | fn main() { | 163 | fn main() { |
164 | <|>{ | 164 | $0{ |
165 | 92 | 165 | 92 |
166 | } | 166 | } |
167 | () | 167 | () |
@@ -183,7 +183,7 @@ fn main() { | |||
183 | r#" | 183 | r#" |
184 | fn main() { | 184 | fn main() { |
185 | bar(); | 185 | bar(); |
186 | if true {<|> | 186 | if true {$0 |
187 | foo(); | 187 | foo(); |
188 | 188 | ||
189 | //comment | 189 | //comment |
@@ -217,7 +217,7 @@ fn main() { | |||
217 | 217 | ||
218 | //comment | 218 | //comment |
219 | bar(); | 219 | bar(); |
220 | } else {<|> | 220 | } else {$0 |
221 | println!("bar"); | 221 | println!("bar"); |
222 | } | 222 | } |
223 | } | 223 | } |
@@ -249,7 +249,7 @@ fn main() { | |||
249 | 249 | ||
250 | //comment | 250 | //comment |
251 | //bar(); | 251 | //bar(); |
252 | } else if false {<|> | 252 | } else if false {$0 |
253 | println!("bar"); | 253 | println!("bar"); |
254 | } else { | 254 | } else { |
255 | println!("foo"); | 255 | println!("foo"); |
@@ -285,7 +285,7 @@ fn main() { | |||
285 | //bar(); | 285 | //bar(); |
286 | } else if false { | 286 | } else if false { |
287 | println!("bar"); | 287 | println!("bar"); |
288 | } else if true {<|> | 288 | } else if true {$0 |
289 | println!("foo"); | 289 | println!("foo"); |
290 | } | 290 | } |
291 | } | 291 | } |
@@ -323,7 +323,7 @@ fn main() { | |||
323 | println!("bar"); | 323 | println!("bar"); |
324 | } else if true { | 324 | } else if true { |
325 | println!("foo"); | 325 | println!("foo"); |
326 | } else {<|> | 326 | } else {$0 |
327 | println!("else"); | 327 | println!("else"); |
328 | } | 328 | } |
329 | } | 329 | } |
@@ -361,7 +361,7 @@ fn main() { | |||
361 | //bar(); | 361 | //bar(); |
362 | } else if false { | 362 | } else if false { |
363 | println!("bar"); | 363 | println!("bar"); |
364 | } else if true {<|> | 364 | } else if true {$0 |
365 | println!("foo"); | 365 | println!("foo"); |
366 | } else { | 366 | } else { |
367 | println!("else"); | 367 | println!("else"); |
@@ -391,7 +391,7 @@ fn main() { | |||
391 | unwrap_block, | 391 | unwrap_block, |
392 | r#" | 392 | r#" |
393 | fn main() { | 393 | fn main() { |
394 | bar();<|> | 394 | bar();$0 |
395 | if true { | 395 | if true { |
396 | foo(); | 396 | foo(); |
397 | 397 | ||
@@ -411,7 +411,7 @@ fn main() { | |||
411 | unwrap_block, | 411 | unwrap_block, |
412 | r#" | 412 | r#" |
413 | fn main() { | 413 | fn main() { |
414 | for i in 0..5 {<|> | 414 | for i in 0..5 {$0 |
415 | if true { | 415 | if true { |
416 | foo(); | 416 | foo(); |
417 | 417 | ||
@@ -445,7 +445,7 @@ fn main() { | |||
445 | r#" | 445 | r#" |
446 | fn main() { | 446 | fn main() { |
447 | for i in 0..5 { | 447 | for i in 0..5 { |
448 | if true {<|> | 448 | if true {$0 |
449 | foo(); | 449 | foo(); |
450 | 450 | ||
451 | //comment | 451 | //comment |
@@ -475,7 +475,7 @@ fn main() { | |||
475 | unwrap_block, | 475 | unwrap_block, |
476 | r#" | 476 | r#" |
477 | fn main() { | 477 | fn main() { |
478 | loop {<|> | 478 | loop {$0 |
479 | if true { | 479 | if true { |
480 | foo(); | 480 | foo(); |
481 | 481 | ||
@@ -508,7 +508,7 @@ fn main() { | |||
508 | unwrap_block, | 508 | unwrap_block, |
509 | r#" | 509 | r#" |
510 | fn main() { | 510 | fn main() { |
511 | while true {<|> | 511 | while true {$0 |
512 | if true { | 512 | if true { |
513 | foo(); | 513 | foo(); |
514 | 514 | ||
@@ -542,7 +542,7 @@ fn main() { | |||
542 | r#" | 542 | r#" |
543 | fn main() { | 543 | fn main() { |
544 | match rel_path { | 544 | match rel_path { |
545 | Ok(rel_path) => {<|> | 545 | Ok(rel_path) => {$0 |
546 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; | 546 | let rel_path = RelativePathBuf::from_path(rel_path).ok()?; |
547 | Some((*id, rel_path)) | 547 | Some((*id, rel_path)) |
548 | } | 548 | } |
@@ -567,7 +567,7 @@ fn main() { | |||
567 | fn main() { | 567 | fn main() { |
568 | while true { | 568 | while true { |
569 | if true { | 569 | if true { |
570 | foo();<|> | 570 | foo();$0 |
571 | 571 | ||
572 | //comment | 572 | //comment |
573 | bar(); | 573 | bar(); |
diff --git a/crates/assists/src/handlers/wrap_return_type_in_result.rs b/crates/assists/src/handlers/wrap_return_type_in_result.rs index 358b61046..fec16fc49 100644 --- a/crates/assists/src/handlers/wrap_return_type_in_result.rs +++ b/crates/assists/src/handlers/wrap_return_type_in_result.rs | |||
@@ -13,7 +13,7 @@ use crate::{AssistContext, AssistId, AssistKind, Assists}; | |||
13 | // Wrap the function's return type into Result. | 13 | // Wrap the function's return type into Result. |
14 | // | 14 | // |
15 | // ``` | 15 | // ``` |
16 | // fn foo() -> i32<|> { 42i32 } | 16 | // fn foo() -> i32$0 { 42i32 } |
17 | // ``` | 17 | // ``` |
18 | // -> | 18 | // -> |
19 | // ``` | 19 | // ``` |
@@ -282,7 +282,7 @@ mod tests { | |||
282 | check_assist( | 282 | check_assist( |
283 | wrap_return_type_in_result, | 283 | wrap_return_type_in_result, |
284 | r#" | 284 | r#" |
285 | fn foo() -> i3<|>2 { | 285 | fn foo() -> i3$02 { |
286 | let test = "test"; | 286 | let test = "test"; |
287 | return 42i32; | 287 | return 42i32; |
288 | } | 288 | } |
@@ -302,7 +302,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
302 | wrap_return_type_in_result, | 302 | wrap_return_type_in_result, |
303 | r#" | 303 | r#" |
304 | fn foo() { | 304 | fn foo() { |
305 | || -> i32<|> { | 305 | || -> i32$0 { |
306 | let test = "test"; | 306 | let test = "test"; |
307 | return 42i32; | 307 | return 42i32; |
308 | }; | 308 | }; |
@@ -325,7 +325,7 @@ fn foo() { | |||
325 | wrap_return_type_in_result, | 325 | wrap_return_type_in_result, |
326 | r#" | 326 | r#" |
327 | fn foo() -> i32 { | 327 | fn foo() -> i32 { |
328 | let test = "test";<|> | 328 | let test = "test";$0 |
329 | return 42i32; | 329 | return 42i32; |
330 | } | 330 | } |
331 | "#, | 331 | "#, |
@@ -339,7 +339,7 @@ fn foo() -> i32 { | |||
339 | r#" | 339 | r#" |
340 | fn foo() { | 340 | fn foo() { |
341 | || -> i32 { | 341 | || -> i32 { |
342 | let test = "test";<|> | 342 | let test = "test";$0 |
343 | return 42i32; | 343 | return 42i32; |
344 | }; | 344 | }; |
345 | } | 345 | } |
@@ -349,7 +349,7 @@ fn foo() { | |||
349 | 349 | ||
350 | #[test] | 350 | #[test] |
351 | fn wrap_return_type_in_result_closure_non_block() { | 351 | fn wrap_return_type_in_result_closure_non_block() { |
352 | check_assist_not_applicable(wrap_return_type_in_result, r#"fn foo() { || -> i<|>32 3; }"#); | 352 | check_assist_not_applicable(wrap_return_type_in_result, r#"fn foo() { || -> i$032 3; }"#); |
353 | } | 353 | } |
354 | 354 | ||
355 | #[test] | 355 | #[test] |
@@ -357,7 +357,7 @@ fn foo() { | |||
357 | check_assist_not_applicable( | 357 | check_assist_not_applicable( |
358 | wrap_return_type_in_result, | 358 | wrap_return_type_in_result, |
359 | r#" | 359 | r#" |
360 | fn foo() -> std::result::Result<i32<|>, String> { | 360 | fn foo() -> std::result::Result<i32$0, String> { |
361 | let test = "test"; | 361 | let test = "test"; |
362 | return 42i32; | 362 | return 42i32; |
363 | } | 363 | } |
@@ -371,7 +371,7 @@ fn foo() -> std::result::Result<i32<|>, String> { | |||
371 | check_assist_not_applicable( | 371 | check_assist_not_applicable( |
372 | wrap_return_type_in_result, | 372 | wrap_return_type_in_result, |
373 | r#" | 373 | r#" |
374 | fn foo() -> Result<i32<|>, String> { | 374 | fn foo() -> Result<i32$0, String> { |
375 | let test = "test"; | 375 | let test = "test"; |
376 | return 42i32; | 376 | return 42i32; |
377 | } | 377 | } |
@@ -385,7 +385,7 @@ fn foo() -> Result<i32<|>, String> { | |||
385 | wrap_return_type_in_result, | 385 | wrap_return_type_in_result, |
386 | r#" | 386 | r#" |
387 | fn foo() { | 387 | fn foo() { |
388 | || -> Result<i32<|>, String> { | 388 | || -> Result<i32$0, String> { |
389 | let test = "test"; | 389 | let test = "test"; |
390 | return 42i32; | 390 | return 42i32; |
391 | }; | 391 | }; |
@@ -399,7 +399,7 @@ fn foo() { | |||
399 | check_assist( | 399 | check_assist( |
400 | wrap_return_type_in_result, | 400 | wrap_return_type_in_result, |
401 | r#" | 401 | r#" |
402 | fn foo() -> <|>i32 { | 402 | fn foo() -> $0i32 { |
403 | let test = "test"; | 403 | let test = "test"; |
404 | return 42i32; | 404 | return 42i32; |
405 | } | 405 | } |
@@ -418,7 +418,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
418 | check_assist( | 418 | check_assist( |
419 | wrap_return_type_in_result, | 419 | wrap_return_type_in_result, |
420 | r#" | 420 | r#" |
421 | fn foo() -><|> i32 { | 421 | fn foo() ->$0 i32 { |
422 | let test = "test"; | 422 | let test = "test"; |
423 | 42i32 | 423 | 42i32 |
424 | } | 424 | } |
@@ -438,7 +438,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
438 | wrap_return_type_in_result, | 438 | wrap_return_type_in_result, |
439 | r#" | 439 | r#" |
440 | fn foo() { | 440 | fn foo() { |
441 | || -><|> i32 { | 441 | || ->$0 i32 { |
442 | let test = "test"; | 442 | let test = "test"; |
443 | 42i32 | 443 | 42i32 |
444 | }; | 444 | }; |
@@ -459,7 +459,7 @@ fn foo() { | |||
459 | fn wrap_return_type_in_result_simple_with_tail_only() { | 459 | fn wrap_return_type_in_result_simple_with_tail_only() { |
460 | check_assist( | 460 | check_assist( |
461 | wrap_return_type_in_result, | 461 | wrap_return_type_in_result, |
462 | r#"fn foo() -> i32<|> { 42i32 }"#, | 462 | r#"fn foo() -> i32$0 { 42i32 }"#, |
463 | r#"fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }"#, | 463 | r#"fn foo() -> Result<i32, ${0:_}> { Ok(42i32) }"#, |
464 | ); | 464 | ); |
465 | } | 465 | } |
@@ -469,7 +469,7 @@ fn foo() { | |||
469 | check_assist( | 469 | check_assist( |
470 | wrap_return_type_in_result, | 470 | wrap_return_type_in_result, |
471 | r#" | 471 | r#" |
472 | fn foo() -> i32<|> { | 472 | fn foo() -> i32$0 { |
473 | if true { | 473 | if true { |
474 | 42i32 | 474 | 42i32 |
475 | } else { | 475 | } else { |
@@ -495,7 +495,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
495 | wrap_return_type_in_result, | 495 | wrap_return_type_in_result, |
496 | r#" | 496 | r#" |
497 | fn foo() { | 497 | fn foo() { |
498 | || -> i32<|> { | 498 | || -> i32$0 { |
499 | if true { | 499 | if true { |
500 | 42i32 | 500 | 42i32 |
501 | } else { | 501 | } else { |
@@ -523,7 +523,7 @@ fn foo() { | |||
523 | check_assist( | 523 | check_assist( |
524 | wrap_return_type_in_result, | 524 | wrap_return_type_in_result, |
525 | r#" | 525 | r#" |
526 | fn foo() -> i32<|> { | 526 | fn foo() -> i32$0 { |
527 | if true { | 527 | if true { |
528 | if false { | 528 | if false { |
529 | 1 | 529 | 1 |
@@ -556,7 +556,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
556 | check_assist( | 556 | check_assist( |
557 | wrap_return_type_in_result, | 557 | wrap_return_type_in_result, |
558 | r#" | 558 | r#" |
559 | async fn foo() -> i<|>32 { | 559 | async fn foo() -> i$032 { |
560 | if true { | 560 | if true { |
561 | if false { | 561 | if false { |
562 | 1.await | 562 | 1.await |
@@ -588,7 +588,7 @@ async fn foo() -> Result<i32, ${0:_}> { | |||
588 | fn wrap_return_type_in_result_simple_with_array() { | 588 | fn wrap_return_type_in_result_simple_with_array() { |
589 | check_assist( | 589 | check_assist( |
590 | wrap_return_type_in_result, | 590 | wrap_return_type_in_result, |
591 | r#"fn foo() -> [i32;<|> 3] { [1, 2, 3] }"#, | 591 | r#"fn foo() -> [i32;$0 3] { [1, 2, 3] }"#, |
592 | r#"fn foo() -> Result<[i32; 3], ${0:_}> { Ok([1, 2, 3]) }"#, | 592 | r#"fn foo() -> Result<[i32; 3], ${0:_}> { Ok([1, 2, 3]) }"#, |
593 | ); | 593 | ); |
594 | } | 594 | } |
@@ -598,7 +598,7 @@ async fn foo() -> Result<i32, ${0:_}> { | |||
598 | check_assist( | 598 | check_assist( |
599 | wrap_return_type_in_result, | 599 | wrap_return_type_in_result, |
600 | r#" | 600 | r#" |
601 | fn foo() -<|>> i32 { | 601 | fn foo() -$0> i32 { |
602 | if true { | 602 | if true { |
603 | if false { | 603 | if false { |
604 | 1 as i32 | 604 | 1 as i32 |
@@ -631,7 +631,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
631 | check_assist( | 631 | check_assist( |
632 | wrap_return_type_in_result, | 632 | wrap_return_type_in_result, |
633 | r#" | 633 | r#" |
634 | fn foo() -> i32<|> { | 634 | fn foo() -> i32$0 { |
635 | let my_var = 5; | 635 | let my_var = 5; |
636 | match my_var { | 636 | match my_var { |
637 | 5 => 42i32, | 637 | 5 => 42i32, |
@@ -656,7 +656,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
656 | check_assist( | 656 | check_assist( |
657 | wrap_return_type_in_result, | 657 | wrap_return_type_in_result, |
658 | r#" | 658 | r#" |
659 | fn foo() -> i32<|> { | 659 | fn foo() -> i32$0 { |
660 | let my_var = 5; | 660 | let my_var = 5; |
661 | loop { | 661 | loop { |
662 | println!("test"); | 662 | println!("test"); |
@@ -683,7 +683,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
683 | check_assist( | 683 | check_assist( |
684 | wrap_return_type_in_result, | 684 | wrap_return_type_in_result, |
685 | r#" | 685 | r#" |
686 | fn foo() -> i32<|> { | 686 | fn foo() -> i32$0 { |
687 | let my_var = let x = loop { | 687 | let my_var = let x = loop { |
688 | break 1; | 688 | break 1; |
689 | }; | 689 | }; |
@@ -706,7 +706,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
706 | check_assist( | 706 | check_assist( |
707 | wrap_return_type_in_result, | 707 | wrap_return_type_in_result, |
708 | r#" | 708 | r#" |
709 | fn foo() -> i32<|> { | 709 | fn foo() -> i32$0 { |
710 | let my_var = 5; | 710 | let my_var = 5; |
711 | let res = match my_var { | 711 | let res = match my_var { |
712 | 5 => 42i32, | 712 | 5 => 42i32, |
@@ -730,7 +730,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
730 | check_assist( | 730 | check_assist( |
731 | wrap_return_type_in_result, | 731 | wrap_return_type_in_result, |
732 | r#" | 732 | r#" |
733 | fn foo() -> i32<|> { | 733 | fn foo() -> i32$0 { |
734 | let my_var = 5; | 734 | let my_var = 5; |
735 | let res = if my_var == 5 { | 735 | let res = if my_var == 5 { |
736 | 42i32 | 736 | 42i32 |
@@ -759,7 +759,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
759 | check_assist( | 759 | check_assist( |
760 | wrap_return_type_in_result, | 760 | wrap_return_type_in_result, |
761 | r#" | 761 | r#" |
762 | fn foo() -> i32<|> { | 762 | fn foo() -> i32$0 { |
763 | let my_var = 5; | 763 | let my_var = 5; |
764 | match my_var { | 764 | match my_var { |
765 | 5 => { | 765 | 5 => { |
@@ -808,7 +808,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
808 | check_assist( | 808 | check_assist( |
809 | wrap_return_type_in_result, | 809 | wrap_return_type_in_result, |
810 | r#" | 810 | r#" |
811 | fn foo() -> i<|>32 { | 811 | fn foo() -> i$032 { |
812 | let test = "test"; | 812 | let test = "test"; |
813 | if test == "test" { | 813 | if test == "test" { |
814 | return 24i32; | 814 | return 24i32; |
@@ -833,7 +833,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
833 | check_assist( | 833 | check_assist( |
834 | wrap_return_type_in_result, | 834 | wrap_return_type_in_result, |
835 | r#" | 835 | r#" |
836 | fn foo(the_field: u32) -><|> u32 { | 836 | fn foo(the_field: u32) ->$0 u32 { |
837 | let true_closure = || { return true; }; | 837 | let true_closure = || { return true; }; |
838 | if the_field < 5 { | 838 | if the_field < 5 { |
839 | let mut i = 0; | 839 | let mut i = 0; |
@@ -865,7 +865,7 @@ fn foo(the_field: u32) -> Result<u32, ${0:_}> { | |||
865 | check_assist( | 865 | check_assist( |
866 | wrap_return_type_in_result, | 866 | wrap_return_type_in_result, |
867 | r#" | 867 | r#" |
868 | fn foo(the_field: u32) -> u32<|> { | 868 | fn foo(the_field: u32) -> u32$0 { |
869 | let true_closure = || { | 869 | let true_closure = || { |
870 | return true; | 870 | return true; |
871 | }; | 871 | }; |
@@ -912,7 +912,7 @@ fn foo(the_field: u32) -> Result<u32, ${0:_}> { | |||
912 | check_assist( | 912 | check_assist( |
913 | wrap_return_type_in_result, | 913 | wrap_return_type_in_result, |
914 | r#" | 914 | r#" |
915 | fn foo() -> i32<|> { | 915 | fn foo() -> i32$0 { |
916 | let test = "test"; | 916 | let test = "test"; |
917 | if test == "test" { | 917 | if test == "test" { |
918 | return 24i32; | 918 | return 24i32; |
@@ -946,7 +946,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
946 | check_assist( | 946 | check_assist( |
947 | wrap_return_type_in_result, | 947 | wrap_return_type_in_result, |
948 | r#" | 948 | r#" |
949 | fn foo() -> i32<|> { | 949 | fn foo() -> i32$0 { |
950 | let test = "test"; | 950 | let test = "test"; |
951 | if test == "test" { | 951 | if test == "test" { |
952 | return 24i32; | 952 | return 24i32; |
@@ -984,7 +984,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
984 | check_assist( | 984 | check_assist( |
985 | wrap_return_type_in_result, | 985 | wrap_return_type_in_result, |
986 | r#" | 986 | r#" |
987 | fn foo() -> i3<|>2 { | 987 | fn foo() -> i3$02 { |
988 | let test = "test"; | 988 | let test = "test"; |
989 | let other = 5; | 989 | let other = 5; |
990 | if test == "test" { | 990 | if test == "test" { |
@@ -1030,7 +1030,7 @@ fn foo() -> Result<i32, ${0:_}> { | |||
1030 | check_assist( | 1030 | check_assist( |
1031 | wrap_return_type_in_result, | 1031 | wrap_return_type_in_result, |
1032 | r#" | 1032 | r#" |
1033 | fn foo(the_field: u32) -> u32<|> { | 1033 | fn foo(the_field: u32) -> u32$0 { |
1034 | if the_field < 5 { | 1034 | if the_field < 5 { |
1035 | let mut i = 0; | 1035 | let mut i = 0; |
1036 | loop { | 1036 | loop { |
@@ -1070,7 +1070,7 @@ fn foo(the_field: u32) -> Result<u32, ${0:_}> { | |||
1070 | check_assist( | 1070 | check_assist( |
1071 | wrap_return_type_in_result, | 1071 | wrap_return_type_in_result, |
1072 | r#" | 1072 | r#" |
1073 | fn foo(the_field: u32) -> u3<|>2 { | 1073 | fn foo(the_field: u32) -> u3$02 { |
1074 | if the_field < 5 { | 1074 | if the_field < 5 { |
1075 | let mut i = 0; | 1075 | let mut i = 0; |
1076 | match i { | 1076 | match i { |
@@ -1098,7 +1098,7 @@ fn foo(the_field: u32) -> Result<u32, ${0:_}> { | |||
1098 | check_assist( | 1098 | check_assist( |
1099 | wrap_return_type_in_result, | 1099 | wrap_return_type_in_result, |
1100 | r#" | 1100 | r#" |
1101 | fn foo(the_field: u32) -> u32<|> { | 1101 | fn foo(the_field: u32) -> u32$0 { |
1102 | if the_field < 5 { | 1102 | if the_field < 5 { |
1103 | let mut i = 0; | 1103 | let mut i = 0; |
1104 | if i == 5 { | 1104 | if i == 5 { |
@@ -1128,7 +1128,7 @@ fn foo(the_field: u32) -> Result<u32, ${0:_}> { | |||
1128 | check_assist( | 1128 | check_assist( |
1129 | wrap_return_type_in_result, | 1129 | wrap_return_type_in_result, |
1130 | r#" | 1130 | r#" |
1131 | fn foo(the_field: u32) -> <|>u32 { | 1131 | fn foo(the_field: u32) -> $0u32 { |
1132 | if the_field < 5 { | 1132 | if the_field < 5 { |
1133 | let mut i = 0; | 1133 | let mut i = 0; |
1134 | if i == 5 { | 1134 | if i == 5 { |
diff --git a/crates/assists/src/tests.rs b/crates/assists/src/tests.rs index a4c6a7570..fef29a0b8 100644 --- a/crates/assists/src/tests.rs +++ b/crates/assists/src/tests.rs | |||
@@ -166,7 +166,7 @@ fn check(handler: Handler, before: &str, expected: ExpectedResult, assist_label: | |||
166 | 166 | ||
167 | #[test] | 167 | #[test] |
168 | fn assist_order_field_struct() { | 168 | fn assist_order_field_struct() { |
169 | let before = "struct Foo { <|>bar: u32 }"; | 169 | let before = "struct Foo { $0bar: u32 }"; |
170 | let (before_cursor_pos, before) = extract_offset(before); | 170 | let (before_cursor_pos, before) = extract_offset(before); |
171 | let (db, file_id) = with_single_file(&before); | 171 | let (db, file_id) = with_single_file(&before); |
172 | let frange = FileRange { file_id, range: TextRange::empty(before_cursor_pos) }; | 172 | let frange = FileRange { file_id, range: TextRange::empty(before_cursor_pos) }; |
@@ -181,7 +181,7 @@ fn assist_order_field_struct() { | |||
181 | fn assist_order_if_expr() { | 181 | fn assist_order_if_expr() { |
182 | let before = " | 182 | let before = " |
183 | pub fn test_some_range(a: int) -> bool { | 183 | pub fn test_some_range(a: int) -> bool { |
184 | if let 2..6 = <|>5<|> { | 184 | if let 2..6 = $05$0 { |
185 | true | 185 | true |
186 | } else { | 186 | } else { |
187 | false | 187 | false |
@@ -201,7 +201,7 @@ fn assist_order_if_expr() { | |||
201 | fn assist_filter_works() { | 201 | fn assist_filter_works() { |
202 | let before = " | 202 | let before = " |
203 | pub fn test_some_range(a: int) -> bool { | 203 | pub fn test_some_range(a: int) -> bool { |
204 | if let 2..6 = <|>5<|> { | 204 | if let 2..6 = $05$0 { |
205 | true | 205 | true |
206 | } else { | 206 | } else { |
207 | false | 207 | false |
diff --git a/crates/assists/src/tests/generated.rs b/crates/assists/src/tests/generated.rs index fdebee4fe..e28837b53 100644 --- a/crates/assists/src/tests/generated.rs +++ b/crates/assists/src/tests/generated.rs | |||
@@ -8,7 +8,7 @@ fn doctest_add_explicit_type() { | |||
8 | "add_explicit_type", | 8 | "add_explicit_type", |
9 | r#####" | 9 | r#####" |
10 | fn main() { | 10 | fn main() { |
11 | let x<|> = 92; | 11 | let x$0 = 92; |
12 | } | 12 | } |
13 | "#####, | 13 | "#####, |
14 | r#####" | 14 | r#####" |
@@ -25,7 +25,7 @@ fn doctest_add_hash() { | |||
25 | "add_hash", | 25 | "add_hash", |
26 | r#####" | 26 | r#####" |
27 | fn main() { | 27 | fn main() { |
28 | r#"Hello,<|> World!"#; | 28 | r#"Hello,$0 World!"#; |
29 | } | 29 | } |
30 | "#####, | 30 | "#####, |
31 | r#####" | 31 | r#####" |
@@ -49,7 +49,7 @@ trait Trait { | |||
49 | 49 | ||
50 | impl Trait for () { | 50 | impl Trait for () { |
51 | type X = (); | 51 | type X = (); |
52 | fn foo(&self) {}<|> | 52 | fn foo(&self) {}$0 |
53 | 53 | ||
54 | } | 54 | } |
55 | "#####, | 55 | "#####, |
@@ -81,7 +81,7 @@ trait Trait<T> { | |||
81 | fn bar(&self) {} | 81 | fn bar(&self) {} |
82 | } | 82 | } |
83 | 83 | ||
84 | impl Trait<u32> for () {<|> | 84 | impl Trait<u32> for () {$0 |
85 | 85 | ||
86 | } | 86 | } |
87 | "#####, | 87 | "#####, |
@@ -110,7 +110,7 @@ fn doctest_add_turbo_fish() { | |||
110 | r#####" | 110 | r#####" |
111 | fn make<T>() -> T { todo!() } | 111 | fn make<T>() -> T { todo!() } |
112 | fn main() { | 112 | fn main() { |
113 | let x = make<|>(); | 113 | let x = make$0(); |
114 | } | 114 | } |
115 | "#####, | 115 | "#####, |
116 | r#####" | 116 | r#####" |
@@ -128,7 +128,7 @@ fn doctest_apply_demorgan() { | |||
128 | "apply_demorgan", | 128 | "apply_demorgan", |
129 | r#####" | 129 | r#####" |
130 | fn main() { | 130 | fn main() { |
131 | if x != 4 ||<|> !y {} | 131 | if x != 4 ||$0 !y {} |
132 | } | 132 | } |
133 | "#####, | 133 | "#####, |
134 | r#####" | 134 | r#####" |
@@ -145,7 +145,7 @@ fn doctest_auto_import() { | |||
145 | "auto_import", | 145 | "auto_import", |
146 | r#####" | 146 | r#####" |
147 | fn main() { | 147 | fn main() { |
148 | let map = HashMap<|>::new(); | 148 | let map = HashMap$0::new(); |
149 | } | 149 | } |
150 | pub mod std { pub mod collections { pub struct HashMap { } } } | 150 | pub mod std { pub mod collections { pub struct HashMap { } } } |
151 | "#####, | 151 | "#####, |
@@ -165,7 +165,7 @@ fn doctest_change_visibility() { | |||
165 | check_doc_test( | 165 | check_doc_test( |
166 | "change_visibility", | 166 | "change_visibility", |
167 | r#####" | 167 | r#####" |
168 | <|>fn frobnicate() {} | 168 | $0fn frobnicate() {} |
169 | "#####, | 169 | "#####, |
170 | r#####" | 170 | r#####" |
171 | pub(crate) fn frobnicate() {} | 171 | pub(crate) fn frobnicate() {} |
@@ -178,7 +178,7 @@ fn doctest_convert_integer_literal() { | |||
178 | check_doc_test( | 178 | check_doc_test( |
179 | "convert_integer_literal", | 179 | "convert_integer_literal", |
180 | r#####" | 180 | r#####" |
181 | const _: i32 = 10<|>; | 181 | const _: i32 = 10$0; |
182 | "#####, | 182 | "#####, |
183 | r#####" | 183 | r#####" |
184 | const _: i32 = 0b1010; | 184 | const _: i32 = 0b1010; |
@@ -192,7 +192,7 @@ fn doctest_convert_to_guarded_return() { | |||
192 | "convert_to_guarded_return", | 192 | "convert_to_guarded_return", |
193 | r#####" | 193 | r#####" |
194 | fn main() { | 194 | fn main() { |
195 | <|>if cond { | 195 | $0if cond { |
196 | foo(); | 196 | foo(); |
197 | bar(); | 197 | bar(); |
198 | } | 198 | } |
@@ -220,7 +220,7 @@ mod foo { | |||
220 | pub struct Baz; | 220 | pub struct Baz; |
221 | } | 221 | } |
222 | 222 | ||
223 | use foo::*<|>; | 223 | use foo::*$0; |
224 | 224 | ||
225 | fn qux(bar: Bar, baz: Baz) {} | 225 | fn qux(bar: Bar, baz: Baz) {} |
226 | "#####, | 226 | "#####, |
@@ -242,7 +242,7 @@ fn doctest_extract_struct_from_enum_variant() { | |||
242 | check_doc_test( | 242 | check_doc_test( |
243 | "extract_struct_from_enum_variant", | 243 | "extract_struct_from_enum_variant", |
244 | r#####" | 244 | r#####" |
245 | enum A { <|>One(u32, u32) } | 245 | enum A { $0One(u32, u32) } |
246 | "#####, | 246 | "#####, |
247 | r#####" | 247 | r#####" |
248 | struct One(pub u32, pub u32); | 248 | struct One(pub u32, pub u32); |
@@ -258,7 +258,7 @@ fn doctest_extract_variable() { | |||
258 | "extract_variable", | 258 | "extract_variable", |
259 | r#####" | 259 | r#####" |
260 | fn main() { | 260 | fn main() { |
261 | <|>(1 + 2)<|> * 4; | 261 | $0(1 + 2)$0 * 4; |
262 | } | 262 | } |
263 | "#####, | 263 | "#####, |
264 | r#####" | 264 | r#####" |
@@ -279,7 +279,7 @@ enum Action { Move { distance: u32 }, Stop } | |||
279 | 279 | ||
280 | fn handle(action: Action) { | 280 | fn handle(action: Action) { |
281 | match action { | 281 | match action { |
282 | <|> | 282 | $0 |
283 | } | 283 | } |
284 | } | 284 | } |
285 | "#####, | 285 | "#####, |
@@ -305,7 +305,7 @@ mod m { | |||
305 | fn frobnicate() {} | 305 | fn frobnicate() {} |
306 | } | 306 | } |
307 | fn main() { | 307 | fn main() { |
308 | m::frobnicate<|>() {} | 308 | m::frobnicate$0() {} |
309 | } | 309 | } |
310 | "#####, | 310 | "#####, |
311 | r#####" | 311 | r#####" |
@@ -325,7 +325,7 @@ fn doctest_flip_binexpr() { | |||
325 | "flip_binexpr", | 325 | "flip_binexpr", |
326 | r#####" | 326 | r#####" |
327 | fn main() { | 327 | fn main() { |
328 | let _ = 90 +<|> 2; | 328 | let _ = 90 +$0 2; |
329 | } | 329 | } |
330 | "#####, | 330 | "#####, |
331 | r#####" | 331 | r#####" |
@@ -342,7 +342,7 @@ fn doctest_flip_comma() { | |||
342 | "flip_comma", | 342 | "flip_comma", |
343 | r#####" | 343 | r#####" |
344 | fn main() { | 344 | fn main() { |
345 | ((1, 2),<|> (3, 4)); | 345 | ((1, 2),$0 (3, 4)); |
346 | } | 346 | } |
347 | "#####, | 347 | "#####, |
348 | r#####" | 348 | r#####" |
@@ -358,7 +358,7 @@ fn doctest_flip_trait_bound() { | |||
358 | check_doc_test( | 358 | check_doc_test( |
359 | "flip_trait_bound", | 359 | "flip_trait_bound", |
360 | r#####" | 360 | r#####" |
361 | fn foo<T: Clone +<|> Copy>() { } | 361 | fn foo<T: Clone +$0 Copy>() { } |
362 | "#####, | 362 | "#####, |
363 | r#####" | 363 | r#####" |
364 | fn foo<T: Copy + Clone>() { } | 364 | fn foo<T: Copy + Clone>() { } |
@@ -373,7 +373,7 @@ fn doctest_generate_default_from_enum_variant() { | |||
373 | r#####" | 373 | r#####" |
374 | enum Version { | 374 | enum Version { |
375 | Undefined, | 375 | Undefined, |
376 | Minor<|>, | 376 | Minor$0, |
377 | Major, | 377 | Major, |
378 | } | 378 | } |
379 | "#####, | 379 | "#####, |
@@ -400,7 +400,7 @@ fn doctest_generate_derive() { | |||
400 | r#####" | 400 | r#####" |
401 | struct Point { | 401 | struct Point { |
402 | x: u32, | 402 | x: u32, |
403 | y: u32,<|> | 403 | y: u32,$0 |
404 | } | 404 | } |
405 | "#####, | 405 | "#####, |
406 | r#####" | 406 | r#####" |
@@ -418,7 +418,7 @@ fn doctest_generate_from_impl_for_enum() { | |||
418 | check_doc_test( | 418 | check_doc_test( |
419 | "generate_from_impl_for_enum", | 419 | "generate_from_impl_for_enum", |
420 | r#####" | 420 | r#####" |
421 | enum A { <|>One(u32) } | 421 | enum A { $0One(u32) } |
422 | "#####, | 422 | "#####, |
423 | r#####" | 423 | r#####" |
424 | enum A { One(u32) } | 424 | enum A { One(u32) } |
@@ -440,7 +440,7 @@ fn doctest_generate_function() { | |||
440 | struct Baz; | 440 | struct Baz; |
441 | fn baz() -> Baz { Baz } | 441 | fn baz() -> Baz { Baz } |
442 | fn foo() { | 442 | fn foo() { |
443 | bar<|>("", baz()); | 443 | bar$0("", baz()); |
444 | } | 444 | } |
445 | 445 | ||
446 | "#####, | 446 | "#####, |
@@ -465,7 +465,7 @@ fn doctest_generate_impl() { | |||
465 | "generate_impl", | 465 | "generate_impl", |
466 | r#####" | 466 | r#####" |
467 | struct Ctx<T: Clone> { | 467 | struct Ctx<T: Clone> { |
468 | data: T,<|> | 468 | data: T,$0 |
469 | } | 469 | } |
470 | "#####, | 470 | "#####, |
471 | r#####" | 471 | r#####" |
@@ -486,7 +486,7 @@ fn doctest_generate_new() { | |||
486 | "generate_new", | 486 | "generate_new", |
487 | r#####" | 487 | r#####" |
488 | struct Ctx<T: Clone> { | 488 | struct Ctx<T: Clone> { |
489 | data: T,<|> | 489 | data: T,$0 |
490 | } | 490 | } |
491 | "#####, | 491 | "#####, |
492 | r#####" | 492 | r#####" |
@@ -507,7 +507,7 @@ fn doctest_infer_function_return_type() { | |||
507 | check_doc_test( | 507 | check_doc_test( |
508 | "infer_function_return_type", | 508 | "infer_function_return_type", |
509 | r#####" | 509 | r#####" |
510 | fn foo() { 4<|>2i32 } | 510 | fn foo() { 4$02i32 } |
511 | "#####, | 511 | "#####, |
512 | r#####" | 512 | r#####" |
513 | fn foo() -> i32 { 42i32 } | 513 | fn foo() -> i32 { 42i32 } |
@@ -522,7 +522,7 @@ fn doctest_inline_function() { | |||
522 | r#####" | 522 | r#####" |
523 | fn add(a: u32, b: u32) -> u32 { a + b } | 523 | fn add(a: u32, b: u32) -> u32 { a + b } |
524 | fn main() { | 524 | fn main() { |
525 | let x = add<|>(1, 2); | 525 | let x = add$0(1, 2); |
526 | } | 526 | } |
527 | "#####, | 527 | "#####, |
528 | r#####" | 528 | r#####" |
@@ -544,7 +544,7 @@ fn doctest_inline_local_variable() { | |||
544 | "inline_local_variable", | 544 | "inline_local_variable", |
545 | r#####" | 545 | r#####" |
546 | fn main() { | 546 | fn main() { |
547 | let x<|> = 1 + 2; | 547 | let x$0 = 1 + 2; |
548 | x * 4; | 548 | x * 4; |
549 | } | 549 | } |
550 | "#####, | 550 | "#####, |
@@ -561,7 +561,7 @@ fn doctest_introduce_named_lifetime() { | |||
561 | check_doc_test( | 561 | check_doc_test( |
562 | "introduce_named_lifetime", | 562 | "introduce_named_lifetime", |
563 | r#####" | 563 | r#####" |
564 | impl Cursor<'_<|>> { | 564 | impl Cursor<'_$0> { |
565 | fn node(self) -> &SyntaxNode { | 565 | fn node(self) -> &SyntaxNode { |
566 | match self { | 566 | match self { |
567 | Cursor::Replace(node) | Cursor::Before(node) => node, | 567 | Cursor::Replace(node) | Cursor::Before(node) => node, |
@@ -587,7 +587,7 @@ fn doctest_invert_if() { | |||
587 | "invert_if", | 587 | "invert_if", |
588 | r#####" | 588 | r#####" |
589 | fn main() { | 589 | fn main() { |
590 | if<|> !y { A } else { B } | 590 | if$0 !y { A } else { B } |
591 | } | 591 | } |
592 | "#####, | 592 | "#####, |
593 | r#####" | 593 | r#####" |
@@ -604,7 +604,7 @@ fn doctest_make_raw_string() { | |||
604 | "make_raw_string", | 604 | "make_raw_string", |
605 | r#####" | 605 | r#####" |
606 | fn main() { | 606 | fn main() { |
607 | "Hello,<|> World!"; | 607 | "Hello,$0 World!"; |
608 | } | 608 | } |
609 | "#####, | 609 | "#####, |
610 | r#####" | 610 | r#####" |
@@ -621,7 +621,7 @@ fn doctest_make_usual_string() { | |||
621 | "make_usual_string", | 621 | "make_usual_string", |
622 | r#####" | 622 | r#####" |
623 | fn main() { | 623 | fn main() { |
624 | r#"Hello,<|> "World!""#; | 624 | r#"Hello,$0 "World!""#; |
625 | } | 625 | } |
626 | "#####, | 626 | "#####, |
627 | r#####" | 627 | r#####" |
@@ -637,7 +637,7 @@ fn doctest_merge_imports() { | |||
637 | check_doc_test( | 637 | check_doc_test( |
638 | "merge_imports", | 638 | "merge_imports", |
639 | r#####" | 639 | r#####" |
640 | use std::<|>fmt::Formatter; | 640 | use std::$0fmt::Formatter; |
641 | use std::io; | 641 | use std::io; |
642 | "#####, | 642 | "#####, |
643 | r#####" | 643 | r#####" |
@@ -655,7 +655,7 @@ enum Action { Move { distance: u32 }, Stop } | |||
655 | 655 | ||
656 | fn handle(action: Action) { | 656 | fn handle(action: Action) { |
657 | match action { | 657 | match action { |
658 | <|>Action::Move(..) => foo(), | 658 | $0Action::Move(..) => foo(), |
659 | Action::Stop => foo(), | 659 | Action::Stop => foo(), |
660 | } | 660 | } |
661 | } | 661 | } |
@@ -681,7 +681,7 @@ enum Action { Move { distance: u32 }, Stop } | |||
681 | 681 | ||
682 | fn handle(action: Action) { | 682 | fn handle(action: Action) { |
683 | match action { | 683 | match action { |
684 | Action::Move { distance } => <|>if distance > 10 { foo() }, | 684 | Action::Move { distance } => $0if distance > 10 { foo() }, |
685 | _ => (), | 685 | _ => (), |
686 | } | 686 | } |
687 | } | 687 | } |
@@ -704,7 +704,7 @@ fn doctest_move_bounds_to_where_clause() { | |||
704 | check_doc_test( | 704 | check_doc_test( |
705 | "move_bounds_to_where_clause", | 705 | "move_bounds_to_where_clause", |
706 | r#####" | 706 | r#####" |
707 | fn apply<T, U, <|>F: FnOnce(T) -> U>(f: F, x: T) -> U { | 707 | fn apply<T, U, $0F: FnOnce(T) -> U>(f: F, x: T) -> U { |
708 | f(x) | 708 | f(x) |
709 | } | 709 | } |
710 | "#####, | 710 | "#####, |
@@ -725,7 +725,7 @@ enum Action { Move { distance: u32 }, Stop } | |||
725 | 725 | ||
726 | fn handle(action: Action) { | 726 | fn handle(action: Action) { |
727 | match action { | 727 | match action { |
728 | Action::Move { distance } <|>if distance > 10 => foo(), | 728 | Action::Move { distance } $0if distance > 10 => foo(), |
729 | _ => (), | 729 | _ => (), |
730 | } | 730 | } |
731 | } | 731 | } |
@@ -750,7 +750,7 @@ fn doctest_move_module_to_file() { | |||
750 | check_doc_test( | 750 | check_doc_test( |
751 | "move_module_to_file", | 751 | "move_module_to_file", |
752 | r#####" | 752 | r#####" |
753 | mod <|>foo { | 753 | mod $0foo { |
754 | fn t() {} | 754 | fn t() {} |
755 | } | 755 | } |
756 | "#####, | 756 | "#####, |
@@ -769,7 +769,7 @@ fn main() { | |||
769 | let mut foo = 6; | 769 | let mut foo = 6; |
770 | 770 | ||
771 | if true { | 771 | if true { |
772 | <|>foo = 5; | 772 | $0foo = 5; |
773 | } else { | 773 | } else { |
774 | foo = 4; | 774 | foo = 4; |
775 | } | 775 | } |
@@ -795,7 +795,7 @@ fn doctest_qualify_path() { | |||
795 | "qualify_path", | 795 | "qualify_path", |
796 | r#####" | 796 | r#####" |
797 | fn main() { | 797 | fn main() { |
798 | let map = HashMap<|>::new(); | 798 | let map = HashMap$0::new(); |
799 | } | 799 | } |
800 | pub mod std { pub mod collections { pub struct HashMap { } } } | 800 | pub mod std { pub mod collections { pub struct HashMap { } } } |
801 | "#####, | 801 | "#####, |
@@ -814,7 +814,7 @@ fn doctest_remove_dbg() { | |||
814 | "remove_dbg", | 814 | "remove_dbg", |
815 | r#####" | 815 | r#####" |
816 | fn main() { | 816 | fn main() { |
817 | <|>dbg!(92); | 817 | $0dbg!(92); |
818 | } | 818 | } |
819 | "#####, | 819 | "#####, |
820 | r#####" | 820 | r#####" |
@@ -831,7 +831,7 @@ fn doctest_remove_hash() { | |||
831 | "remove_hash", | 831 | "remove_hash", |
832 | r#####" | 832 | r#####" |
833 | fn main() { | 833 | fn main() { |
834 | r#"Hello,<|> World!"#; | 834 | r#"Hello,$0 World!"#; |
835 | } | 835 | } |
836 | "#####, | 836 | "#####, |
837 | r#####" | 837 | r#####" |
@@ -848,7 +848,7 @@ fn doctest_remove_mut() { | |||
848 | "remove_mut", | 848 | "remove_mut", |
849 | r#####" | 849 | r#####" |
850 | impl Walrus { | 850 | impl Walrus { |
851 | fn feed(&mut<|> self, amount: u32) {} | 851 | fn feed(&mut$0 self, amount: u32) {} |
852 | } | 852 | } |
853 | "#####, | 853 | "#####, |
854 | r#####" | 854 | r#####" |
@@ -864,7 +864,7 @@ fn doctest_remove_unused_param() { | |||
864 | check_doc_test( | 864 | check_doc_test( |
865 | "remove_unused_param", | 865 | "remove_unused_param", |
866 | r#####" | 866 | r#####" |
867 | fn frobnicate(x: i32<|>) {} | 867 | fn frobnicate(x: i32$0) {} |
868 | 868 | ||
869 | fn main() { | 869 | fn main() { |
870 | frobnicate(92); | 870 | frobnicate(92); |
@@ -886,7 +886,7 @@ fn doctest_reorder_fields() { | |||
886 | "reorder_fields", | 886 | "reorder_fields", |
887 | r#####" | 887 | r#####" |
888 | struct Foo {foo: i32, bar: i32}; | 888 | struct Foo {foo: i32, bar: i32}; |
889 | const test: Foo = <|>Foo {bar: 0, foo: 1} | 889 | const test: Foo = $0Foo {bar: 0, foo: 1} |
890 | "#####, | 890 | "#####, |
891 | r#####" | 891 | r#####" |
892 | struct Foo {foo: i32, bar: i32}; | 892 | struct Foo {foo: i32, bar: i32}; |
@@ -901,7 +901,7 @@ fn doctest_replace_derive_with_manual_impl() { | |||
901 | "replace_derive_with_manual_impl", | 901 | "replace_derive_with_manual_impl", |
902 | r#####" | 902 | r#####" |
903 | trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } | 903 | trait Debug { fn fmt(&self, f: &mut Formatter) -> Result<()>; } |
904 | #[derive(Deb<|>ug, Display)] | 904 | #[derive(Deb$0ug, Display)] |
905 | struct S; | 905 | struct S; |
906 | "#####, | 906 | "#####, |
907 | r#####" | 907 | r#####" |
@@ -926,7 +926,7 @@ fn doctest_replace_if_let_with_match() { | |||
926 | enum Action { Move { distance: u32 }, Stop } | 926 | enum Action { Move { distance: u32 }, Stop } |
927 | 927 | ||
928 | fn handle(action: Action) { | 928 | fn handle(action: Action) { |
929 | <|>if let Action::Move { distance } = action { | 929 | $0if let Action::Move { distance } = action { |
930 | foo(distance) | 930 | foo(distance) |
931 | } else { | 931 | } else { |
932 | bar() | 932 | bar() |
@@ -951,7 +951,7 @@ fn doctest_replace_impl_trait_with_generic() { | |||
951 | check_doc_test( | 951 | check_doc_test( |
952 | "replace_impl_trait_with_generic", | 952 | "replace_impl_trait_with_generic", |
953 | r#####" | 953 | r#####" |
954 | fn foo(bar: <|>impl Bar) {} | 954 | fn foo(bar: $0impl Bar) {} |
955 | "#####, | 955 | "#####, |
956 | r#####" | 956 | r#####" |
957 | fn foo<B: Bar>(bar: B) {} | 957 | fn foo<B: Bar>(bar: B) {} |
@@ -967,7 +967,7 @@ fn doctest_replace_let_with_if_let() { | |||
967 | enum Option<T> { Some(T), None } | 967 | enum Option<T> { Some(T), None } |
968 | 968 | ||
969 | fn main(action: Action) { | 969 | fn main(action: Action) { |
970 | <|>let x = compute(); | 970 | $0let x = compute(); |
971 | } | 971 | } |
972 | 972 | ||
973 | fn compute() -> Option<i32> { None } | 973 | fn compute() -> Option<i32> { None } |
@@ -993,7 +993,7 @@ fn doctest_replace_match_with_if_let() { | |||
993 | enum Action { Move { distance: u32 }, Stop } | 993 | enum Action { Move { distance: u32 }, Stop } |
994 | 994 | ||
995 | fn handle(action: Action) { | 995 | fn handle(action: Action) { |
996 | <|>match action { | 996 | $0match action { |
997 | Action::Move { distance } => foo(distance), | 997 | Action::Move { distance } => foo(distance), |
998 | _ => bar(), | 998 | _ => bar(), |
999 | } | 999 | } |
@@ -1018,7 +1018,7 @@ fn doctest_replace_qualified_name_with_use() { | |||
1018 | check_doc_test( | 1018 | check_doc_test( |
1019 | "replace_qualified_name_with_use", | 1019 | "replace_qualified_name_with_use", |
1020 | r#####" | 1020 | r#####" |
1021 | fn process(map: std::collections::<|>HashMap<String, String>) {} | 1021 | fn process(map: std::collections::$0HashMap<String, String>) {} |
1022 | "#####, | 1022 | "#####, |
1023 | r#####" | 1023 | r#####" |
1024 | use std::collections::HashMap; | 1024 | use std::collections::HashMap; |
@@ -1034,7 +1034,7 @@ fn doctest_replace_string_with_char() { | |||
1034 | "replace_string_with_char", | 1034 | "replace_string_with_char", |
1035 | r#####" | 1035 | r#####" |
1036 | fn main() { | 1036 | fn main() { |
1037 | find("{<|>"); | 1037 | find("{$0"); |
1038 | } | 1038 | } |
1039 | "#####, | 1039 | "#####, |
1040 | r#####" | 1040 | r#####" |
@@ -1053,7 +1053,7 @@ fn doctest_replace_unwrap_with_match() { | |||
1053 | enum Result<T, E> { Ok(T), Err(E) } | 1053 | enum Result<T, E> { Ok(T), Err(E) } |
1054 | fn main() { | 1054 | fn main() { |
1055 | let x: Result<i32, i32> = Result::Ok(92); | 1055 | let x: Result<i32, i32> = Result::Ok(92); |
1056 | let y = x.<|>unwrap(); | 1056 | let y = x.$0unwrap(); |
1057 | } | 1057 | } |
1058 | "#####, | 1058 | "#####, |
1059 | r#####" | 1059 | r#####" |
@@ -1074,7 +1074,7 @@ fn doctest_split_import() { | |||
1074 | check_doc_test( | 1074 | check_doc_test( |
1075 | "split_import", | 1075 | "split_import", |
1076 | r#####" | 1076 | r#####" |
1077 | use std::<|>collections::HashMap; | 1077 | use std::$0collections::HashMap; |
1078 | "#####, | 1078 | "#####, |
1079 | r#####" | 1079 | r#####" |
1080 | use std::{collections::HashMap}; | 1080 | use std::{collections::HashMap}; |
@@ -1087,7 +1087,7 @@ fn doctest_toggle_ignore() { | |||
1087 | check_doc_test( | 1087 | check_doc_test( |
1088 | "toggle_ignore", | 1088 | "toggle_ignore", |
1089 | r#####" | 1089 | r#####" |
1090 | <|>#[test] | 1090 | $0#[test] |
1091 | fn arithmetics { | 1091 | fn arithmetics { |
1092 | assert_eq!(2 + 2, 5); | 1092 | assert_eq!(2 + 2, 5); |
1093 | } | 1093 | } |
@@ -1108,7 +1108,7 @@ fn doctest_unwrap_block() { | |||
1108 | "unwrap_block", | 1108 | "unwrap_block", |
1109 | r#####" | 1109 | r#####" |
1110 | fn foo() { | 1110 | fn foo() { |
1111 | if true {<|> | 1111 | if true {$0 |
1112 | println!("foo"); | 1112 | println!("foo"); |
1113 | } | 1113 | } |
1114 | } | 1114 | } |
@@ -1126,7 +1126,7 @@ fn doctest_wrap_return_type_in_result() { | |||
1126 | check_doc_test( | 1126 | check_doc_test( |
1127 | "wrap_return_type_in_result", | 1127 | "wrap_return_type_in_result", |
1128 | r#####" | 1128 | r#####" |
1129 | fn foo() -> i32<|> { 42i32 } | 1129 | fn foo() -> i32$0 { 42i32 } |
1130 | "#####, | 1130 | "#####, |
1131 | r#####" | 1131 | r#####" |
1132 | fn foo() -> Result<i32, ${0:_}> { Ok(42i32) } | 1132 | fn foo() -> Result<i32, ${0:_}> { Ok(42i32) } |
diff --git a/crates/completion/src/completions/attribute.rs b/crates/completion/src/completions/attribute.rs index 17276b5a4..10739750c 100644 --- a/crates/completion/src/completions/attribute.rs +++ b/crates/completion/src/completions/attribute.rs | |||
@@ -413,7 +413,7 @@ mod tests { | |||
413 | fn empty_derive_completion() { | 413 | fn empty_derive_completion() { |
414 | check( | 414 | check( |
415 | r#" | 415 | r#" |
416 | #[derive(<|>)] | 416 | #[derive($0)] |
417 | struct Test {} | 417 | struct Test {} |
418 | "#, | 418 | "#, |
419 | expect![[r#" | 419 | expect![[r#" |
@@ -434,7 +434,7 @@ struct Test {} | |||
434 | fn no_completion_for_incorrect_derive() { | 434 | fn no_completion_for_incorrect_derive() { |
435 | check( | 435 | check( |
436 | r#" | 436 | r#" |
437 | #[derive{<|>)] | 437 | #[derive{$0)] |
438 | struct Test {} | 438 | struct Test {} |
439 | "#, | 439 | "#, |
440 | expect![[r#""#]], | 440 | expect![[r#""#]], |
@@ -445,7 +445,7 @@ struct Test {} | |||
445 | fn derive_with_input_completion() { | 445 | fn derive_with_input_completion() { |
446 | check( | 446 | check( |
447 | r#" | 447 | r#" |
448 | #[derive(serde::Serialize, PartialEq, <|>)] | 448 | #[derive(serde::Serialize, PartialEq, $0)] |
449 | struct Test {} | 449 | struct Test {} |
450 | "#, | 450 | "#, |
451 | expect![[r#" | 451 | expect![[r#" |
@@ -464,7 +464,7 @@ struct Test {} | |||
464 | #[test] | 464 | #[test] |
465 | fn test_attribute_completion() { | 465 | fn test_attribute_completion() { |
466 | check( | 466 | check( |
467 | r#"#[<|>]"#, | 467 | r#"#[$0]"#, |
468 | expect![[r#" | 468 | expect![[r#" |
469 | at allow(…) | 469 | at allow(…) |
470 | at automatically_derived | 470 | at automatically_derived |
@@ -504,13 +504,13 @@ struct Test {} | |||
504 | 504 | ||
505 | #[test] | 505 | #[test] |
506 | fn test_attribute_completion_inside_nested_attr() { | 506 | fn test_attribute_completion_inside_nested_attr() { |
507 | check(r#"#[cfg(<|>)]"#, expect![[]]) | 507 | check(r#"#[cfg($0)]"#, expect![[]]) |
508 | } | 508 | } |
509 | 509 | ||
510 | #[test] | 510 | #[test] |
511 | fn test_inner_attribute_completion() { | 511 | fn test_inner_attribute_completion() { |
512 | check( | 512 | check( |
513 | r"#![<|>]", | 513 | r"#![$0]", |
514 | expect![[r#" | 514 | expect![[r#" |
515 | at allow(…) | 515 | at allow(…) |
516 | at automatically_derived | 516 | at automatically_derived |
diff --git a/crates/completion/src/completions/dot.rs b/crates/completion/src/completions/dot.rs index 551ef1771..2e25c8ba2 100644 --- a/crates/completion/src/completions/dot.rs +++ b/crates/completion/src/completions/dot.rs | |||
@@ -79,7 +79,7 @@ struct S { foo: u32 } | |||
79 | impl S { | 79 | impl S { |
80 | fn bar(&self) {} | 80 | fn bar(&self) {} |
81 | } | 81 | } |
82 | fn foo(s: S) { s.<|> } | 82 | fn foo(s: S) { s.$0 } |
83 | "#, | 83 | "#, |
84 | expect![[r#" | 84 | expect![[r#" |
85 | fd foo u32 | 85 | fd foo u32 |
@@ -94,7 +94,7 @@ fn foo(s: S) { s.<|> } | |||
94 | r#" | 94 | r#" |
95 | struct S { the_field: (u32,) } | 95 | struct S { the_field: (u32,) } |
96 | impl S { | 96 | impl S { |
97 | fn foo(self) { self.<|> } | 97 | fn foo(self) { self.$0 } |
98 | } | 98 | } |
99 | "#, | 99 | "#, |
100 | expect![[r#" | 100 | expect![[r#" |
@@ -110,7 +110,7 @@ impl S { | |||
110 | r#" | 110 | r#" |
111 | struct A { the_field: (u32, i32) } | 111 | struct A { the_field: (u32, i32) } |
112 | impl A { | 112 | impl A { |
113 | fn foo(&self) { self.<|> } | 113 | fn foo(&self) { self.$0 } |
114 | } | 114 | } |
115 | "#, | 115 | "#, |
116 | expect![[r#" | 116 | expect![[r#" |
@@ -126,7 +126,7 @@ impl A { | |||
126 | check( | 126 | check( |
127 | r#" | 127 | r#" |
128 | struct A { the_field: u32 } | 128 | struct A { the_field: u32 } |
129 | fn foo(a: A) { a.<|>() } | 129 | fn foo(a: A) { a.$0() } |
130 | "#, | 130 | "#, |
131 | expect![[""]], | 131 | expect![[""]], |
132 | ); | 132 | ); |
@@ -144,7 +144,7 @@ mod inner { | |||
144 | pub(crate) super_field: u32, | 144 | pub(crate) super_field: u32, |
145 | } | 145 | } |
146 | } | 146 | } |
147 | fn foo(a: inner::A) { a.<|> } | 147 | fn foo(a: inner::A) { a.$0 } |
148 | "#, | 148 | "#, |
149 | expect![[r#" | 149 | expect![[r#" |
150 | fd pub_field u32 | 150 | fd pub_field u32 |
@@ -162,7 +162,7 @@ mod m { | |||
162 | pub(crate) fn the_method(&self) {} | 162 | pub(crate) fn the_method(&self) {} |
163 | } | 163 | } |
164 | } | 164 | } |
165 | fn foo(a: A) { a.<|> } | 165 | fn foo(a: A) { a.$0 } |
166 | "#, | 166 | "#, |
167 | expect![[r#" | 167 | expect![[r#" |
168 | me the_method() pub(crate) fn the_method(&self) | 168 | me the_method() pub(crate) fn the_method(&self) |
@@ -175,7 +175,7 @@ fn foo(a: A) { a.<|> } | |||
175 | check( | 175 | check( |
176 | r#" | 176 | r#" |
177 | union U { field: u8, other: u16 } | 177 | union U { field: u8, other: u16 } |
178 | fn foo(u: U) { u.<|> } | 178 | fn foo(u: U) { u.$0 } |
179 | "#, | 179 | "#, |
180 | expect![[r#" | 180 | expect![[r#" |
181 | fd field u8 | 181 | fd field u8 |
@@ -195,7 +195,7 @@ impl A<u32> { | |||
195 | impl A<i32> { | 195 | impl A<i32> { |
196 | fn the_other_method(&self) {} | 196 | fn the_other_method(&self) {} |
197 | } | 197 | } |
198 | fn foo(a: A<u32>) { a.<|> } | 198 | fn foo(a: A<u32>) { a.$0 } |
199 | "#, | 199 | "#, |
200 | expect![[r#" | 200 | expect![[r#" |
201 | me the_method() fn the_method(&self) | 201 | me the_method() fn the_method(&self) |
@@ -210,7 +210,7 @@ fn foo(a: A<u32>) { a.<|> } | |||
210 | struct A {} | 210 | struct A {} |
211 | trait Trait { fn the_method(&self); } | 211 | trait Trait { fn the_method(&self); } |
212 | impl Trait for A {} | 212 | impl Trait for A {} |
213 | fn foo(a: A) { a.<|> } | 213 | fn foo(a: A) { a.$0 } |
214 | "#, | 214 | "#, |
215 | expect![[r#" | 215 | expect![[r#" |
216 | me the_method() fn the_method(&self) | 216 | me the_method() fn the_method(&self) |
@@ -225,7 +225,7 @@ fn foo(a: A) { a.<|> } | |||
225 | struct A {} | 225 | struct A {} |
226 | trait Trait { fn the_method(&self); } | 226 | trait Trait { fn the_method(&self); } |
227 | impl<T> Trait for T {} | 227 | impl<T> Trait for T {} |
228 | fn foo(a: &A) { a.<|> } | 228 | fn foo(a: &A) { a.$0 } |
229 | ", | 229 | ", |
230 | expect![[r#" | 230 | expect![[r#" |
231 | me the_method() fn the_method(&self) | 231 | me the_method() fn the_method(&self) |
@@ -243,7 +243,7 @@ mod m { | |||
243 | } | 243 | } |
244 | use m::Trait; | 244 | use m::Trait; |
245 | impl Trait for A {} | 245 | impl Trait for A {} |
246 | fn foo(a: A) { a.<|> } | 246 | fn foo(a: A) { a.$0 } |
247 | ", | 247 | ", |
248 | expect![[r#" | 248 | expect![[r#" |
249 | me the_method() fn the_method(&self) | 249 | me the_method() fn the_method(&self) |
@@ -260,7 +260,7 @@ impl A { | |||
260 | fn the_method() {} | 260 | fn the_method() {} |
261 | } | 261 | } |
262 | fn foo(a: A) { | 262 | fn foo(a: A) { |
263 | a.<|> | 263 | a.$0 |
264 | } | 264 | } |
265 | "#, | 265 | "#, |
266 | expect![[""]], | 266 | expect![[""]], |
@@ -273,7 +273,7 @@ fn foo(a: A) { | |||
273 | r#" | 273 | r#" |
274 | fn foo() { | 274 | fn foo() { |
275 | let b = (0, 3.14); | 275 | let b = (0, 3.14); |
276 | b.<|> | 276 | b.$0 |
277 | } | 277 | } |
278 | "#, | 278 | "#, |
279 | expect![[r#" | 279 | expect![[r#" |
@@ -295,7 +295,7 @@ struct T(S); | |||
295 | impl T { | 295 | impl T { |
296 | fn foo(&self) { | 296 | fn foo(&self) { |
297 | // FIXME: This doesn't work without the trailing `a` as `0.` is a float | 297 | // FIXME: This doesn't work without the trailing `a` as `0.` is a float |
298 | self.0.a<|> | 298 | self.0.a$0 |
299 | } | 299 | } |
300 | } | 300 | } |
301 | "#, | 301 | "#, |
@@ -311,7 +311,7 @@ impl T { | |||
311 | r#" | 311 | r#" |
312 | struct A { the_field: u32 } | 312 | struct A { the_field: u32 } |
313 | const X: u32 = { | 313 | const X: u32 = { |
314 | A { the_field: 92 }.<|> | 314 | A { the_field: 92 }.$0 |
315 | }; | 315 | }; |
316 | "#, | 316 | "#, |
317 | expect![[r#" | 317 | expect![[r#" |
@@ -327,7 +327,7 @@ const X: u32 = { | |||
327 | macro_rules! m { ($e:expr) => { $e } } | 327 | macro_rules! m { ($e:expr) => { $e } } |
328 | struct A { the_field: u32 } | 328 | struct A { the_field: u32 } |
329 | fn foo(a: A) { | 329 | fn foo(a: A) { |
330 | m!(a.x<|>) | 330 | m!(a.x$0) |
331 | } | 331 | } |
332 | "#, | 332 | "#, |
333 | expect![[r#" | 333 | expect![[r#" |
@@ -344,7 +344,7 @@ fn foo(a: A) { | |||
344 | macro_rules! m { ($e:expr) => { $e } } | 344 | macro_rules! m { ($e:expr) => { $e } } |
345 | struct A { the_field: u32 } | 345 | struct A { the_field: u32 } |
346 | fn foo(a: A) { | 346 | fn foo(a: A) { |
347 | m!(a.<|>) | 347 | m!(a.$0) |
348 | } | 348 | } |
349 | "#, | 349 | "#, |
350 | expect![[r#" | 350 | expect![[r#" |
@@ -360,7 +360,7 @@ fn foo(a: A) { | |||
360 | macro_rules! m { ($e:expr) => { $e } } | 360 | macro_rules! m { ($e:expr) => { $e } } |
361 | struct A { the_field: u32 } | 361 | struct A { the_field: u32 } |
362 | fn foo(a: A) { | 362 | fn foo(a: A) { |
363 | m!(m!(m!(a.x<|>))) | 363 | m!(m!(m!(a.x$0))) |
364 | } | 364 | } |
365 | "#, | 365 | "#, |
366 | expect![[r#" | 366 | expect![[r#" |
@@ -386,7 +386,7 @@ macro_rules! dbg { | |||
386 | } | 386 | } |
387 | struct A { the_field: u32 } | 387 | struct A { the_field: u32 } |
388 | fn foo(a: A) { | 388 | fn foo(a: A) { |
389 | dbg!(a.<|>) | 389 | dbg!(a.$0) |
390 | } | 390 | } |
391 | "#, | 391 | "#, |
392 | expect![[r#" | 392 | expect![[r#" |
@@ -405,7 +405,7 @@ impl<T> HashSet<T> { | |||
405 | } | 405 | } |
406 | fn foo() { | 406 | fn foo() { |
407 | let s: HashSet<_>; | 407 | let s: HashSet<_>; |
408 | s.<|> | 408 | s.$0 |
409 | } | 409 | } |
410 | "#, | 410 | "#, |
411 | expect![[r#" | 411 | expect![[r#" |
@@ -421,7 +421,7 @@ fn foo() { | |||
421 | struct S; | 421 | struct S; |
422 | impl S { fn foo(&self) {} } | 422 | impl S { fn foo(&self) {} } |
423 | macro_rules! make_s { () => { S }; } | 423 | macro_rules! make_s { () => { S }; } |
424 | fn main() { make_s!().f<|>; } | 424 | fn main() { make_s!().f$0; } |
425 | "#, | 425 | "#, |
426 | expect![[r#" | 426 | expect![[r#" |
427 | me foo() fn foo(&self) | 427 | me foo() fn foo(&self) |
diff --git a/crates/completion/src/completions/fn_param.rs b/crates/completion/src/completions/fn_param.rs index e777a53c1..5505c3559 100644 --- a/crates/completion/src/completions/fn_param.rs +++ b/crates/completion/src/completions/fn_param.rs | |||
@@ -81,7 +81,7 @@ mod tests { | |||
81 | r#" | 81 | r#" |
82 | fn foo(file_id: FileId) {} | 82 | fn foo(file_id: FileId) {} |
83 | fn bar(file_id: FileId) {} | 83 | fn bar(file_id: FileId) {} |
84 | fn baz(file<|>) {} | 84 | fn baz(file$0) {} |
85 | "#, | 85 | "#, |
86 | expect![[r#" | 86 | expect![[r#" |
87 | bn file_id: FileId | 87 | bn file_id: FileId |
@@ -94,7 +94,7 @@ fn baz(file<|>) {} | |||
94 | check( | 94 | check( |
95 | r#" | 95 | r#" |
96 | fn foo(file_id: FileId) {} | 96 | fn foo(file_id: FileId) {} |
97 | fn baz(file<|>, x: i32) {} | 97 | fn baz(file$0, x: i32) {} |
98 | "#, | 98 | "#, |
99 | expect![[r#" | 99 | expect![[r#" |
100 | bn file_id: FileId | 100 | bn file_id: FileId |
@@ -110,7 +110,7 @@ pub(crate) trait SourceRoot { | |||
110 | pub fn contains(&self, file_id: FileId) -> bool; | 110 | pub fn contains(&self, file_id: FileId) -> bool; |
111 | pub fn module_map(&self) -> &ModuleMap; | 111 | pub fn module_map(&self) -> &ModuleMap; |
112 | pub fn lines(&self, file_id: FileId) -> &LineIndex; | 112 | pub fn lines(&self, file_id: FileId) -> &LineIndex; |
113 | pub fn syntax(&self, file<|>) | 113 | pub fn syntax(&self, file$0) |
114 | } | 114 | } |
115 | "#, | 115 | "#, |
116 | expect![[r#" | 116 | expect![[r#" |
@@ -124,7 +124,7 @@ pub(crate) trait SourceRoot { | |||
124 | check( | 124 | check( |
125 | r#" | 125 | r#" |
126 | fn outer(text: String) { | 126 | fn outer(text: String) { |
127 | fn inner(<|>) | 127 | fn inner($0) |
128 | } | 128 | } |
129 | "#, | 129 | "#, |
130 | expect![[r#" | 130 | expect![[r#" |
diff --git a/crates/completion/src/completions/keyword.rs b/crates/completion/src/completions/keyword.rs index 1859dec70..425a688ff 100644 --- a/crates/completion/src/completions/keyword.rs +++ b/crates/completion/src/completions/keyword.rs | |||
@@ -193,7 +193,7 @@ mod tests { | |||
193 | #[test] | 193 | #[test] |
194 | fn test_keywords_in_use_stmt() { | 194 | fn test_keywords_in_use_stmt() { |
195 | check( | 195 | check( |
196 | r"use <|>", | 196 | r"use $0", |
197 | expect![[r#" | 197 | expect![[r#" |
198 | kw crate:: | 198 | kw crate:: |
199 | kw self | 199 | kw self |
@@ -202,7 +202,7 @@ mod tests { | |||
202 | ); | 202 | ); |
203 | 203 | ||
204 | check( | 204 | check( |
205 | r"use a::<|>", | 205 | r"use a::$0", |
206 | expect![[r#" | 206 | expect![[r#" |
207 | kw self | 207 | kw self |
208 | kw super:: | 208 | kw super:: |
@@ -210,7 +210,7 @@ mod tests { | |||
210 | ); | 210 | ); |
211 | 211 | ||
212 | check( | 212 | check( |
213 | r"use a::{b, <|>}", | 213 | r"use a::{b, $0}", |
214 | expect![[r#" | 214 | expect![[r#" |
215 | kw self | 215 | kw self |
216 | kw super:: | 216 | kw super:: |
@@ -221,7 +221,7 @@ mod tests { | |||
221 | #[test] | 221 | #[test] |
222 | fn test_keywords_at_source_file_level() { | 222 | fn test_keywords_at_source_file_level() { |
223 | check( | 223 | check( |
224 | r"m<|>", | 224 | r"m$0", |
225 | expect![[r#" | 225 | expect![[r#" |
226 | kw fn | 226 | kw fn |
227 | kw use | 227 | kw use |
@@ -245,7 +245,7 @@ mod tests { | |||
245 | #[test] | 245 | #[test] |
246 | fn test_keywords_in_function() { | 246 | fn test_keywords_in_function() { |
247 | check( | 247 | check( |
248 | r"fn quux() { <|> }", | 248 | r"fn quux() { $0 }", |
249 | expect![[r#" | 249 | expect![[r#" |
250 | kw fn | 250 | kw fn |
251 | kw use | 251 | kw use |
@@ -271,7 +271,7 @@ mod tests { | |||
271 | #[test] | 271 | #[test] |
272 | fn test_keywords_inside_block() { | 272 | fn test_keywords_inside_block() { |
273 | check( | 273 | check( |
274 | r"fn quux() { if true { <|> } }", | 274 | r"fn quux() { if true { $0 } }", |
275 | expect![[r#" | 275 | expect![[r#" |
276 | kw fn | 276 | kw fn |
277 | kw use | 277 | kw use |
@@ -297,7 +297,7 @@ mod tests { | |||
297 | #[test] | 297 | #[test] |
298 | fn test_keywords_after_if() { | 298 | fn test_keywords_after_if() { |
299 | check( | 299 | check( |
300 | r#"fn quux() { if true { () } <|> }"#, | 300 | r#"fn quux() { if true { () } $0 }"#, |
301 | expect![[r#" | 301 | expect![[r#" |
302 | kw fn | 302 | kw fn |
303 | kw use | 303 | kw use |
@@ -322,7 +322,7 @@ mod tests { | |||
322 | ); | 322 | ); |
323 | check_edit( | 323 | check_edit( |
324 | "else", | 324 | "else", |
325 | r#"fn quux() { if true { () } <|> }"#, | 325 | r#"fn quux() { if true { () } $0 }"#, |
326 | r#"fn quux() { if true { () } else {$0} }"#, | 326 | r#"fn quux() { if true { () } else {$0} }"#, |
327 | ); | 327 | ); |
328 | } | 328 | } |
@@ -332,7 +332,7 @@ mod tests { | |||
332 | check( | 332 | check( |
333 | r#" | 333 | r#" |
334 | fn quux() -> i32 { | 334 | fn quux() -> i32 { |
335 | match () { () => <|> } | 335 | match () { () => $0 } |
336 | } | 336 | } |
337 | "#, | 337 | "#, |
338 | expect![[r#" | 338 | expect![[r#" |
@@ -350,7 +350,7 @@ fn quux() -> i32 { | |||
350 | #[test] | 350 | #[test] |
351 | fn test_keywords_in_trait_def() { | 351 | fn test_keywords_in_trait_def() { |
352 | check( | 352 | check( |
353 | r"trait My { <|> }", | 353 | r"trait My { $0 }", |
354 | expect![[r#" | 354 | expect![[r#" |
355 | kw fn | 355 | kw fn |
356 | kw const | 356 | kw const |
@@ -363,7 +363,7 @@ fn quux() -> i32 { | |||
363 | #[test] | 363 | #[test] |
364 | fn test_keywords_in_impl_def() { | 364 | fn test_keywords_in_impl_def() { |
365 | check( | 365 | check( |
366 | r"impl My { <|> }", | 366 | r"impl My { $0 }", |
367 | expect![[r#" | 367 | expect![[r#" |
368 | kw fn | 368 | kw fn |
369 | kw const | 369 | kw const |
@@ -378,7 +378,7 @@ fn quux() -> i32 { | |||
378 | #[test] | 378 | #[test] |
379 | fn test_keywords_in_loop() { | 379 | fn test_keywords_in_loop() { |
380 | check( | 380 | check( |
381 | r"fn my() { loop { <|> } }", | 381 | r"fn my() { loop { $0 } }", |
382 | expect![[r#" | 382 | expect![[r#" |
383 | kw fn | 383 | kw fn |
384 | kw use | 384 | kw use |
@@ -406,7 +406,7 @@ fn quux() -> i32 { | |||
406 | #[test] | 406 | #[test] |
407 | fn test_keywords_after_unsafe_in_item_list() { | 407 | fn test_keywords_after_unsafe_in_item_list() { |
408 | check( | 408 | check( |
409 | r"unsafe <|>", | 409 | r"unsafe $0", |
410 | expect![[r#" | 410 | expect![[r#" |
411 | kw fn | 411 | kw fn |
412 | kw trait | 412 | kw trait |
@@ -418,7 +418,7 @@ fn quux() -> i32 { | |||
418 | #[test] | 418 | #[test] |
419 | fn test_keywords_after_unsafe_in_block_expr() { | 419 | fn test_keywords_after_unsafe_in_block_expr() { |
420 | check( | 420 | check( |
421 | r"fn my_fn() { unsafe <|> }", | 421 | r"fn my_fn() { unsafe $0 }", |
422 | expect![[r#" | 422 | expect![[r#" |
423 | kw fn | 423 | kw fn |
424 | kw trait | 424 | kw trait |
@@ -430,19 +430,19 @@ fn quux() -> i32 { | |||
430 | #[test] | 430 | #[test] |
431 | fn test_mut_in_ref_and_in_fn_parameters_list() { | 431 | fn test_mut_in_ref_and_in_fn_parameters_list() { |
432 | check( | 432 | check( |
433 | r"fn my_fn(&<|>) {}", | 433 | r"fn my_fn(&$0) {}", |
434 | expect![[r#" | 434 | expect![[r#" |
435 | kw mut | 435 | kw mut |
436 | "#]], | 436 | "#]], |
437 | ); | 437 | ); |
438 | check( | 438 | check( |
439 | r"fn my_fn(<|>) {}", | 439 | r"fn my_fn($0) {}", |
440 | expect![[r#" | 440 | expect![[r#" |
441 | kw mut | 441 | kw mut |
442 | "#]], | 442 | "#]], |
443 | ); | 443 | ); |
444 | check( | 444 | check( |
445 | r"fn my_fn() { let &<|> }", | 445 | r"fn my_fn() { let &$0 }", |
446 | expect![[r#" | 446 | expect![[r#" |
447 | kw mut | 447 | kw mut |
448 | "#]], | 448 | "#]], |
@@ -452,13 +452,13 @@ fn quux() -> i32 { | |||
452 | #[test] | 452 | #[test] |
453 | fn test_where_keyword() { | 453 | fn test_where_keyword() { |
454 | check( | 454 | check( |
455 | r"trait A <|>", | 455 | r"trait A $0", |
456 | expect![[r#" | 456 | expect![[r#" |
457 | kw where | 457 | kw where |
458 | "#]], | 458 | "#]], |
459 | ); | 459 | ); |
460 | check( | 460 | check( |
461 | r"impl A <|>", | 461 | r"impl A $0", |
462 | expect![[r#" | 462 | expect![[r#" |
463 | kw where | 463 | kw where |
464 | "#]], | 464 | "#]], |
@@ -471,7 +471,7 @@ fn quux() -> i32 { | |||
471 | check( | 471 | check( |
472 | r#" | 472 | r#" |
473 | fn test() { | 473 | fn test() { |
474 | let x = 2; // A comment<|> | 474 | let x = 2; // A comment$0 |
475 | } | 475 | } |
476 | "#, | 476 | "#, |
477 | expect![[""]], | 477 | expect![[""]], |
@@ -479,7 +479,7 @@ fn test() { | |||
479 | check( | 479 | check( |
480 | r#" | 480 | r#" |
481 | /* | 481 | /* |
482 | Some multi-line comment<|> | 482 | Some multi-line comment$0 |
483 | */ | 483 | */ |
484 | "#, | 484 | "#, |
485 | expect![[""]], | 485 | expect![[""]], |
@@ -487,7 +487,7 @@ Some multi-line comment<|> | |||
487 | check( | 487 | check( |
488 | r#" | 488 | r#" |
489 | /// Some doc comment | 489 | /// Some doc comment |
490 | /// let test<|> = 1 | 490 | /// let test$0 = 1 |
491 | "#, | 491 | "#, |
492 | expect![[""]], | 492 | expect![[""]], |
493 | ); | 493 | ); |
@@ -501,7 +501,7 @@ Some multi-line comment<|> | |||
501 | use std::future::*; | 501 | use std::future::*; |
502 | struct A {} | 502 | struct A {} |
503 | impl Future for A {} | 503 | impl Future for A {} |
504 | fn foo(a: A) { a.<|> } | 504 | fn foo(a: A) { a.$0 } |
505 | 505 | ||
506 | //- /std/lib.rs crate:std | 506 | //- /std/lib.rs crate:std |
507 | pub mod future { | 507 | pub mod future { |
@@ -520,7 +520,7 @@ pub mod future { | |||
520 | use std::future::*; | 520 | use std::future::*; |
521 | fn foo() { | 521 | fn foo() { |
522 | let a = async {}; | 522 | let a = async {}; |
523 | a.<|> | 523 | a.$0 |
524 | } | 524 | } |
525 | 525 | ||
526 | //- /std/lib.rs crate:std | 526 | //- /std/lib.rs crate:std |
@@ -540,7 +540,7 @@ pub mod future { | |||
540 | #[test] | 540 | #[test] |
541 | fn after_let() { | 541 | fn after_let() { |
542 | check( | 542 | check( |
543 | r#"fn main() { let _ = <|> }"#, | 543 | r#"fn main() { let _ = $0 }"#, |
544 | expect![[r#" | 544 | expect![[r#" |
545 | kw match | 545 | kw match |
546 | kw while | 546 | kw while |
@@ -557,7 +557,7 @@ pub mod future { | |||
557 | check( | 557 | check( |
558 | r#" | 558 | r#" |
559 | struct Foo { | 559 | struct Foo { |
560 | <|> | 560 | $0 |
561 | pub f: i32, | 561 | pub f: i32, |
562 | } | 562 | } |
563 | "#, | 563 | "#, |
@@ -578,7 +578,7 @@ struct Foo { | |||
578 | } | 578 | } |
579 | fn foo() { | 579 | fn foo() { |
580 | Foo { | 580 | Foo { |
581 | <|> | 581 | $0 |
582 | } | 582 | } |
583 | } | 583 | } |
584 | "#, | 584 | "#, |
@@ -595,7 +595,7 @@ struct Foo { | |||
595 | } | 595 | } |
596 | fn foo() { | 596 | fn foo() { |
597 | Foo { | 597 | Foo { |
598 | f: <|> | 598 | f: $0 |
599 | } | 599 | } |
600 | } | 600 | } |
601 | "#, | 601 | "#, |
diff --git a/crates/completion/src/completions/macro_in_item_position.rs b/crates/completion/src/completions/macro_in_item_position.rs index 82884a181..2be299ac2 100644 --- a/crates/completion/src/completions/macro_in_item_position.rs +++ b/crates/completion/src/completions/macro_in_item_position.rs | |||
@@ -31,7 +31,7 @@ mod tests { | |||
31 | macro_rules! foo { () => {} } | 31 | macro_rules! foo { () => {} } |
32 | fn foo() {} | 32 | fn foo() {} |
33 | 33 | ||
34 | <|> | 34 | $0 |
35 | "#, | 35 | "#, |
36 | expect![[r#" | 36 | expect![[r#" |
37 | ma foo!(…) macro_rules! foo | 37 | ma foo!(…) macro_rules! foo |
diff --git a/crates/completion/src/completions/mod_.rs b/crates/completion/src/completions/mod_.rs index f77864b77..8c8eaeaa6 100644 --- a/crates/completion/src/completions/mod_.rs +++ b/crates/completion/src/completions/mod_.rs | |||
@@ -9,7 +9,7 @@ use crate::{CompletionItem, CompletionItemKind}; | |||
9 | 9 | ||
10 | use crate::{context::CompletionContext, item::CompletionKind, Completions}; | 10 | use crate::{context::CompletionContext, item::CompletionKind, Completions}; |
11 | 11 | ||
12 | /// Complete mod declaration, i.e. `mod <|> ;` | 12 | /// Complete mod declaration, i.e. `mod $0 ;` |
13 | pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { | 13 | pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { |
14 | let mod_under_caret = match &ctx.mod_declaration_under_caret { | 14 | let mod_under_caret = match &ctx.mod_declaration_under_caret { |
15 | Some(mod_under_caret) if mod_under_caret.item_list().is_some() => return None, | 15 | Some(mod_under_caret) if mod_under_caret.item_list().is_some() => return None, |
@@ -159,7 +159,7 @@ mod tests { | |||
159 | check( | 159 | check( |
160 | r#" | 160 | r#" |
161 | //- /lib.rs | 161 | //- /lib.rs |
162 | mod <|> | 162 | mod $0 |
163 | //- /foo.rs | 163 | //- /foo.rs |
164 | fn foo() {} | 164 | fn foo() {} |
165 | //- /foo/ignored_foo.rs | 165 | //- /foo/ignored_foo.rs |
@@ -181,7 +181,7 @@ mod tests { | |||
181 | check( | 181 | check( |
182 | r#" | 182 | r#" |
183 | //- /lib.rs | 183 | //- /lib.rs |
184 | mod <|> { | 184 | mod $0 { |
185 | 185 | ||
186 | } | 186 | } |
187 | //- /foo.rs | 187 | //- /foo.rs |
@@ -196,7 +196,7 @@ mod tests { | |||
196 | check( | 196 | check( |
197 | r#" | 197 | r#" |
198 | //- /main.rs | 198 | //- /main.rs |
199 | mod <|> | 199 | mod $0 |
200 | //- /foo.rs | 200 | //- /foo.rs |
201 | fn foo() {} | 201 | fn foo() {} |
202 | //- /foo/ignored_foo.rs | 202 | //- /foo/ignored_foo.rs |
@@ -219,7 +219,7 @@ mod tests { | |||
219 | r#" | 219 | r#" |
220 | //- /main.rs | 220 | //- /main.rs |
221 | mod tests { | 221 | mod tests { |
222 | mod <|>; | 222 | mod $0; |
223 | } | 223 | } |
224 | //- /tests/foo.rs | 224 | //- /tests/foo.rs |
225 | fn foo() {} | 225 | fn foo() {} |
@@ -237,7 +237,7 @@ mod tests { | |||
237 | //- /lib.rs | 237 | //- /lib.rs |
238 | mod foo; | 238 | mod foo; |
239 | //- /foo.rs | 239 | //- /foo.rs |
240 | mod <|>; | 240 | mod $0; |
241 | //- /foo/bar.rs | 241 | //- /foo/bar.rs |
242 | fn bar() {} | 242 | fn bar() {} |
243 | //- /foo/bar/ignored_bar.rs | 243 | //- /foo/bar/ignored_bar.rs |
@@ -262,7 +262,7 @@ mod tests { | |||
262 | mod foo; | 262 | mod foo; |
263 | //- /foo.rs | 263 | //- /foo.rs |
264 | mod bar { | 264 | mod bar { |
265 | mod <|> | 265 | mod $0 |
266 | } | 266 | } |
267 | //- /foo/bar/baz.rs | 267 | //- /foo/bar/baz.rs |
268 | fn baz() {} | 268 | fn baz() {} |
@@ -288,7 +288,7 @@ mod tests { | |||
288 | // //- /src/bin.rs | 288 | // //- /src/bin.rs |
289 | // fn main() {} | 289 | // fn main() {} |
290 | // //- /src/bin/foo.rs | 290 | // //- /src/bin/foo.rs |
291 | // mod <|> | 291 | // mod $0 |
292 | // //- /src/bin/bar.rs | 292 | // //- /src/bin/bar.rs |
293 | // fn bar() {} | 293 | // fn bar() {} |
294 | // //- /src/bin/bar/bar_ignored.rs | 294 | // //- /src/bin/bar/bar_ignored.rs |
@@ -307,7 +307,7 @@ mod tests { | |||
307 | //- /src/bin.rs crate:main | 307 | //- /src/bin.rs crate:main |
308 | fn main() {} | 308 | fn main() {} |
309 | //- /src/bin/foo.rs | 309 | //- /src/bin/foo.rs |
310 | mod <|> | 310 | mod $0 |
311 | //- /src/bin/bar.rs | 311 | //- /src/bin/bar.rs |
312 | mod foo; | 312 | mod foo; |
313 | fn bar() {} | 313 | fn bar() {} |
diff --git a/crates/completion/src/completions/pattern.rs b/crates/completion/src/completions/pattern.rs index eee31098d..595160ff5 100644 --- a/crates/completion/src/completions/pattern.rs +++ b/crates/completion/src/completions/pattern.rs | |||
@@ -71,7 +71,7 @@ static FOO: E = E::X; | |||
71 | struct Bar { f: u32 } | 71 | struct Bar { f: u32 } |
72 | 72 | ||
73 | fn foo() { | 73 | fn foo() { |
74 | match E::X { <|> } | 74 | match E::X { $0 } |
75 | } | 75 | } |
76 | "#, | 76 | "#, |
77 | expect![[r#" | 77 | expect![[r#" |
@@ -92,7 +92,7 @@ macro_rules! m { ($e:expr) => { $e } } | |||
92 | enum E { X } | 92 | enum E { X } |
93 | 93 | ||
94 | fn foo() { | 94 | fn foo() { |
95 | m!(match E::X { <|> }) | 95 | m!(match E::X { $0 }) |
96 | } | 96 | } |
97 | "#, | 97 | "#, |
98 | expect![[r#" | 98 | expect![[r#" |
@@ -115,7 +115,7 @@ static FOO: E = E::X; | |||
115 | struct Bar { f: u32 } | 115 | struct Bar { f: u32 } |
116 | 116 | ||
117 | fn foo() { | 117 | fn foo() { |
118 | let <|> | 118 | let $0 |
119 | } | 119 | } |
120 | "#, | 120 | "#, |
121 | expect![[r#" | 121 | expect![[r#" |
@@ -133,7 +133,7 @@ enum E { X } | |||
133 | static FOO: E = E::X; | 133 | static FOO: E = E::X; |
134 | struct Bar { f: u32 } | 134 | struct Bar { f: u32 } |
135 | 135 | ||
136 | fn foo(<|>) { | 136 | fn foo($0) { |
137 | } | 137 | } |
138 | "#, | 138 | "#, |
139 | expect![[r#" | 139 | expect![[r#" |
@@ -149,7 +149,7 @@ fn foo(<|>) { | |||
149 | struct Bar { f: u32 } | 149 | struct Bar { f: u32 } |
150 | 150 | ||
151 | fn foo() { | 151 | fn foo() { |
152 | let <|> | 152 | let $0 |
153 | } | 153 | } |
154 | "#, | 154 | "#, |
155 | expect![[r#" | 155 | expect![[r#" |
@@ -165,7 +165,7 @@ fn foo() { | |||
165 | struct Foo { bar: String, baz: String } | 165 | struct Foo { bar: String, baz: String } |
166 | struct Bar(String, String); | 166 | struct Bar(String, String); |
167 | struct Baz; | 167 | struct Baz; |
168 | fn outer(<|>) {} | 168 | fn outer($0) {} |
169 | "#, | 169 | "#, |
170 | expect![[r#" | 170 | expect![[r#" |
171 | bn Foo Foo { bar$1, baz$2 }: Foo$0 | 171 | bn Foo Foo { bar$1, baz$2 }: Foo$0 |
@@ -182,7 +182,7 @@ struct Foo { bar: String, baz: String } | |||
182 | struct Bar(String, String); | 182 | struct Bar(String, String); |
183 | struct Baz; | 183 | struct Baz; |
184 | fn outer() { | 184 | fn outer() { |
185 | let <|> | 185 | let $0 |
186 | } | 186 | } |
187 | "#, | 187 | "#, |
188 | expect![[r#" | 188 | expect![[r#" |
@@ -201,7 +201,7 @@ struct Bar(String, String); | |||
201 | struct Baz; | 201 | struct Baz; |
202 | fn outer() { | 202 | fn outer() { |
203 | match () { | 203 | match () { |
204 | <|> | 204 | $0 |
205 | } | 205 | } |
206 | } | 206 | } |
207 | "#, | 207 | "#, |
@@ -225,7 +225,7 @@ use foo::*; | |||
225 | 225 | ||
226 | fn outer() { | 226 | fn outer() { |
227 | match () { | 227 | match () { |
228 | <|> | 228 | $0 |
229 | } | 229 | } |
230 | } | 230 | } |
231 | "#, | 231 | "#, |
@@ -244,7 +244,7 @@ fn outer() { | |||
244 | struct Foo(i32); | 244 | struct Foo(i32); |
245 | fn main() { | 245 | fn main() { |
246 | match Foo(92) { | 246 | match Foo(92) { |
247 | <|>(92) => (), | 247 | $0(92) => (), |
248 | } | 248 | } |
249 | } | 249 | } |
250 | "#, | 250 | "#, |
diff --git a/crates/completion/src/completions/postfix.rs b/crates/completion/src/completions/postfix.rs index 4888f518a..87f0c0b2a 100644 --- a/crates/completion/src/completions/postfix.rs +++ b/crates/completion/src/completions/postfix.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! Postfix completions, like `Ok(10).ifl<|>` => `if let Ok() = Ok(10) { <|> }`. | 1 | //! Postfix completions, like `Ok(10).ifl$0` => `if let Ok() = Ok(10) { $0 }`. |
2 | 2 | ||
3 | mod format_like; | 3 | mod format_like; |
4 | 4 | ||
@@ -310,7 +310,7 @@ mod tests { | |||
310 | r#" | 310 | r#" |
311 | fn main() { | 311 | fn main() { |
312 | let bar = true; | 312 | let bar = true; |
313 | bar.<|> | 313 | bar.$0 |
314 | } | 314 | } |
315 | "#, | 315 | "#, |
316 | expect![[r#" | 316 | expect![[r#" |
@@ -342,7 +342,7 @@ fn foo(elt: bool) -> bool { | |||
342 | 342 | ||
343 | fn main() { | 343 | fn main() { |
344 | let bar = true; | 344 | let bar = true; |
345 | foo(bar.<|>) | 345 | foo(bar.$0) |
346 | } | 346 | } |
347 | "#, | 347 | "#, |
348 | expect![[r#" | 348 | expect![[r#" |
@@ -368,7 +368,7 @@ fn main() { | |||
368 | r#" | 368 | r#" |
369 | fn main() { | 369 | fn main() { |
370 | let bar: u8 = 12; | 370 | let bar: u8 = 12; |
371 | bar.<|> | 371 | bar.$0 |
372 | } | 372 | } |
373 | "#, | 373 | "#, |
374 | expect![[r#" | 374 | expect![[r#" |
@@ -392,7 +392,7 @@ fn main() { | |||
392 | check( | 392 | check( |
393 | r#" | 393 | r#" |
394 | fn main() { | 394 | fn main() { |
395 | baz.l<|> | 395 | baz.l$0 |
396 | res | 396 | res |
397 | } | 397 | } |
398 | "#, | 398 | "#, |
@@ -424,7 +424,7 @@ enum Option<T> { Some(T), None } | |||
424 | 424 | ||
425 | fn main() { | 425 | fn main() { |
426 | let bar = Option::Some(true); | 426 | let bar = Option::Some(true); |
427 | bar.<|> | 427 | bar.$0 |
428 | } | 428 | } |
429 | "#, | 429 | "#, |
430 | r#" | 430 | r#" |
@@ -449,7 +449,7 @@ enum Result<T, E> { Ok(T), Err(E) } | |||
449 | 449 | ||
450 | fn main() { | 450 | fn main() { |
451 | let bar = Result::Ok(true); | 451 | let bar = Result::Ok(true); |
452 | bar.<|> | 452 | bar.$0 |
453 | } | 453 | } |
454 | "#, | 454 | "#, |
455 | r#" | 455 | r#" |
@@ -468,7 +468,7 @@ fn main() { | |||
468 | 468 | ||
469 | #[test] | 469 | #[test] |
470 | fn postfix_completion_works_for_ambiguous_float_literal() { | 470 | fn postfix_completion_works_for_ambiguous_float_literal() { |
471 | check_edit("refm", r#"fn main() { 42.<|> }"#, r#"fn main() { &mut 42 }"#) | 471 | check_edit("refm", r#"fn main() { 42.$0 }"#, r#"fn main() { &mut 42 }"#) |
472 | } | 472 | } |
473 | 473 | ||
474 | #[test] | 474 | #[test] |
@@ -479,7 +479,7 @@ fn main() { | |||
479 | macro_rules! m { ($e:expr) => { $e } } | 479 | macro_rules! m { ($e:expr) => { $e } } |
480 | fn main() { | 480 | fn main() { |
481 | let bar: u8 = 12; | 481 | let bar: u8 = 12; |
482 | m!(bar.d<|>) | 482 | m!(bar.d$0) |
483 | } | 483 | } |
484 | "#, | 484 | "#, |
485 | r#" | 485 | r#" |
@@ -494,55 +494,47 @@ fn main() { | |||
494 | 494 | ||
495 | #[test] | 495 | #[test] |
496 | fn postfix_completion_for_references() { | 496 | fn postfix_completion_for_references() { |
497 | check_edit("dbg", r#"fn main() { &&42.<|> }"#, r#"fn main() { dbg!(&&42) }"#); | 497 | check_edit("dbg", r#"fn main() { &&42.$0 }"#, r#"fn main() { dbg!(&&42) }"#); |
498 | check_edit("refm", r#"fn main() { &&42.<|> }"#, r#"fn main() { &&&mut 42 }"#); | 498 | check_edit("refm", r#"fn main() { &&42.$0 }"#, r#"fn main() { &&&mut 42 }"#); |
499 | } | 499 | } |
500 | 500 | ||
501 | #[test] | 501 | #[test] |
502 | fn postfix_completion_for_format_like_strings() { | 502 | fn postfix_completion_for_format_like_strings() { |
503 | check_edit( | 503 | check_edit( |
504 | "format", | 504 | "format", |
505 | r#"fn main() { "{some_var:?}".<|> }"#, | 505 | r#"fn main() { "{some_var:?}".$0 }"#, |
506 | r#"fn main() { format!("{:?}", some_var) }"#, | 506 | r#"fn main() { format!("{:?}", some_var) }"#, |
507 | ); | 507 | ); |
508 | check_edit( | 508 | check_edit( |
509 | "panic", | 509 | "panic", |
510 | r#"fn main() { "Panic with {a}".<|> }"#, | 510 | r#"fn main() { "Panic with {a}".$0 }"#, |
511 | r#"fn main() { panic!("Panic with {}", a) }"#, | 511 | r#"fn main() { panic!("Panic with {}", a) }"#, |
512 | ); | 512 | ); |
513 | check_edit( | 513 | check_edit( |
514 | "println", | 514 | "println", |
515 | r#"fn main() { "{ 2+2 } { SomeStruct { val: 1, other: 32 } :?}".<|> }"#, | 515 | r#"fn main() { "{ 2+2 } { SomeStruct { val: 1, other: 32 } :?}".$0 }"#, |
516 | r#"fn main() { println!("{} {:?}", 2+2, SomeStruct { val: 1, other: 32 }) }"#, | 516 | r#"fn main() { println!("{} {:?}", 2+2, SomeStruct { val: 1, other: 32 }) }"#, |
517 | ); | 517 | ); |
518 | check_edit( | 518 | check_edit( |
519 | "loge", | 519 | "loge", |
520 | r#"fn main() { "{2+2}".<|> }"#, | 520 | r#"fn main() { "{2+2}".$0 }"#, |
521 | r#"fn main() { log::error!("{}", 2+2) }"#, | 521 | r#"fn main() { log::error!("{}", 2+2) }"#, |
522 | ); | 522 | ); |
523 | check_edit( | 523 | check_edit( |
524 | "logt", | 524 | "logt", |
525 | r#"fn main() { "{2+2}".<|> }"#, | 525 | r#"fn main() { "{2+2}".$0 }"#, |
526 | r#"fn main() { log::trace!("{}", 2+2) }"#, | 526 | r#"fn main() { log::trace!("{}", 2+2) }"#, |
527 | ); | 527 | ); |
528 | check_edit( | 528 | check_edit( |
529 | "logd", | 529 | "logd", |
530 | r#"fn main() { "{2+2}".<|> }"#, | 530 | r#"fn main() { "{2+2}".$0 }"#, |
531 | r#"fn main() { log::debug!("{}", 2+2) }"#, | 531 | r#"fn main() { log::debug!("{}", 2+2) }"#, |
532 | ); | 532 | ); |
533 | check_edit( | 533 | check_edit("logi", r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::info!("{}", 2+2) }"#); |
534 | "logi", | 534 | check_edit("logw", r#"fn main() { "{2+2}".$0 }"#, r#"fn main() { log::warn!("{}", 2+2) }"#); |
535 | r#"fn main() { "{2+2}".<|> }"#, | ||
536 | r#"fn main() { log::info!("{}", 2+2) }"#, | ||
537 | ); | ||
538 | check_edit( | ||
539 | "logw", | ||
540 | r#"fn main() { "{2+2}".<|> }"#, | ||
541 | r#"fn main() { log::warn!("{}", 2+2) }"#, | ||
542 | ); | ||
543 | check_edit( | 535 | check_edit( |
544 | "loge", | 536 | "loge", |
545 | r#"fn main() { "{2+2}".<|> }"#, | 537 | r#"fn main() { "{2+2}".$0 }"#, |
546 | r#"fn main() { log::error!("{}", 2+2) }"#, | 538 | r#"fn main() { log::error!("{}", 2+2) }"#, |
547 | ); | 539 | ); |
548 | } | 540 | } |
diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/completion/src/completions/qualified_path.rs index 882c4dcbc..fa9e6e810 100644 --- a/crates/completion/src/completions/qualified_path.rs +++ b/crates/completion/src/completions/qualified_path.rs | |||
@@ -1,4 +1,4 @@ | |||
1 | //! Completion of paths, i.e. `some::prefix::<|>`. | 1 | //! Completion of paths, i.e. `some::prefix::$0`. |
2 | 2 | ||
3 | use hir::{Adt, HasVisibility, PathResolution, ScopeDef}; | 3 | use hir::{Adt, HasVisibility, PathResolution, ScopeDef}; |
4 | use rustc_hash::FxHashSet; | 4 | use rustc_hash::FxHashSet; |
@@ -38,7 +38,7 @@ pub(crate) fn complete_qualified_path(acc: &mut Completions, ctx: &CompletionCon | |||
38 | if let ScopeDef::Unknown = def { | 38 | if let ScopeDef::Unknown = def { |
39 | if let Some(name_ref) = ctx.name_ref_syntax.as_ref() { | 39 | if let Some(name_ref) = ctx.name_ref_syntax.as_ref() { |
40 | if name_ref.syntax().text() == name.to_string().as_str() { | 40 | if name_ref.syntax().text() == name.to_string().as_str() { |
41 | // for `use self::foo<|>`, don't suggest `foo` as a completion | 41 | // for `use self::foo$0`, don't suggest `foo` as a completion |
42 | mark::hit!(dont_complete_current_use); | 42 | mark::hit!(dont_complete_current_use); |
43 | continue; | 43 | continue; |
44 | } | 44 | } |
@@ -173,7 +173,7 @@ mod tests { | |||
173 | #[test] | 173 | #[test] |
174 | fn dont_complete_current_use() { | 174 | fn dont_complete_current_use() { |
175 | mark::check!(dont_complete_current_use); | 175 | mark::check!(dont_complete_current_use); |
176 | check(r#"use self::foo<|>;"#, expect![[""]]); | 176 | check(r#"use self::foo$0;"#, expect![[""]]); |
177 | } | 177 | } |
178 | 178 | ||
179 | #[test] | 179 | #[test] |
@@ -181,7 +181,7 @@ mod tests { | |||
181 | check( | 181 | check( |
182 | r#" | 182 | r#" |
183 | mod foo { pub struct S; } | 183 | mod foo { pub struct S; } |
184 | use self::{foo::*, bar<|>}; | 184 | use self::{foo::*, bar$0}; |
185 | "#, | 185 | "#, |
186 | expect![[r#" | 186 | expect![[r#" |
187 | st S | 187 | st S |
@@ -192,18 +192,18 @@ use self::{foo::*, bar<|>}; | |||
192 | 192 | ||
193 | #[test] | 193 | #[test] |
194 | fn dont_complete_primitive_in_use() { | 194 | fn dont_complete_primitive_in_use() { |
195 | check_builtin(r#"use self::<|>;"#, expect![[""]]); | 195 | check_builtin(r#"use self::$0;"#, expect![[""]]); |
196 | } | 196 | } |
197 | 197 | ||
198 | #[test] | 198 | #[test] |
199 | fn dont_complete_primitive_in_module_scope() { | 199 | fn dont_complete_primitive_in_module_scope() { |
200 | check_builtin(r#"fn foo() { self::<|> }"#, expect![[""]]); | 200 | check_builtin(r#"fn foo() { self::$0 }"#, expect![[""]]); |
201 | } | 201 | } |
202 | 202 | ||
203 | #[test] | 203 | #[test] |
204 | fn completes_primitives() { | 204 | fn completes_primitives() { |
205 | check_builtin( | 205 | check_builtin( |
206 | r#"fn main() { let _: <|> = 92; }"#, | 206 | r#"fn main() { let _: $0 = 92; }"#, |
207 | expect![[r#" | 207 | expect![[r#" |
208 | bt u32 | 208 | bt u32 |
209 | bt bool | 209 | bt bool |
@@ -230,7 +230,7 @@ use self::{foo::*, bar<|>}; | |||
230 | fn completes_mod_with_same_name_as_function() { | 230 | fn completes_mod_with_same_name_as_function() { |
231 | check( | 231 | check( |
232 | r#" | 232 | r#" |
233 | use self::my::<|>; | 233 | use self::my::$0; |
234 | 234 | ||
235 | mod my { pub struct Bar; } | 235 | mod my { pub struct Bar; } |
236 | fn my() {} | 236 | fn my() {} |
@@ -245,7 +245,7 @@ fn my() {} | |||
245 | fn filters_visibility() { | 245 | fn filters_visibility() { |
246 | check( | 246 | check( |
247 | r#" | 247 | r#" |
248 | use self::my::<|>; | 248 | use self::my::$0; |
249 | 249 | ||
250 | mod my { | 250 | mod my { |
251 | struct Bar; | 251 | struct Bar; |
@@ -264,7 +264,7 @@ mod my { | |||
264 | fn completes_use_item_starting_with_self() { | 264 | fn completes_use_item_starting_with_self() { |
265 | check( | 265 | check( |
266 | r#" | 266 | r#" |
267 | use self::m::<|>; | 267 | use self::m::$0; |
268 | 268 | ||
269 | mod m { pub struct Bar; } | 269 | mod m { pub struct Bar; } |
270 | "#, | 270 | "#, |
@@ -282,7 +282,7 @@ mod m { pub struct Bar; } | |||
282 | mod foo; | 282 | mod foo; |
283 | struct Spam; | 283 | struct Spam; |
284 | //- /foo.rs | 284 | //- /foo.rs |
285 | use crate::Sp<|> | 285 | use crate::Sp$0 |
286 | "#, | 286 | "#, |
287 | expect![[r#" | 287 | expect![[r#" |
288 | md foo | 288 | md foo |
@@ -299,7 +299,7 @@ use crate::Sp<|> | |||
299 | mod foo; | 299 | mod foo; |
300 | struct Spam; | 300 | struct Spam; |
301 | //- /foo.rs | 301 | //- /foo.rs |
302 | use crate::{Sp<|>}; | 302 | use crate::{Sp$0}; |
303 | "#, | 303 | "#, |
304 | expect![[r#" | 304 | expect![[r#" |
305 | md foo | 305 | md foo |
@@ -320,7 +320,7 @@ pub mod bar { | |||
320 | } | 320 | } |
321 | } | 321 | } |
322 | //- /foo.rs | 322 | //- /foo.rs |
323 | use crate::{bar::{baz::Sp<|>}}; | 323 | use crate::{bar::{baz::Sp$0}}; |
324 | "#, | 324 | "#, |
325 | expect![[r#" | 325 | expect![[r#" |
326 | st Spam | 326 | st Spam |
@@ -333,7 +333,7 @@ use crate::{bar::{baz::Sp<|>}}; | |||
333 | check( | 333 | check( |
334 | r#" | 334 | r#" |
335 | enum E { Foo, Bar(i32) } | 335 | enum E { Foo, Bar(i32) } |
336 | fn foo() { let _ = E::<|> } | 336 | fn foo() { let _ = E::$0 } |
337 | "#, | 337 | "#, |
338 | expect![[r#" | 338 | expect![[r#" |
339 | ev Foo () | 339 | ev Foo () |
@@ -356,7 +356,7 @@ impl S { | |||
356 | type T = i32; | 356 | type T = i32; |
357 | } | 357 | } |
358 | 358 | ||
359 | fn foo() { let _ = S::<|> } | 359 | fn foo() { let _ = S::$0 } |
360 | "#, | 360 | "#, |
361 | expect![[r#" | 361 | expect![[r#" |
362 | fn a() fn a() | 362 | fn a() fn a() |
@@ -384,7 +384,7 @@ mod m { | |||
384 | } | 384 | } |
385 | } | 385 | } |
386 | 386 | ||
387 | fn foo() { let _ = S::<|> } | 387 | fn foo() { let _ = S::$0 } |
388 | "#, | 388 | "#, |
389 | expect![[r#" | 389 | expect![[r#" |
390 | fn public_method() pub(crate) fn public_method() | 390 | fn public_method() pub(crate) fn public_method() |
@@ -401,7 +401,7 @@ fn foo() { let _ = S::<|> } | |||
401 | enum E {}; | 401 | enum E {}; |
402 | impl E { fn m() { } } | 402 | impl E { fn m() { } } |
403 | 403 | ||
404 | fn foo() { let _ = E::<|> } | 404 | fn foo() { let _ = E::$0 } |
405 | "#, | 405 | "#, |
406 | expect![[r#" | 406 | expect![[r#" |
407 | fn m() fn m() | 407 | fn m() fn m() |
@@ -416,7 +416,7 @@ fn foo() { let _ = E::<|> } | |||
416 | union U {}; | 416 | union U {}; |
417 | impl U { fn m() { } } | 417 | impl U { fn m() { } } |
418 | 418 | ||
419 | fn foo() { let _ = U::<|> } | 419 | fn foo() { let _ = U::$0 } |
420 | "#, | 420 | "#, |
421 | expect![[r#" | 421 | expect![[r#" |
422 | fn m() fn m() | 422 | fn m() fn m() |
@@ -429,7 +429,7 @@ fn foo() { let _ = U::<|> } | |||
429 | check( | 429 | check( |
430 | r#" | 430 | r#" |
431 | //- /main.rs crate:main deps:foo | 431 | //- /main.rs crate:main deps:foo |
432 | use foo::<|>; | 432 | use foo::$0; |
433 | 433 | ||
434 | //- /foo/lib.rs crate:foo | 434 | //- /foo/lib.rs crate:foo |
435 | pub mod bar { pub struct S; } | 435 | pub mod bar { pub struct S; } |
@@ -446,7 +446,7 @@ pub mod bar { pub struct S; } | |||
446 | r#" | 446 | r#" |
447 | trait Trait { fn m(); } | 447 | trait Trait { fn m(); } |
448 | 448 | ||
449 | fn foo() { let _ = Trait::<|> } | 449 | fn foo() { let _ = Trait::$0 } |
450 | "#, | 450 | "#, |
451 | expect![[r#" | 451 | expect![[r#" |
452 | fn m() fn m() | 452 | fn m() fn m() |
@@ -463,7 +463,7 @@ trait Trait { fn m(); } | |||
463 | struct S; | 463 | struct S; |
464 | impl Trait for S {} | 464 | impl Trait for S {} |
465 | 465 | ||
466 | fn foo() { let _ = S::<|> } | 466 | fn foo() { let _ = S::$0 } |
467 | "#, | 467 | "#, |
468 | expect![[r#" | 468 | expect![[r#" |
469 | fn m() fn m() | 469 | fn m() fn m() |
@@ -480,7 +480,7 @@ trait Trait { fn m(); } | |||
480 | struct S; | 480 | struct S; |
481 | impl Trait for S {} | 481 | impl Trait for S {} |
482 | 482 | ||
483 | fn foo() { let _ = <S as Trait>::<|> } | 483 | fn foo() { let _ = <S as Trait>::$0 } |
484 | "#, | 484 | "#, |
485 | expect![[r#" | 485 | expect![[r#" |
486 | fn m() fn m() | 486 | fn m() fn m() |
@@ -506,7 +506,7 @@ trait Sub: Super { | |||
506 | fn submethod(&self) {} | 506 | fn submethod(&self) {} |
507 | } | 507 | } |
508 | 508 | ||
509 | fn foo<T: Sub>() { T::<|> } | 509 | fn foo<T: Sub>() { T::$0 } |
510 | "#, | 510 | "#, |
511 | expect![[r#" | 511 | expect![[r#" |
512 | ta SubTy type SubTy; | 512 | ta SubTy type SubTy; |
@@ -544,7 +544,7 @@ impl<T> Super for Wrap<T> {} | |||
544 | impl<T> Sub for Wrap<T> { | 544 | impl<T> Sub for Wrap<T> { |
545 | fn subfunc() { | 545 | fn subfunc() { |
546 | // Should be able to assume `Self: Sub + Super` | 546 | // Should be able to assume `Self: Sub + Super` |
547 | Self::<|> | 547 | Self::$0 |
548 | } | 548 | } |
549 | } | 549 | } |
550 | "#, | 550 | "#, |
@@ -570,7 +570,7 @@ impl S { fn foo() {} } | |||
570 | type T = S; | 570 | type T = S; |
571 | impl T { fn bar() {} } | 571 | impl T { fn bar() {} } |
572 | 572 | ||
573 | fn main() { T::<|>; } | 573 | fn main() { T::$0; } |
574 | "#, | 574 | "#, |
575 | expect![[r#" | 575 | expect![[r#" |
576 | fn foo() fn foo() | 576 | fn foo() fn foo() |
@@ -586,7 +586,7 @@ fn main() { T::<|>; } | |||
586 | #[macro_export] | 586 | #[macro_export] |
587 | macro_rules! foo { () => {} } | 587 | macro_rules! foo { () => {} } |
588 | 588 | ||
589 | fn main() { let _ = crate::<|> } | 589 | fn main() { let _ = crate::$0 } |
590 | "#, | 590 | "#, |
591 | expect![[r##" | 591 | expect![[r##" |
592 | fn main() fn main() | 592 | fn main() fn main() |
@@ -604,7 +604,7 @@ mod a { | |||
604 | const A: usize = 0; | 604 | const A: usize = 0; |
605 | mod b { | 605 | mod b { |
606 | const B: usize = 0; | 606 | const B: usize = 0; |
607 | mod c { use super::super::<|> } | 607 | mod c { use super::super::$0 } |
608 | } | 608 | } |
609 | } | 609 | } |
610 | "#, | 610 | "#, |
@@ -619,7 +619,7 @@ mod a { | |||
619 | fn completes_reexported_items_under_correct_name() { | 619 | fn completes_reexported_items_under_correct_name() { |
620 | check( | 620 | check( |
621 | r#" | 621 | r#" |
622 | fn foo() { self::m::<|> } | 622 | fn foo() { self::m::$0 } |
623 | 623 | ||
624 | mod m { | 624 | mod m { |
625 | pub use super::p::wrong_fn as right_fn; | 625 | pub use super::p::wrong_fn as right_fn; |
@@ -642,7 +642,7 @@ mod p { | |||
642 | check_edit( | 642 | check_edit( |
643 | "RightType", | 643 | "RightType", |
644 | r#" | 644 | r#" |
645 | fn foo() { self::m::<|> } | 645 | fn foo() { self::m::$0 } |
646 | 646 | ||
647 | mod m { | 647 | mod m { |
648 | pub use super::p::wrong_fn as right_fn; | 648 | pub use super::p::wrong_fn as right_fn; |
@@ -677,7 +677,7 @@ mod p { | |||
677 | check( | 677 | check( |
678 | r#" | 678 | r#" |
679 | macro_rules! m { ($e:expr) => { $e } } | 679 | macro_rules! m { ($e:expr) => { $e } } |
680 | fn main() { m!(self::f<|>); } | 680 | fn main() { m!(self::f$0); } |
681 | fn foo() {} | 681 | fn foo() {} |
682 | "#, | 682 | "#, |
683 | expect![[r#" | 683 | expect![[r#" |
@@ -691,7 +691,7 @@ fn foo() {} | |||
691 | fn function_mod_share_name() { | 691 | fn function_mod_share_name() { |
692 | check( | 692 | check( |
693 | r#" | 693 | r#" |
694 | fn foo() { self::m::<|> } | 694 | fn foo() { self::m::$0 } |
695 | 695 | ||
696 | mod m { | 696 | mod m { |
697 | pub mod z {} | 697 | pub mod z {} |
@@ -716,7 +716,7 @@ impl<K, V> HashMap<K, V, RandomState> { | |||
716 | pub fn new() -> HashMap<K, V, RandomState> { } | 716 | pub fn new() -> HashMap<K, V, RandomState> { } |
717 | } | 717 | } |
718 | fn foo() { | 718 | fn foo() { |
719 | HashMap::<|> | 719 | HashMap::$0 |
720 | } | 720 | } |
721 | "#, | 721 | "#, |
722 | expect![[r#" | 722 | expect![[r#" |
@@ -730,7 +730,7 @@ fn foo() { | |||
730 | check( | 730 | check( |
731 | r#" | 731 | r#" |
732 | mod foo { pub struct Foo; } | 732 | mod foo { pub struct Foo; } |
733 | #[foo::<|>] | 733 | #[foo::$0] |
734 | fn f() {} | 734 | fn f() {} |
735 | "#, | 735 | "#, |
736 | expect![[""]], | 736 | expect![[""]], |
@@ -749,7 +749,7 @@ fn foo( | |||
749 | } | 749 | } |
750 | 750 | ||
751 | fn main() { | 751 | fn main() { |
752 | fo<|> | 752 | fo$0 |
753 | } | 753 | } |
754 | "#, | 754 | "#, |
755 | expect![[r#" | 755 | expect![[r#" |
@@ -770,7 +770,7 @@ enum Foo { | |||
770 | 770 | ||
771 | impl Foo { | 771 | impl Foo { |
772 | fn foo(self) { | 772 | fn foo(self) { |
773 | Self::<|> | 773 | Self::$0 |
774 | } | 774 | } |
775 | } | 775 | } |
776 | "#, | 776 | "#, |
diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs index e58b9a274..bb6354ded 100644 --- a/crates/completion/src/completions/record.rs +++ b/crates/completion/src/completions/record.rs | |||
@@ -99,7 +99,7 @@ impl core::default::Default for S { | |||
99 | fn process(f: S) { | 99 | fn process(f: S) { |
100 | let other = S { | 100 | let other = S { |
101 | foo: 5, | 101 | foo: 5, |
102 | .<|> | 102 | .$0 |
103 | }; | 103 | }; |
104 | } | 104 | } |
105 | "#; | 105 | "#; |
@@ -139,7 +139,7 @@ impl core::default::Default for S { | |||
139 | fn process(f: S) { | 139 | fn process(f: S) { |
140 | let other = S { | 140 | let other = S { |
141 | foo: 5, | 141 | foo: 5, |
142 | .<|> | 142 | .$0 |
143 | }; | 143 | }; |
144 | } | 144 | } |
145 | "#, | 145 | "#, |
@@ -173,7 +173,7 @@ struct S { foo: u32, bar: usize } | |||
173 | fn process(f: S) { | 173 | fn process(f: S) { |
174 | let other = S { | 174 | let other = S { |
175 | foo: 5, | 175 | foo: 5, |
176 | .<|> | 176 | .$0 |
177 | }; | 177 | }; |
178 | } | 178 | } |
179 | "#; | 179 | "#; |
@@ -201,7 +201,7 @@ struct S { foo: u32 } | |||
201 | 201 | ||
202 | fn process(f: S) { | 202 | fn process(f: S) { |
203 | match f { | 203 | match f { |
204 | S { f<|>: 92 } => (), | 204 | S { f$0: 92 } => (), |
205 | } | 205 | } |
206 | } | 206 | } |
207 | "#, | 207 | "#, |
@@ -219,7 +219,7 @@ enum E { S { foo: u32, bar: () } } | |||
219 | 219 | ||
220 | fn process(e: E) { | 220 | fn process(e: E) { |
221 | match e { | 221 | match e { |
222 | E::S { <|> } => (), | 222 | E::S { $0 } => (), |
223 | } | 223 | } |
224 | } | 224 | } |
225 | "#, | 225 | "#, |
@@ -239,7 +239,7 @@ struct S { foo: u32 } | |||
239 | 239 | ||
240 | fn process(f: S) { | 240 | fn process(f: S) { |
241 | m!(match f { | 241 | m!(match f { |
242 | S { f<|>: 92 } => (), | 242 | S { f$0: 92 } => (), |
243 | }) | 243 | }) |
244 | } | 244 | } |
245 | ", | 245 | ", |
@@ -263,7 +263,7 @@ fn main() { | |||
263 | foo1: 1, foo2: 2, | 263 | foo1: 1, foo2: 2, |
264 | bar: 3, baz: 4, | 264 | bar: 3, baz: 4, |
265 | }; | 265 | }; |
266 | if let S { foo1, foo2: a, <|> } = s {} | 266 | if let S { foo1, foo2: a, $0 } = s {} |
267 | } | 267 | } |
268 | "#, | 268 | "#, |
269 | expect![[r#" | 269 | expect![[r#" |
@@ -279,7 +279,7 @@ fn main() { | |||
279 | r#" | 279 | r#" |
280 | struct A { the_field: u32 } | 280 | struct A { the_field: u32 } |
281 | fn foo() { | 281 | fn foo() { |
282 | A { the<|> } | 282 | A { the$0 } |
283 | } | 283 | } |
284 | "#, | 284 | "#, |
285 | expect![[r#" | 285 | expect![[r#" |
@@ -294,7 +294,7 @@ fn foo() { | |||
294 | r#" | 294 | r#" |
295 | enum E { A { a: u32 } } | 295 | enum E { A { a: u32 } } |
296 | fn foo() { | 296 | fn foo() { |
297 | let _ = E::A { <|> } | 297 | let _ = E::A { $0 } |
298 | } | 298 | } |
299 | "#, | 299 | "#, |
300 | expect![[r#" | 300 | expect![[r#" |
@@ -311,7 +311,7 @@ struct A { a: u32 } | |||
311 | struct B { b: u32 } | 311 | struct B { b: u32 } |
312 | 312 | ||
313 | fn foo() { | 313 | fn foo() { |
314 | let _: A = B { <|> } | 314 | let _: A = B { $0 } |
315 | } | 315 | } |
316 | "#, | 316 | "#, |
317 | expect![[r#" | 317 | expect![[r#" |
@@ -327,7 +327,7 @@ fn foo() { | |||
327 | struct A<T> { a: T } | 327 | struct A<T> { a: T } |
328 | 328 | ||
329 | fn foo() { | 329 | fn foo() { |
330 | let _: A<u32> = A { <|> } | 330 | let _: A<u32> = A { $0 } |
331 | } | 331 | } |
332 | "#, | 332 | "#, |
333 | expect![[r#" | 333 | expect![[r#" |
@@ -343,7 +343,7 @@ fn foo() { | |||
343 | macro_rules! m { ($e:expr) => { $e } } | 343 | macro_rules! m { ($e:expr) => { $e } } |
344 | struct A { the_field: u32 } | 344 | struct A { the_field: u32 } |
345 | fn foo() { | 345 | fn foo() { |
346 | m!(A { the<|> }) | 346 | m!(A { the$0 }) |
347 | } | 347 | } |
348 | "#, | 348 | "#, |
349 | expect![[r#" | 349 | expect![[r#" |
@@ -363,7 +363,7 @@ struct S { | |||
363 | 363 | ||
364 | fn main() { | 364 | fn main() { |
365 | let foo1 = 1; | 365 | let foo1 = 1; |
366 | let s = S { foo1, foo2: 5, <|> } | 366 | let s = S { foo1, foo2: 5, $0 } |
367 | } | 367 | } |
368 | "#, | 368 | "#, |
369 | expect![[r#" | 369 | expect![[r#" |
@@ -381,7 +381,7 @@ struct S { foo1: u32, foo2: u32 } | |||
381 | 381 | ||
382 | fn main() { | 382 | fn main() { |
383 | let foo1 = 1; | 383 | let foo1 = 1; |
384 | let s = S { foo1, <|> .. loop {} } | 384 | let s = S { foo1, $0 .. loop {} } |
385 | } | 385 | } |
386 | "#, | 386 | "#, |
387 | expect![[r#" | 387 | expect![[r#" |
diff --git a/crates/completion/src/completions/snippet.rs b/crates/completion/src/completions/snippet.rs index b5e704696..df17a15c5 100644 --- a/crates/completion/src/completions/snippet.rs +++ b/crates/completion/src/completions/snippet.rs | |||
@@ -83,7 +83,7 @@ mod tests { | |||
83 | #[test] | 83 | #[test] |
84 | fn completes_snippets_in_expressions() { | 84 | fn completes_snippets_in_expressions() { |
85 | check( | 85 | check( |
86 | r#"fn foo(x: i32) { <|> }"#, | 86 | r#"fn foo(x: i32) { $0 }"#, |
87 | expect![[r#" | 87 | expect![[r#" |
88 | sn pd | 88 | sn pd |
89 | sn ppd | 89 | sn ppd |
@@ -93,8 +93,8 @@ mod tests { | |||
93 | 93 | ||
94 | #[test] | 94 | #[test] |
95 | fn should_not_complete_snippets_in_path() { | 95 | fn should_not_complete_snippets_in_path() { |
96 | check(r#"fn foo(x: i32) { ::foo<|> }"#, expect![[""]]); | 96 | check(r#"fn foo(x: i32) { ::foo$0 }"#, expect![[""]]); |
97 | check(r#"fn foo(x: i32) { ::<|> }"#, expect![[""]]); | 97 | check(r#"fn foo(x: i32) { ::$0 }"#, expect![[""]]); |
98 | } | 98 | } |
99 | 99 | ||
100 | #[test] | 100 | #[test] |
@@ -103,7 +103,7 @@ mod tests { | |||
103 | r#" | 103 | r#" |
104 | #[cfg(test)] | 104 | #[cfg(test)] |
105 | mod tests { | 105 | mod tests { |
106 | <|> | 106 | $0 |
107 | } | 107 | } |
108 | "#, | 108 | "#, |
109 | expect![[r#" | 109 | expect![[r#" |
diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs index 54bb897e9..aa9c845da 100644 --- a/crates/completion/src/completions/trait_impl.rs +++ b/crates/completion/src/completions/trait_impl.rs | |||
@@ -15,7 +15,7 @@ | |||
15 | //! } | 15 | //! } |
16 | //! | 16 | //! |
17 | //! impl SomeTrait for () { | 17 | //! impl SomeTrait for () { |
18 | //! fn f<|> | 18 | //! fn f$0 |
19 | //! } | 19 | //! } |
20 | //! ``` | 20 | //! ``` |
21 | //! | 21 | //! |
@@ -27,7 +27,7 @@ | |||
27 | //! # } | 27 | //! # } |
28 | //! | 28 | //! |
29 | //! impl SomeTrait for () { | 29 | //! impl SomeTrait for () { |
30 | //! fn foo() {}<|> | 30 | //! fn foo() {}$0 |
31 | //! } | 31 | //! } |
32 | //! ``` | 32 | //! ``` |
33 | 33 | ||
@@ -82,7 +82,7 @@ pub(crate) fn complete_trait_impl(acc: &mut Completions, ctx: &CompletionContext | |||
82 | 82 | ||
83 | fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, SyntaxNode, Impl)> { | 83 | fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, SyntaxNode, Impl)> { |
84 | let mut token = ctx.token.clone(); | 84 | let mut token = ctx.token.clone(); |
85 | // For keywork without name like `impl .. { fn <|> }`, the current position is inside | 85 | // For keywork without name like `impl .. { fn $0 }`, the current position is inside |
86 | // the whitespace token, which is outside `FN` syntax node. | 86 | // the whitespace token, which is outside `FN` syntax node. |
87 | // We need to follow the previous token in this case. | 87 | // We need to follow the previous token in this case. |
88 | if token.kind() == SyntaxKind::WHITESPACE { | 88 | if token.kind() == SyntaxKind::WHITESPACE { |
@@ -90,20 +90,20 @@ fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, Synt | |||
90 | } | 90 | } |
91 | 91 | ||
92 | let impl_item_offset = match token.kind() { | 92 | let impl_item_offset = match token.kind() { |
93 | // `impl .. { const <|> }` | 93 | // `impl .. { const $0 }` |
94 | // ERROR 0 | 94 | // ERROR 0 |
95 | // CONST_KW <- * | 95 | // CONST_KW <- * |
96 | SyntaxKind::CONST_KW => 0, | 96 | SyntaxKind::CONST_KW => 0, |
97 | // `impl .. { fn/type <|> }` | 97 | // `impl .. { fn/type $0 }` |
98 | // FN/TYPE_ALIAS 0 | 98 | // FN/TYPE_ALIAS 0 |
99 | // FN_KW <- * | 99 | // FN_KW <- * |
100 | SyntaxKind::FN_KW | SyntaxKind::TYPE_KW => 0, | 100 | SyntaxKind::FN_KW | SyntaxKind::TYPE_KW => 0, |
101 | // `impl .. { fn/type/const foo<|> }` | 101 | // `impl .. { fn/type/const foo$0 }` |
102 | // FN/TYPE_ALIAS/CONST 1 | 102 | // FN/TYPE_ALIAS/CONST 1 |
103 | // NAME 0 | 103 | // NAME 0 |
104 | // IDENT <- * | 104 | // IDENT <- * |
105 | SyntaxKind::IDENT if token.parent().kind() == SyntaxKind::NAME => 1, | 105 | SyntaxKind::IDENT if token.parent().kind() == SyntaxKind::NAME => 1, |
106 | // `impl .. { foo<|> }` | 106 | // `impl .. { foo$0 }` |
107 | // MACRO_CALL 3 | 107 | // MACRO_CALL 3 |
108 | // PATH 2 | 108 | // PATH 2 |
109 | // PATH_SEGMENT 1 | 109 | // PATH_SEGMENT 1 |
@@ -120,7 +120,7 @@ fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, Synt | |||
120 | // <item> | 120 | // <item> |
121 | let impl_def = ast::Impl::cast(impl_item.parent()?.parent()?)?; | 121 | let impl_def = ast::Impl::cast(impl_item.parent()?.parent()?)?; |
122 | let kind = match impl_item.kind() { | 122 | let kind = match impl_item.kind() { |
123 | // `impl ... { const <|> fn/type/const }` | 123 | // `impl ... { const $0 fn/type/const }` |
124 | _ if token.kind() == SyntaxKind::CONST_KW => ImplCompletionKind::Const, | 124 | _ if token.kind() == SyntaxKind::CONST_KW => ImplCompletionKind::Const, |
125 | SyntaxKind::CONST | SyntaxKind::ERROR => ImplCompletionKind::Const, | 125 | SyntaxKind::CONST | SyntaxKind::ERROR => ImplCompletionKind::Const, |
126 | SyntaxKind::TYPE_ALIAS => ImplCompletionKind::TypeAlias, | 126 | SyntaxKind::TYPE_ALIAS => ImplCompletionKind::TypeAlias, |
@@ -267,7 +267,7 @@ trait Test { | |||
267 | struct T; | 267 | struct T; |
268 | 268 | ||
269 | impl Test for T { | 269 | impl Test for T { |
270 | t<|> | 270 | t$0 |
271 | } | 271 | } |
272 | "#, | 272 | "#, |
273 | expect![[" | 273 | expect![[" |
@@ -287,7 +287,7 @@ struct T; | |||
287 | 287 | ||
288 | impl Test for T { | 288 | impl Test for T { |
289 | fn test() { | 289 | fn test() { |
290 | t<|> | 290 | t$0 |
291 | } | 291 | } |
292 | } | 292 | } |
293 | ", | 293 | ", |
@@ -301,7 +301,7 @@ struct T; | |||
301 | 301 | ||
302 | impl Test for T { | 302 | impl Test for T { |
303 | fn test() { | 303 | fn test() { |
304 | fn t<|> | 304 | fn t$0 |
305 | } | 305 | } |
306 | } | 306 | } |
307 | ", | 307 | ", |
@@ -315,7 +315,7 @@ struct T; | |||
315 | 315 | ||
316 | impl Test for T { | 316 | impl Test for T { |
317 | fn test() { | 317 | fn test() { |
318 | fn <|> | 318 | fn $0 |
319 | } | 319 | } |
320 | } | 320 | } |
321 | ", | 321 | ", |
@@ -330,7 +330,7 @@ struct T; | |||
330 | 330 | ||
331 | impl Test for T { | 331 | impl Test for T { |
332 | fn test() { | 332 | fn test() { |
333 | foo.<|> | 333 | foo.$0 |
334 | } | 334 | } |
335 | } | 335 | } |
336 | ", | 336 | ", |
@@ -343,7 +343,7 @@ trait Test { fn test(_: i32); fn test2(); } | |||
343 | struct T; | 343 | struct T; |
344 | 344 | ||
345 | impl Test for T { | 345 | impl Test for T { |
346 | fn test(t<|>) | 346 | fn test(t$0) |
347 | } | 347 | } |
348 | ", | 348 | ", |
349 | expect![[""]], | 349 | expect![[""]], |
@@ -355,7 +355,7 @@ trait Test { fn test(_: fn()); fn test2(); } | |||
355 | struct T; | 355 | struct T; |
356 | 356 | ||
357 | impl Test for T { | 357 | impl Test for T { |
358 | fn test(f: fn <|>) | 358 | fn test(f: fn $0) |
359 | } | 359 | } |
360 | ", | 360 | ", |
361 | expect![[""]], | 361 | expect![[""]], |
@@ -370,7 +370,7 @@ trait Test { const TEST: fn(); const TEST2: u32; type Test; fn test(); } | |||
370 | struct T; | 370 | struct T; |
371 | 371 | ||
372 | impl Test for T { | 372 | impl Test for T { |
373 | const TEST: fn <|> | 373 | const TEST: fn $0 |
374 | } | 374 | } |
375 | ", | 375 | ", |
376 | expect![[""]], | 376 | expect![[""]], |
@@ -382,7 +382,7 @@ trait Test { const TEST: u32; const TEST2: u32; type Test; fn test(); } | |||
382 | struct T; | 382 | struct T; |
383 | 383 | ||
384 | impl Test for T { | 384 | impl Test for T { |
385 | const TEST: T<|> | 385 | const TEST: T$0 |
386 | } | 386 | } |
387 | ", | 387 | ", |
388 | expect![[""]], | 388 | expect![[""]], |
@@ -394,7 +394,7 @@ trait Test { const TEST: u32; const TEST2: u32; type Test; fn test(); } | |||
394 | struct T; | 394 | struct T; |
395 | 395 | ||
396 | impl Test for T { | 396 | impl Test for T { |
397 | const TEST: u32 = f<|> | 397 | const TEST: u32 = f$0 |
398 | } | 398 | } |
399 | ", | 399 | ", |
400 | expect![[""]], | 400 | expect![[""]], |
@@ -407,7 +407,7 @@ struct T; | |||
407 | 407 | ||
408 | impl Test for T { | 408 | impl Test for T { |
409 | const TEST: u32 = { | 409 | const TEST: u32 = { |
410 | t<|> | 410 | t$0 |
411 | }; | 411 | }; |
412 | } | 412 | } |
413 | ", | 413 | ", |
@@ -421,7 +421,7 @@ struct T; | |||
421 | 421 | ||
422 | impl Test for T { | 422 | impl Test for T { |
423 | const TEST: u32 = { | 423 | const TEST: u32 = { |
424 | fn <|> | 424 | fn $0 |
425 | }; | 425 | }; |
426 | } | 426 | } |
427 | ", | 427 | ", |
@@ -435,7 +435,7 @@ struct T; | |||
435 | 435 | ||
436 | impl Test for T { | 436 | impl Test for T { |
437 | const TEST: u32 = { | 437 | const TEST: u32 = { |
438 | fn t<|> | 438 | fn t$0 |
439 | }; | 439 | }; |
440 | } | 440 | } |
441 | ", | 441 | ", |
@@ -451,7 +451,7 @@ trait Test { type Test; type Test2; fn test(); } | |||
451 | struct T; | 451 | struct T; |
452 | 452 | ||
453 | impl Test for T { | 453 | impl Test for T { |
454 | type Test = T<|>; | 454 | type Test = T$0; |
455 | } | 455 | } |
456 | ", | 456 | ", |
457 | expect![[""]], | 457 | expect![[""]], |
@@ -463,7 +463,7 @@ trait Test { type Test; type Test2; fn test(); } | |||
463 | struct T; | 463 | struct T; |
464 | 464 | ||
465 | impl Test for T { | 465 | impl Test for T { |
466 | type Test = fn <|>; | 466 | type Test = fn $0; |
467 | } | 467 | } |
468 | ", | 468 | ", |
469 | expect![[""]], | 469 | expect![[""]], |
@@ -481,7 +481,7 @@ trait Test { | |||
481 | struct T; | 481 | struct T; |
482 | 482 | ||
483 | impl Test for T { | 483 | impl Test for T { |
484 | t<|> | 484 | t$0 |
485 | } | 485 | } |
486 | "#, | 486 | "#, |
487 | r#" | 487 | r#" |
@@ -510,7 +510,7 @@ trait Test { | |||
510 | struct T; | 510 | struct T; |
511 | 511 | ||
512 | impl Test for T { | 512 | impl Test for T { |
513 | fn t<|> | 513 | fn t$0 |
514 | } | 514 | } |
515 | "#, | 515 | "#, |
516 | r#" | 516 | r#" |
@@ -540,7 +540,7 @@ struct T; | |||
540 | 540 | ||
541 | impl Test for T { | 541 | impl Test for T { |
542 | fn foo() {} | 542 | fn foo() {} |
543 | fn f<|> | 543 | fn f$0 |
544 | } | 544 | } |
545 | "#, | 545 | "#, |
546 | expect![[r#" | 546 | expect![[r#" |
@@ -560,7 +560,7 @@ trait Test { | |||
560 | struct T; | 560 | struct T; |
561 | 561 | ||
562 | impl Test for T { | 562 | impl Test for T { |
563 | fn f<|> | 563 | fn f$0 |
564 | } | 564 | } |
565 | "#, | 565 | "#, |
566 | r#" | 566 | r#" |
@@ -585,7 +585,7 @@ trait Test { | |||
585 | struct T; | 585 | struct T; |
586 | 586 | ||
587 | impl Test for T { | 587 | impl Test for T { |
588 | fn f<|> | 588 | fn f$0 |
589 | } | 589 | } |
590 | "#, | 590 | "#, |
591 | r#" | 591 | r#" |
@@ -614,7 +614,7 @@ trait Test { | |||
614 | } | 614 | } |
615 | 615 | ||
616 | impl Test for () { | 616 | impl Test for () { |
617 | type S<|> | 617 | type S$0 |
618 | } | 618 | } |
619 | "#, | 619 | "#, |
620 | " | 620 | " |
@@ -639,7 +639,7 @@ trait Test { | |||
639 | } | 639 | } |
640 | 640 | ||
641 | impl Test for () { | 641 | impl Test for () { |
642 | const S<|> | 642 | const S$0 |
643 | } | 643 | } |
644 | "#, | 644 | "#, |
645 | " | 645 | " |
@@ -661,7 +661,7 @@ trait Test { | |||
661 | } | 661 | } |
662 | 662 | ||
663 | impl Test for () { | 663 | impl Test for () { |
664 | const S<|> | 664 | const S$0 |
665 | } | 665 | } |
666 | "#, | 666 | "#, |
667 | " | 667 | " |
@@ -724,7 +724,7 @@ impl Test for T {{ | |||
724 | // Enumerate some possible next siblings. | 724 | // Enumerate some possible next siblings. |
725 | for next_sibling in &[ | 725 | for next_sibling in &[ |
726 | "", | 726 | "", |
727 | "fn other_fn() {}", // `const <|> fn` -> `const fn` | 727 | "fn other_fn() {}", // `const $0 fn` -> `const fn` |
728 | "type OtherType = i32;", | 728 | "type OtherType = i32;", |
729 | "const OTHER_CONST: i32 = 0;", | 729 | "const OTHER_CONST: i32 = 0;", |
730 | "async fn other_fn() {}", | 730 | "async fn other_fn() {}", |
@@ -733,9 +733,9 @@ impl Test for T {{ | |||
733 | "default type OtherType = i32;", | 733 | "default type OtherType = i32;", |
734 | "default const OTHER_CONST: i32 = 0;", | 734 | "default const OTHER_CONST: i32 = 0;", |
735 | ] { | 735 | ] { |
736 | test("bar", "fn <|>", "fn bar() {\n $0\n}", next_sibling); | 736 | test("bar", "fn $0", "fn bar() {\n $0\n}", next_sibling); |
737 | test("Foo", "type <|>", "type Foo = ", next_sibling); | 737 | test("Foo", "type $0", "type Foo = ", next_sibling); |
738 | test("CONST", "const <|>", "const CONST: u16 = ", next_sibling); | 738 | test("CONST", "const $0", "const CONST: u16 = ", next_sibling); |
739 | } | 739 | } |
740 | } | 740 | } |
741 | } | 741 | } |
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#" |
diff --git a/crates/completion/src/context.rs b/crates/completion/src/context.rs index f979697ab..ebf28e887 100644 --- a/crates/completion/src/context.rs +++ b/crates/completion/src/context.rs | |||
@@ -63,7 +63,7 @@ pub(crate) struct CompletionContext<'a> { | |||
63 | pub(super) is_expr: bool, | 63 | pub(super) is_expr: bool, |
64 | /// Something is typed at the "top" level, in module or impl/trait. | 64 | /// Something is typed at the "top" level, in module or impl/trait. |
65 | pub(super) is_new_item: bool, | 65 | pub(super) is_new_item: bool, |
66 | /// The receiver if this is a field or method access, i.e. writing something.<|> | 66 | /// The receiver if this is a field or method access, i.e. writing something.$0 |
67 | pub(super) dot_receiver: Option<ast::Expr>, | 67 | pub(super) dot_receiver: Option<ast::Expr>, |
68 | pub(super) dot_receiver_is_ambiguous_float_literal: bool, | 68 | pub(super) dot_receiver_is_ambiguous_float_literal: bool, |
69 | /// If this is a call (method or function) in particular, i.e. the () are already there. | 69 | /// If this is a call (method or function) in particular, i.e. the () are already there. |
@@ -228,9 +228,9 @@ impl<'a> CompletionContext<'a> { | |||
228 | 228 | ||
229 | /// Checks whether completions in that particular case don't make much sense. | 229 | /// Checks whether completions in that particular case don't make much sense. |
230 | /// Examples: | 230 | /// Examples: |
231 | /// - `fn <|>` -- we expect function name, it's unlikely that "hint" will be helpful. | 231 | /// - `fn $0` -- we expect function name, it's unlikely that "hint" will be helpful. |
232 | /// Exception for this case is `impl Trait for Foo`, where we would like to hint trait method names. | 232 | /// Exception for this case is `impl Trait for Foo`, where we would like to hint trait method names. |
233 | /// - `for _ i<|>` -- obviously, it'll be "in" keyword. | 233 | /// - `for _ i$0` -- obviously, it'll be "in" keyword. |
234 | pub(crate) fn no_completion_required(&self) -> bool { | 234 | pub(crate) fn no_completion_required(&self) -> bool { |
235 | (self.fn_is_prev && !self.inside_impl_trait_block) || self.for_is_prev2 | 235 | (self.fn_is_prev && !self.inside_impl_trait_block) || self.for_is_prev2 |
236 | } | 236 | } |
@@ -279,7 +279,7 @@ impl<'a> CompletionContext<'a> { | |||
279 | offset: TextSize, | 279 | offset: TextSize, |
280 | ) { | 280 | ) { |
281 | // FIXME: this is wrong in at least two cases: | 281 | // FIXME: this is wrong in at least two cases: |
282 | // * when there's no token `foo(<|>)` | 282 | // * when there's no token `foo($0)` |
283 | // * when there is a token, but it happens to have type of it's own | 283 | // * when there is a token, but it happens to have type of it's own |
284 | self.expected_type = self | 284 | self.expected_type = self |
285 | .token | 285 | .token |
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs index 7087fae37..35af354b0 100644 --- a/crates/completion/src/item.rs +++ b/crates/completion/src/item.rs | |||
@@ -43,7 +43,7 @@ pub struct CompletionItem { | |||
43 | /// Lookup is used to check if completion item indeed can complete current | 43 | /// Lookup is used to check if completion item indeed can complete current |
44 | /// ident. | 44 | /// ident. |
45 | /// | 45 | /// |
46 | /// That is, in `foo.bar<|>` lookup of `abracadabra` will be accepted (it | 46 | /// That is, in `foo.bar$0` lookup of `abracadabra` will be accepted (it |
47 | /// contains `bar` sub sequence), and `quux` will rejected. | 47 | /// contains `bar` sub sequence), and `quux` will rejected. |
48 | lookup: Option<String>, | 48 | lookup: Option<String>, |
49 | 49 | ||
diff --git a/crates/completion/src/lib.rs b/crates/completion/src/lib.rs index 3c7d5a46c..6cba88a6b 100644 --- a/crates/completion/src/lib.rs +++ b/crates/completion/src/lib.rs | |||
@@ -47,8 +47,8 @@ pub use crate::{ | |||
47 | // - `expr.while` -> `while expr {}` or `while let ... {}` for `Option` or `Result` | 47 | // - `expr.while` -> `while expr {}` or `while let ... {}` for `Option` or `Result` |
48 | // - `expr.ref` -> `&expr` | 48 | // - `expr.ref` -> `&expr` |
49 | // - `expr.refm` -> `&mut expr` | 49 | // - `expr.refm` -> `&mut expr` |
50 | // - `expr.let` -> `let <|> = expr;` | 50 | // - `expr.let` -> `let $0 = expr;` |
51 | // - `expr.letm` -> `let mut <|> = expr;` | 51 | // - `expr.letm` -> `let mut $0 = expr;` |
52 | // - `expr.not` -> `!expr` | 52 | // - `expr.not` -> `!expr` |
53 | // - `expr.dbg` -> `dbg!(expr)` | 53 | // - `expr.dbg` -> `dbg!(expr)` |
54 | // - `expr.dbgr` -> `dbg!(&expr)` | 54 | // - `expr.dbgr` -> `dbg!(&expr)` |
@@ -92,7 +92,7 @@ pub use crate::{ | |||
92 | /// ```no_run | 92 | /// ```no_run |
93 | /// fn f() { | 93 | /// fn f() { |
94 | /// let foo = 92; | 94 | /// let foo = 92; |
95 | /// let _ = bar<|> | 95 | /// let _ = bar$0 |
96 | /// } | 96 | /// } |
97 | /// ``` | 97 | /// ``` |
98 | /// | 98 | /// |
@@ -220,7 +220,7 @@ mod tests { | |||
220 | 220 | ||
221 | fn foo() { | 221 | fn foo() { |
222 | let bar = Bar; | 222 | let bar = Bar; |
223 | bar.fo<|>; | 223 | bar.fo$0; |
224 | } | 224 | } |
225 | "#, | 225 | "#, |
226 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: "Do the foo" }, | 226 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: "Do the foo" }, |
@@ -246,7 +246,7 @@ mod tests { | |||
246 | 246 | ||
247 | fn foo() { | 247 | fn foo() { |
248 | let bar = Bar; | 248 | let bar = Bar; |
249 | bar.fo<|>; | 249 | bar.fo$0; |
250 | } | 250 | } |
251 | "#, | 251 | "#, |
252 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: " Do the foo" }, | 252 | DetailAndDocumentation { detail: "fn foo(&self)", documentation: " Do the foo" }, |
@@ -259,7 +259,7 @@ mod tests { | |||
259 | check_no_completion( | 259 | check_no_completion( |
260 | r#" | 260 | r#" |
261 | fn foo() { | 261 | fn foo() { |
262 | for i i<|> | 262 | for i i$0 |
263 | } | 263 | } |
264 | "#, | 264 | "#, |
265 | ); | 265 | ); |
@@ -270,7 +270,7 @@ mod tests { | |||
270 | fn foo() -> &'static str { "foo" } | 270 | fn foo() -> &'static str { "foo" } |
271 | 271 | ||
272 | fn bar() { | 272 | fn bar() { |
273 | for c in fo<|> | 273 | for c in fo$0 |
274 | } | 274 | } |
275 | "#, | 275 | "#, |
276 | DetailAndDocumentation { | 276 | DetailAndDocumentation { |
diff --git a/crates/completion/src/patterns.rs b/crates/completion/src/patterns.rs index b0f35f9bf..f148b9402 100644 --- a/crates/completion/src/patterns.rs +++ b/crates/completion/src/patterns.rs | |||
@@ -20,7 +20,7 @@ pub(crate) fn has_trait_parent(element: SyntaxElement) -> bool { | |||
20 | } | 20 | } |
21 | #[test] | 21 | #[test] |
22 | fn test_has_trait_parent() { | 22 | fn test_has_trait_parent() { |
23 | check_pattern_is_applicable(r"trait A { f<|> }", has_trait_parent); | 23 | check_pattern_is_applicable(r"trait A { f$0 }", has_trait_parent); |
24 | } | 24 | } |
25 | 25 | ||
26 | pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { | 26 | pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { |
@@ -32,7 +32,7 @@ pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { | |||
32 | } | 32 | } |
33 | #[test] | 33 | #[test] |
34 | fn test_has_impl_parent() { | 34 | fn test_has_impl_parent() { |
35 | check_pattern_is_applicable(r"impl A { f<|> }", has_impl_parent); | 35 | check_pattern_is_applicable(r"impl A { f$0 }", has_impl_parent); |
36 | } | 36 | } |
37 | 37 | ||
38 | pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool { | 38 | pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool { |
@@ -47,10 +47,10 @@ pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool { | |||
47 | } | 47 | } |
48 | #[test] | 48 | #[test] |
49 | fn test_inside_impl_trait_block() { | 49 | fn test_inside_impl_trait_block() { |
50 | check_pattern_is_applicable(r"impl Foo for Bar { f<|> }", inside_impl_trait_block); | 50 | check_pattern_is_applicable(r"impl Foo for Bar { f$0 }", inside_impl_trait_block); |
51 | check_pattern_is_applicable(r"impl Foo for Bar { fn f<|> }", inside_impl_trait_block); | 51 | check_pattern_is_applicable(r"impl Foo for Bar { fn f$0 }", inside_impl_trait_block); |
52 | check_pattern_is_not_applicable(r"impl A { f<|> }", inside_impl_trait_block); | 52 | check_pattern_is_not_applicable(r"impl A { f$0 }", inside_impl_trait_block); |
53 | check_pattern_is_not_applicable(r"impl A { fn f<|> }", inside_impl_trait_block); | 53 | check_pattern_is_not_applicable(r"impl A { fn f$0 }", inside_impl_trait_block); |
54 | } | 54 | } |
55 | 55 | ||
56 | pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool { | 56 | pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool { |
@@ -58,8 +58,8 @@ pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool { | |||
58 | } | 58 | } |
59 | #[test] | 59 | #[test] |
60 | fn test_has_field_list_parent() { | 60 | fn test_has_field_list_parent() { |
61 | check_pattern_is_applicable(r"struct Foo { f<|> }", has_field_list_parent); | 61 | check_pattern_is_applicable(r"struct Foo { f$0 }", has_field_list_parent); |
62 | check_pattern_is_applicable(r"struct Foo { f<|> pub f: i32}", has_field_list_parent); | 62 | check_pattern_is_applicable(r"struct Foo { f$0 pub f: i32}", has_field_list_parent); |
63 | } | 63 | } |
64 | 64 | ||
65 | pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { | 65 | pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { |
@@ -67,7 +67,7 @@ pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { | |||
67 | } | 67 | } |
68 | #[test] | 68 | #[test] |
69 | fn test_has_block_expr_parent() { | 69 | fn test_has_block_expr_parent() { |
70 | check_pattern_is_applicable(r"fn my_fn() { let a = 2; f<|> }", has_block_expr_parent); | 70 | check_pattern_is_applicable(r"fn my_fn() { let a = 2; f$0 }", has_block_expr_parent); |
71 | } | 71 | } |
72 | 72 | ||
73 | pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { | 73 | pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { |
@@ -75,8 +75,8 @@ pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { | |||
75 | } | 75 | } |
76 | #[test] | 76 | #[test] |
77 | fn test_has_bind_pat_parent() { | 77 | fn test_has_bind_pat_parent() { |
78 | check_pattern_is_applicable(r"fn my_fn(m<|>) {}", has_bind_pat_parent); | 78 | check_pattern_is_applicable(r"fn my_fn(m$0) {}", has_bind_pat_parent); |
79 | check_pattern_is_applicable(r"fn my_fn() { let m<|> }", has_bind_pat_parent); | 79 | check_pattern_is_applicable(r"fn my_fn() { let m$0 }", has_bind_pat_parent); |
80 | } | 80 | } |
81 | 81 | ||
82 | pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool { | 82 | pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool { |
@@ -86,8 +86,8 @@ pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool { | |||
86 | } | 86 | } |
87 | #[test] | 87 | #[test] |
88 | fn test_has_ref_parent() { | 88 | fn test_has_ref_parent() { |
89 | check_pattern_is_applicable(r"fn my_fn(&m<|>) {}", has_ref_parent); | 89 | check_pattern_is_applicable(r"fn my_fn(&m$0) {}", has_ref_parent); |
90 | check_pattern_is_applicable(r"fn my() { let &m<|> }", has_ref_parent); | 90 | check_pattern_is_applicable(r"fn my() { let &m$0 }", has_ref_parent); |
91 | } | 91 | } |
92 | 92 | ||
93 | pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> bool { | 93 | pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> bool { |
@@ -99,8 +99,8 @@ pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> boo | |||
99 | } | 99 | } |
100 | #[test] | 100 | #[test] |
101 | fn test_has_item_list_or_source_file_parent() { | 101 | fn test_has_item_list_or_source_file_parent() { |
102 | check_pattern_is_applicable(r"i<|>", has_item_list_or_source_file_parent); | 102 | check_pattern_is_applicable(r"i$0", has_item_list_or_source_file_parent); |
103 | check_pattern_is_applicable(r"mod foo { f<|> }", has_item_list_or_source_file_parent); | 103 | check_pattern_is_applicable(r"mod foo { f$0 }", has_item_list_or_source_file_parent); |
104 | } | 104 | } |
105 | 105 | ||
106 | pub(crate) fn is_match_arm(element: SyntaxElement) -> bool { | 106 | pub(crate) fn is_match_arm(element: SyntaxElement) -> bool { |
@@ -112,7 +112,7 @@ pub(crate) fn is_match_arm(element: SyntaxElement) -> bool { | |||
112 | } | 112 | } |
113 | #[test] | 113 | #[test] |
114 | fn test_is_match_arm() { | 114 | fn test_is_match_arm() { |
115 | check_pattern_is_applicable(r"fn my_fn() { match () { () => m<|> } }", is_match_arm); | 115 | check_pattern_is_applicable(r"fn my_fn() { match () { () => m$0 } }", is_match_arm); |
116 | } | 116 | } |
117 | 117 | ||
118 | pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool { | 118 | pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool { |
@@ -124,7 +124,7 @@ pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool { | |||
124 | } | 124 | } |
125 | #[test] | 125 | #[test] |
126 | fn test_unsafe_is_prev() { | 126 | fn test_unsafe_is_prev() { |
127 | check_pattern_is_applicable(r"unsafe i<|>", unsafe_is_prev); | 127 | check_pattern_is_applicable(r"unsafe i$0", unsafe_is_prev); |
128 | } | 128 | } |
129 | 129 | ||
130 | pub(crate) fn if_is_prev(element: SyntaxElement) -> bool { | 130 | pub(crate) fn if_is_prev(element: SyntaxElement) -> bool { |
@@ -144,11 +144,11 @@ pub(crate) fn fn_is_prev(element: SyntaxElement) -> bool { | |||
144 | } | 144 | } |
145 | #[test] | 145 | #[test] |
146 | fn test_fn_is_prev() { | 146 | fn test_fn_is_prev() { |
147 | check_pattern_is_applicable(r"fn l<|>", fn_is_prev); | 147 | check_pattern_is_applicable(r"fn l$0", fn_is_prev); |
148 | } | 148 | } |
149 | 149 | ||
150 | /// Check if the token previous to the previous one is `for`. | 150 | /// Check if the token previous to the previous one is `for`. |
151 | /// For example, `for _ i<|>` => true. | 151 | /// For example, `for _ i$0` => true. |
152 | pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool { | 152 | pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool { |
153 | element | 153 | element |
154 | .into_token() | 154 | .into_token() |
@@ -159,12 +159,12 @@ pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool { | |||
159 | } | 159 | } |
160 | #[test] | 160 | #[test] |
161 | fn test_for_is_prev2() { | 161 | fn test_for_is_prev2() { |
162 | check_pattern_is_applicable(r"for i i<|>", for_is_prev2); | 162 | check_pattern_is_applicable(r"for i i$0", for_is_prev2); |
163 | } | 163 | } |
164 | 164 | ||
165 | #[test] | 165 | #[test] |
166 | fn test_if_is_prev() { | 166 | fn test_if_is_prev() { |
167 | check_pattern_is_applicable(r"if l<|>", if_is_prev); | 167 | check_pattern_is_applicable(r"if l$0", if_is_prev); |
168 | } | 168 | } |
169 | 169 | ||
170 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { | 170 | pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { |
@@ -172,7 +172,7 @@ pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { | |||
172 | } | 172 | } |
173 | #[test] | 173 | #[test] |
174 | fn test_has_trait_as_prev_sibling() { | 174 | fn test_has_trait_as_prev_sibling() { |
175 | check_pattern_is_applicable(r"trait A w<|> {}", has_trait_as_prev_sibling); | 175 | check_pattern_is_applicable(r"trait A w$0 {}", has_trait_as_prev_sibling); |
176 | } | 176 | } |
177 | 177 | ||
178 | pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { | 178 | pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { |
@@ -180,7 +180,7 @@ pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { | |||
180 | } | 180 | } |
181 | #[test] | 181 | #[test] |
182 | fn test_has_impl_as_prev_sibling() { | 182 | fn test_has_impl_as_prev_sibling() { |
183 | check_pattern_is_applicable(r"impl A w<|> {}", has_impl_as_prev_sibling); | 183 | check_pattern_is_applicable(r"impl A w$0 {}", has_impl_as_prev_sibling); |
184 | } | 184 | } |
185 | 185 | ||
186 | pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { | 186 | pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { |
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs index 7554c1565..e93c59f71 100644 --- a/crates/completion/src/render.rs +++ b/crates/completion/src/render.rs | |||
@@ -358,7 +358,7 @@ mod tests { | |||
358 | r#" | 358 | r#" |
359 | enum Foo { Foo { x: i32, y: i32 } } | 359 | enum Foo { Foo { x: i32, y: i32 } } |
360 | 360 | ||
361 | fn main() { Foo::Fo<|> } | 361 | fn main() { Foo::Fo$0 } |
362 | "#, | 362 | "#, |
363 | expect![[r#" | 363 | expect![[r#" |
364 | [ | 364 | [ |
@@ -381,7 +381,7 @@ fn main() { Foo::Fo<|> } | |||
381 | r#" | 381 | r#" |
382 | enum Foo { Foo (i32, i32) } | 382 | enum Foo { Foo (i32, i32) } |
383 | 383 | ||
384 | fn main() { Foo::Fo<|> } | 384 | fn main() { Foo::Fo$0 } |
385 | "#, | 385 | "#, |
386 | expect![[r#" | 386 | expect![[r#" |
387 | [ | 387 | [ |
@@ -406,7 +406,7 @@ fn main() { Foo::Fo<|> } | |||
406 | r#" | 406 | r#" |
407 | enum Foo { Foo } | 407 | enum Foo { Foo } |
408 | 408 | ||
409 | fn main() { Foo::Fo<|> } | 409 | fn main() { Foo::Fo$0 } |
410 | "#, | 410 | "#, |
411 | expect![[r#" | 411 | expect![[r#" |
412 | [ | 412 | [ |
@@ -430,7 +430,7 @@ fn main() { Foo::Fo<|> } | |||
430 | mod m { | 430 | mod m { |
431 | pub enum Spam { Foo, Bar(i32) } | 431 | pub enum Spam { Foo, Bar(i32) } |
432 | } | 432 | } |
433 | fn main() { let _: m::Spam = S<|> } | 433 | fn main() { let _: m::Spam = S$0 } |
434 | "#, | 434 | "#, |
435 | expect![[r#" | 435 | expect![[r#" |
436 | [ | 436 | [ |
@@ -483,7 +483,7 @@ fn something_deprecated() {} | |||
483 | #[deprecated(since = "1.0.0")] | 483 | #[deprecated(since = "1.0.0")] |
484 | fn something_else_deprecated() {} | 484 | fn something_else_deprecated() {} |
485 | 485 | ||
486 | fn main() { som<|> } | 486 | fn main() { som$0 } |
487 | "#, | 487 | "#, |
488 | expect![[r#" | 488 | expect![[r#" |
489 | [ | 489 | [ |
@@ -523,7 +523,7 @@ fn main() { som<|> } | |||
523 | check( | 523 | check( |
524 | r#" | 524 | r#" |
525 | struct A { #[deprecated] the_field: u32 } | 525 | struct A { #[deprecated] the_field: u32 } |
526 | fn foo() { A { the<|> } } | 526 | fn foo() { A { the$0 } } |
527 | "#, | 527 | "#, |
528 | expect![[r#" | 528 | expect![[r#" |
529 | [ | 529 | [ |
@@ -551,7 +551,7 @@ struct S { | |||
551 | } | 551 | } |
552 | impl S { | 552 | impl S { |
553 | /// Method docs | 553 | /// Method docs |
554 | fn bar(self) { self.<|> } | 554 | fn bar(self) { self.$0 } |
555 | }"#, | 555 | }"#, |
556 | expect![[r#" | 556 | expect![[r#" |
557 | [ | 557 | [ |
@@ -584,7 +584,7 @@ impl S { | |||
584 | 584 | ||
585 | check( | 585 | check( |
586 | r#" | 586 | r#" |
587 | use self::my<|>; | 587 | use self::my$0; |
588 | 588 | ||
589 | /// mod docs | 589 | /// mod docs |
590 | mod my { } | 590 | mod my { } |
@@ -643,7 +643,7 @@ impl S { | |||
643 | #[inline] | 643 | #[inline] |
644 | fn the_method(&self) { } | 644 | fn the_method(&self) { } |
645 | } | 645 | } |
646 | fn foo(s: S) { s.<|> } | 646 | fn foo(s: S) { s.$0 } |
647 | "#, | 647 | "#, |
648 | expect![[r#" | 648 | expect![[r#" |
649 | [ | 649 | [ |
@@ -671,7 +671,7 @@ fn foo(foo: u8, bar: u8) {} | |||
671 | struct ManualVtable { f: fn(u8, u8) } | 671 | struct ManualVtable { f: fn(u8, u8) } |
672 | 672 | ||
673 | fn main() -> ManualVtable { | 673 | fn main() -> ManualVtable { |
674 | ManualVtable { f: f<|> } | 674 | ManualVtable { f: f$0 } |
675 | } | 675 | } |
676 | "#, | 676 | "#, |
677 | r#" | 677 | r#" |
@@ -692,7 +692,7 @@ fn main() -> ManualVtable { | |||
692 | "foo", | 692 | "foo", |
693 | r#" | 693 | r#" |
694 | mod m { pub fn foo() {} } | 694 | mod m { pub fn foo() {} } |
695 | use crate::m::f<|>; | 695 | use crate::m::f$0; |
696 | "#, | 696 | "#, |
697 | r#" | 697 | r#" |
698 | mod m { pub fn foo() {} } | 698 | mod m { pub fn foo() {} } |
@@ -707,7 +707,7 @@ use crate::m::foo; | |||
707 | "foo", | 707 | "foo", |
708 | r#" | 708 | r#" |
709 | fn foo(x: i32) {} | 709 | fn foo(x: i32) {} |
710 | fn main() { f<|>(); } | 710 | fn main() { f$0(); } |
711 | "#, | 711 | "#, |
712 | r#" | 712 | r#" |
713 | fn foo(x: i32) {} | 713 | fn foo(x: i32) {} |
@@ -719,7 +719,7 @@ fn main() { foo(); } | |||
719 | r#" | 719 | r#" |
720 | struct Foo; | 720 | struct Foo; |
721 | impl Foo { fn foo(&self){} } | 721 | impl Foo { fn foo(&self){} } |
722 | fn f(foo: &Foo) { foo.f<|>(); } | 722 | fn f(foo: &Foo) { foo.f$0(); } |
723 | "#, | 723 | "#, |
724 | r#" | 724 | r#" |
725 | struct Foo; | 725 | struct Foo; |
@@ -736,7 +736,7 @@ fn f(foo: &Foo) { foo.foo(); } | |||
736 | "Vec", | 736 | "Vec", |
737 | r#" | 737 | r#" |
738 | struct Vec<T> {} | 738 | struct Vec<T> {} |
739 | fn foo(xs: Ve<|>) | 739 | fn foo(xs: Ve$0) |
740 | "#, | 740 | "#, |
741 | r#" | 741 | r#" |
742 | struct Vec<T> {} | 742 | struct Vec<T> {} |
@@ -747,7 +747,7 @@ fn foo(xs: Vec<$0>) | |||
747 | "Vec", | 747 | "Vec", |
748 | r#" | 748 | r#" |
749 | type Vec<T> = (T,); | 749 | type Vec<T> = (T,); |
750 | fn foo(xs: Ve<|>) | 750 | fn foo(xs: Ve$0) |
751 | "#, | 751 | "#, |
752 | r#" | 752 | r#" |
753 | type Vec<T> = (T,); | 753 | type Vec<T> = (T,); |
@@ -758,7 +758,7 @@ fn foo(xs: Vec<$0>) | |||
758 | "Vec", | 758 | "Vec", |
759 | r#" | 759 | r#" |
760 | struct Vec<T = i128> {} | 760 | struct Vec<T = i128> {} |
761 | fn foo(xs: Ve<|>) | 761 | fn foo(xs: Ve$0) |
762 | "#, | 762 | "#, |
763 | r#" | 763 | r#" |
764 | struct Vec<T = i128> {} | 764 | struct Vec<T = i128> {} |
@@ -769,7 +769,7 @@ fn foo(xs: Vec) | |||
769 | "Vec", | 769 | "Vec", |
770 | r#" | 770 | r#" |
771 | struct Vec<T> {} | 771 | struct Vec<T> {} |
772 | fn foo(xs: Ve<|><i128>) | 772 | fn foo(xs: Ve$0<i128>) |
773 | "#, | 773 | "#, |
774 | r#" | 774 | r#" |
775 | struct Vec<T> {} | 775 | struct Vec<T> {} |
@@ -785,7 +785,7 @@ fn foo(xs: Vec<i128>) | |||
785 | r#" | 785 | r#" |
786 | struct S { foo: i64, bar: u32, baz: u32 } | 786 | struct S { foo: i64, bar: u32, baz: u32 } |
787 | fn test(bar: u32) { } | 787 | fn test(bar: u32) { } |
788 | fn foo(s: S) { test(s.<|>) } | 788 | fn foo(s: S) { test(s.$0) } |
789 | "#, | 789 | "#, |
790 | expect![[r#" | 790 | expect![[r#" |
791 | fd bar [type+name] | 791 | fd bar [type+name] |
@@ -802,7 +802,7 @@ fn foo(s: S) { test(s.<|>) } | |||
802 | r#" | 802 | r#" |
803 | struct A { foo: i64, bar: u32, baz: u32 } | 803 | struct A { foo: i64, bar: u32, baz: u32 } |
804 | struct B { x: (), y: f32, bar: u32 } | 804 | struct B { x: (), y: f32, bar: u32 } |
805 | fn foo(a: A) { B { bar: a.<|> }; } | 805 | fn foo(a: A) { B { bar: a.$0 }; } |
806 | "#, | 806 | "#, |
807 | expect![[r#" | 807 | expect![[r#" |
808 | fd bar [type+name] | 808 | fd bar [type+name] |
@@ -819,7 +819,7 @@ fn foo(a: A) { B { bar: a.<|> }; } | |||
819 | struct A { foo: i64, bar: u32, baz: u32 } | 819 | struct A { foo: i64, bar: u32, baz: u32 } |
820 | struct B { x: (), y: f32, bar: u32 } | 820 | struct B { x: (), y: f32, bar: u32 } |
821 | fn f(foo: i64) { } | 821 | fn f(foo: i64) { } |
822 | fn foo(a: A) { B { bar: f(a.<|>) }; } | 822 | fn foo(a: A) { B { bar: f(a.$0) }; } |
823 | "#, | 823 | "#, |
824 | expect![[r#" | 824 | expect![[r#" |
825 | fd foo [type+name] | 825 | fd foo [type+name] |
@@ -832,7 +832,7 @@ fn foo(a: A) { B { bar: f(a.<|>) }; } | |||
832 | struct A { foo: i64, bar: u32, baz: u32 } | 832 | struct A { foo: i64, bar: u32, baz: u32 } |
833 | struct B { x: (), y: f32, bar: u32 } | 833 | struct B { x: (), y: f32, bar: u32 } |
834 | fn f(foo: i64) { } | 834 | fn f(foo: i64) { } |
835 | fn foo(a: A) { f(B { bar: a.<|> }); } | 835 | fn foo(a: A) { f(B { bar: a.$0 }); } |
836 | "#, | 836 | "#, |
837 | expect![[r#" | 837 | expect![[r#" |
838 | fd bar [type+name] | 838 | fd bar [type+name] |
@@ -847,7 +847,7 @@ fn foo(a: A) { f(B { bar: a.<|> }); } | |||
847 | check_scores( | 847 | check_scores( |
848 | r#" | 848 | r#" |
849 | struct WorldSnapshot { _f: () }; | 849 | struct WorldSnapshot { _f: () }; |
850 | fn go(world: &WorldSnapshot) { go(w<|>) } | 850 | fn go(world: &WorldSnapshot) { go(w$0) } |
851 | "#, | 851 | "#, |
852 | expect![[r#" | 852 | expect![[r#" |
853 | bn world [type+name] | 853 | bn world [type+name] |
@@ -862,7 +862,7 @@ fn go(world: &WorldSnapshot) { go(w<|>) } | |||
862 | check_scores( | 862 | check_scores( |
863 | r#" | 863 | r#" |
864 | struct Foo; | 864 | struct Foo; |
865 | fn f(foo: &Foo) { f(foo, w<|>) } | 865 | fn f(foo: &Foo) { f(foo, w$0) } |
866 | "#, | 866 | "#, |
867 | expect![[r#" | 867 | expect![[r#" |
868 | st Foo [] | 868 | st Foo [] |
diff --git a/crates/completion/src/render/enum_variant.rs b/crates/completion/src/render/enum_variant.rs index 732e139ec..89fb49773 100644 --- a/crates/completion/src/render/enum_variant.rs +++ b/crates/completion/src/render/enum_variant.rs | |||
@@ -115,7 +115,7 @@ mod tests { | |||
115 | enum Option<T> { Some(T), None } | 115 | enum Option<T> { Some(T), None } |
116 | use Option::*; | 116 | use Option::*; |
117 | fn main() -> Option<i32> { | 117 | fn main() -> Option<i32> { |
118 | Som<|> | 118 | Som$0 |
119 | } | 119 | } |
120 | "#, | 120 | "#, |
121 | r#" | 121 | r#" |
diff --git a/crates/completion/src/render/function.rs b/crates/completion/src/render/function.rs index 7b2f62b4b..f5b0ce3e3 100644 --- a/crates/completion/src/render/function.rs +++ b/crates/completion/src/render/function.rs | |||
@@ -124,7 +124,7 @@ mod tests { | |||
124 | "no_args", | 124 | "no_args", |
125 | r#" | 125 | r#" |
126 | fn no_args() {} | 126 | fn no_args() {} |
127 | fn main() { no_<|> } | 127 | fn main() { no_$0 } |
128 | "#, | 128 | "#, |
129 | r#" | 129 | r#" |
130 | fn no_args() {} | 130 | fn no_args() {} |
@@ -136,7 +136,7 @@ fn main() { no_args()$0 } | |||
136 | "with_args", | 136 | "with_args", |
137 | r#" | 137 | r#" |
138 | fn with_args(x: i32, y: String) {} | 138 | fn with_args(x: i32, y: String) {} |
139 | fn main() { with_<|> } | 139 | fn main() { with_$0 } |
140 | "#, | 140 | "#, |
141 | r#" | 141 | r#" |
142 | fn with_args(x: i32, y: String) {} | 142 | fn with_args(x: i32, y: String) {} |
@@ -151,7 +151,7 @@ struct S; | |||
151 | impl S { | 151 | impl S { |
152 | fn foo(&self) {} | 152 | fn foo(&self) {} |
153 | } | 153 | } |
154 | fn bar(s: &S) { s.f<|> } | 154 | fn bar(s: &S) { s.f$0 } |
155 | "#, | 155 | "#, |
156 | r#" | 156 | r#" |
157 | struct S; | 157 | struct S; |
@@ -170,7 +170,7 @@ impl S { | |||
170 | fn foo(&self, x: i32) {} | 170 | fn foo(&self, x: i32) {} |
171 | } | 171 | } |
172 | fn bar(s: &S) { | 172 | fn bar(s: &S) { |
173 | s.f<|> | 173 | s.f$0 |
174 | } | 174 | } |
175 | "#, | 175 | "#, |
176 | r#" | 176 | r#" |
@@ -195,7 +195,7 @@ struct S; | |||
195 | impl S { | 195 | impl S { |
196 | fn foo(&self) {} | 196 | fn foo(&self) {} |
197 | } | 197 | } |
198 | fn main() { S::f<|> } | 198 | fn main() { S::f$0 } |
199 | "#, | 199 | "#, |
200 | r#" | 200 | r#" |
201 | struct S; | 201 | struct S; |
@@ -215,7 +215,7 @@ fn main() { S::foo(${1:&self})$0 } | |||
215 | "with_args", | 215 | "with_args", |
216 | r#" | 216 | r#" |
217 | fn with_args(x: i32, y: String) {} | 217 | fn with_args(x: i32, y: String) {} |
218 | fn main() { with_<|> } | 218 | fn main() { with_$0 } |
219 | "#, | 219 | "#, |
220 | r#" | 220 | r#" |
221 | fn with_args(x: i32, y: String) {} | 221 | fn with_args(x: i32, y: String) {} |
@@ -230,7 +230,7 @@ fn main() { with_args($0) } | |||
230 | "foo", | 230 | "foo", |
231 | r#" | 231 | r#" |
232 | fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {} | 232 | fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {} |
233 | fn main() { f<|> } | 233 | fn main() { f$0 } |
234 | "#, | 234 | "#, |
235 | r#" | 235 | r#" |
236 | fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {} | 236 | fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {} |
@@ -248,7 +248,7 @@ struct Foo {} | |||
248 | fn ref_arg(x: &Foo) {} | 248 | fn ref_arg(x: &Foo) {} |
249 | fn main() { | 249 | fn main() { |
250 | let x = Foo {}; | 250 | let x = Foo {}; |
251 | ref_ar<|> | 251 | ref_ar$0 |
252 | } | 252 | } |
253 | "#, | 253 | "#, |
254 | r#" | 254 | r#" |
@@ -271,7 +271,7 @@ struct Foo {} | |||
271 | fn ref_arg(x: &mut Foo) {} | 271 | fn ref_arg(x: &mut Foo) {} |
272 | fn main() { | 272 | fn main() { |
273 | let x = Foo {}; | 273 | let x = Foo {}; |
274 | ref_ar<|> | 274 | ref_ar$0 |
275 | } | 275 | } |
276 | "#, | 276 | "#, |
277 | r#" | 277 | r#" |
@@ -299,7 +299,7 @@ impl Bar { | |||
299 | fn main() { | 299 | fn main() { |
300 | let x = Foo {}; | 300 | let x = Foo {}; |
301 | let y = Bar {}; | 301 | let y = Bar {}; |
302 | y.<|> | 302 | y.$0 |
303 | } | 303 | } |
304 | "#, | 304 | "#, |
305 | r#" | 305 | r#" |
@@ -326,7 +326,7 @@ fn main() { | |||
326 | fn take_mutably(mut x: &i32) {} | 326 | fn take_mutably(mut x: &i32) {} |
327 | 327 | ||
328 | fn main() { | 328 | fn main() { |
329 | take_m<|> | 329 | take_m$0 |
330 | } | 330 | } |
331 | "#, | 331 | "#, |
332 | r#" | 332 | r#" |
diff --git a/crates/completion/src/render/macro_.rs b/crates/completion/src/render/macro_.rs index 6f4f9945c..f893e420a 100644 --- a/crates/completion/src/render/macro_.rs +++ b/crates/completion/src/render/macro_.rs | |||
@@ -135,7 +135,7 @@ mod tests { | |||
135 | "frobnicate!", | 135 | "frobnicate!", |
136 | r#" | 136 | r#" |
137 | //- /main.rs crate:main deps:foo | 137 | //- /main.rs crate:main deps:foo |
138 | use foo::<|>; | 138 | use foo::$0; |
139 | //- /foo/lib.rs crate:foo | 139 | //- /foo/lib.rs crate:foo |
140 | #[macro_export] | 140 | #[macro_export] |
141 | macro_rules! frobnicate { () => () } | 141 | macro_rules! frobnicate { () => () } |
@@ -149,7 +149,7 @@ use foo::frobnicate; | |||
149 | "frobnicate!", | 149 | "frobnicate!", |
150 | r#" | 150 | r#" |
151 | macro_rules! frobnicate { () => () } | 151 | macro_rules! frobnicate { () => () } |
152 | fn main() { frob<|>!(); } | 152 | fn main() { frob$0!(); } |
153 | "#, | 153 | "#, |
154 | r#" | 154 | r#" |
155 | macro_rules! frobnicate { () => () } | 155 | macro_rules! frobnicate { () => () } |
@@ -173,7 +173,7 @@ fn main() { frobnicate!(); } | |||
173 | /// ``` | 173 | /// ``` |
174 | macro_rules! vec { () => {} } | 174 | macro_rules! vec { () => {} } |
175 | 175 | ||
176 | fn fn main() { v<|> } | 176 | fn fn main() { v$0 } |
177 | "#, | 177 | "#, |
178 | r#" | 178 | r#" |
179 | /// Creates a [`Vec`] containing the arguments. | 179 | /// Creates a [`Vec`] containing the arguments. |
@@ -198,7 +198,7 @@ fn fn main() { vec![$0] } | |||
198 | /// Don't call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`, | 198 | /// Don't call `fooo!()` `fooo!()`, or `_foo![]` `_foo![]`, |
199 | /// call as `let _=foo! { hello world };` | 199 | /// call as `let _=foo! { hello world };` |
200 | macro_rules! foo { () => {} } | 200 | macro_rules! foo { () => {} } |
201 | fn main() { <|> } | 201 | fn main() { $0 } |
202 | "#, | 202 | "#, |
203 | r#" | 203 | r#" |
204 | /// Foo | 204 | /// Foo |
diff --git a/crates/completion/src/test_utils.rs b/crates/completion/src/test_utils.rs index b5e296777..3f4b9d4ac 100644 --- a/crates/completion/src/test_utils.rs +++ b/crates/completion/src/test_utils.rs | |||
@@ -22,12 +22,12 @@ pub(crate) const TEST_CONFIG: CompletionConfig = CompletionConfig { | |||
22 | merge: Some(MergeBehavior::Full), | 22 | merge: Some(MergeBehavior::Full), |
23 | }; | 23 | }; |
24 | 24 | ||
25 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 25 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
26 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 26 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
27 | let change_fixture = ChangeFixture::parse(ra_fixture); | 27 | let change_fixture = ChangeFixture::parse(ra_fixture); |
28 | let mut database = RootDatabase::default(); | 28 | let mut database = RootDatabase::default(); |
29 | database.apply_change(change_fixture.change); | 29 | database.apply_change(change_fixture.change); |
30 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 30 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
31 | let offset = match range_or_offset { | 31 | let offset = match range_or_offset { |
32 | RangeOrOffset::Range(_) => panic!(), | 32 | RangeOrOffset::Range(_) => panic!(), |
33 | RangeOrOffset::Offset(it) => it, | 33 | RangeOrOffset::Offset(it) => it, |
diff --git a/crates/hir_def/src/body/scope.rs b/crates/hir_def/src/body/scope.rs index 9142bc05b..065785da7 100644 --- a/crates/hir_def/src/body/scope.rs +++ b/crates/hir_def/src/body/scope.rs | |||
@@ -194,7 +194,7 @@ mod tests { | |||
194 | let mut buf = String::new(); | 194 | let mut buf = String::new(); |
195 | let off: usize = offset.into(); | 195 | let off: usize = offset.into(); |
196 | buf.push_str(&code[..off]); | 196 | buf.push_str(&code[..off]); |
197 | buf.push_str("<|>marker"); | 197 | buf.push_str("$0marker"); |
198 | buf.push_str(&code[off..]); | 198 | buf.push_str(&code[off..]); |
199 | buf | 199 | buf |
200 | }; | 200 | }; |
@@ -231,7 +231,7 @@ mod tests { | |||
231 | r" | 231 | r" |
232 | fn quux(foo: i32) { | 232 | fn quux(foo: i32) { |
233 | let f = |bar, baz: i32| { | 233 | let f = |bar, baz: i32| { |
234 | <|> | 234 | $0 |
235 | }; | 235 | }; |
236 | }", | 236 | }", |
237 | &["bar", "baz", "foo"], | 237 | &["bar", "baz", "foo"], |
@@ -243,7 +243,7 @@ mod tests { | |||
243 | do_check( | 243 | do_check( |
244 | r" | 244 | r" |
245 | fn quux() { | 245 | fn quux() { |
246 | f(|x| <|> ); | 246 | f(|x| $0 ); |
247 | }", | 247 | }", |
248 | &["x"], | 248 | &["x"], |
249 | ); | 249 | ); |
@@ -254,7 +254,7 @@ mod tests { | |||
254 | do_check( | 254 | do_check( |
255 | r" | 255 | r" |
256 | fn quux() { | 256 | fn quux() { |
257 | z.f(|x| <|> ); | 257 | z.f(|x| $0 ); |
258 | }", | 258 | }", |
259 | &["x"], | 259 | &["x"], |
260 | ); | 260 | ); |
@@ -267,7 +267,7 @@ mod tests { | |||
267 | fn quux() { | 267 | fn quux() { |
268 | loop { | 268 | loop { |
269 | let x = (); | 269 | let x = (); |
270 | <|> | 270 | $0 |
271 | }; | 271 | }; |
272 | }", | 272 | }", |
273 | &["x"], | 273 | &["x"], |
@@ -281,7 +281,7 @@ mod tests { | |||
281 | fn quux() { | 281 | fn quux() { |
282 | match () { | 282 | match () { |
283 | Some(x) => { | 283 | Some(x) => { |
284 | <|> | 284 | $0 |
285 | } | 285 | } |
286 | }; | 286 | }; |
287 | }", | 287 | }", |
@@ -294,7 +294,7 @@ mod tests { | |||
294 | do_check( | 294 | do_check( |
295 | r" | 295 | r" |
296 | fn foo(x: String) { | 296 | fn foo(x: String) { |
297 | let x : &str = &x<|>; | 297 | let x : &str = &x$0; |
298 | }", | 298 | }", |
299 | &["x"], | 299 | &["x"], |
300 | ); | 300 | ); |
@@ -307,7 +307,7 @@ mod tests { | |||
307 | fn foo() { | 307 | fn foo() { |
308 | match Some(()) { | 308 | match Some(()) { |
309 | opt @ Some(unit) => { | 309 | opt @ Some(unit) => { |
310 | <|> | 310 | $0 |
311 | } | 311 | } |
312 | _ => {} | 312 | _ => {} |
313 | } | 313 | } |
@@ -330,7 +330,7 @@ fn foo() { | |||
330 | 330 | ||
331 | fn foo() { | 331 | fn foo() { |
332 | mac!(); | 332 | mac!(); |
333 | <|> | 333 | $0 |
334 | } | 334 | } |
335 | ", | 335 | ", |
336 | &[], | 336 | &[], |
@@ -343,7 +343,7 @@ fn foo() { | |||
343 | r" | 343 | r" |
344 | fn foo() { | 344 | fn foo() { |
345 | trait {} | 345 | trait {} |
346 | <|> | 346 | $0 |
347 | } | 347 | } |
348 | ", | 348 | ", |
349 | &[], | 349 | &[], |
@@ -391,7 +391,7 @@ fn foo(x: i32, y: u32) { | |||
391 | let z = x * 2; | 391 | let z = x * 2; |
392 | } | 392 | } |
393 | { | 393 | { |
394 | let t = x<|> * 3; | 394 | let t = x$0 * 3; |
395 | } | 395 | } |
396 | } | 396 | } |
397 | "#, | 397 | "#, |
@@ -404,7 +404,7 @@ fn foo(x: i32, y: u32) { | |||
404 | do_check_local_name( | 404 | do_check_local_name( |
405 | r#" | 405 | r#" |
406 | fn foo(x: String) { | 406 | fn foo(x: String) { |
407 | let x : &str = &x<|>; | 407 | let x : &str = &x$0; |
408 | } | 408 | } |
409 | "#, | 409 | "#, |
410 | 7, | 410 | 7, |
@@ -417,7 +417,7 @@ fn foo(x: String) { | |||
417 | r" | 417 | r" |
418 | fn foo(x: String) { | 418 | fn foo(x: String) { |
419 | let x : &str = &x; | 419 | let x : &str = &x; |
420 | x<|> | 420 | x$0 |
421 | } | 421 | } |
422 | ", | 422 | ", |
423 | 28, | 423 | 28, |
@@ -430,7 +430,7 @@ fn foo(x: String) { | |||
430 | r" | 430 | r" |
431 | fn foo() { | 431 | fn foo() { |
432 | if let Some(&from) = bar() { | 432 | if let Some(&from) = bar() { |
433 | from<|>; | 433 | from$0; |
434 | } | 434 | } |
435 | } | 435 | } |
436 | ", | 436 | ", |
@@ -446,7 +446,7 @@ fn foo() { | |||
446 | fn test() { | 446 | fn test() { |
447 | let foo: Option<f32> = None; | 447 | let foo: Option<f32> = None; |
448 | while let Option::Some(spam) = foo { | 448 | while let Option::Some(spam) = foo { |
449 | spam<|> | 449 | spam$0 |
450 | } | 450 | } |
451 | } | 451 | } |
452 | "#, | 452 | "#, |
diff --git a/crates/hir_def/src/find_path.rs b/crates/hir_def/src/find_path.rs index 02613c4c4..4a212d291 100644 --- a/crates/hir_def/src/find_path.rs +++ b/crates/hir_def/src/find_path.rs | |||
@@ -410,7 +410,7 @@ mod tests { | |||
410 | let code = r#" | 410 | let code = r#" |
411 | //- /main.rs | 411 | //- /main.rs |
412 | struct S; | 412 | struct S; |
413 | <|> | 413 | $0 |
414 | "#; | 414 | "#; |
415 | check_found_path(code, "S", "S", "crate::S", "self::S"); | 415 | check_found_path(code, "S", "S", "crate::S", "self::S"); |
416 | } | 416 | } |
@@ -420,7 +420,7 @@ mod tests { | |||
420 | let code = r#" | 420 | let code = r#" |
421 | //- /main.rs | 421 | //- /main.rs |
422 | enum E { A } | 422 | enum E { A } |
423 | <|> | 423 | $0 |
424 | "#; | 424 | "#; |
425 | check_found_path(code, "E::A", "E::A", "E::A", "E::A"); | 425 | check_found_path(code, "E::A", "E::A", "E::A", "E::A"); |
426 | } | 426 | } |
@@ -432,7 +432,7 @@ mod tests { | |||
432 | mod foo { | 432 | mod foo { |
433 | pub struct S; | 433 | pub struct S; |
434 | } | 434 | } |
435 | <|> | 435 | $0 |
436 | "#; | 436 | "#; |
437 | check_found_path(code, "foo::S", "foo::S", "crate::foo::S", "self::foo::S"); | 437 | check_found_path(code, "foo::S", "foo::S", "crate::foo::S", "self::foo::S"); |
438 | } | 438 | } |
@@ -446,7 +446,7 @@ mod tests { | |||
446 | mod bar; | 446 | mod bar; |
447 | struct S; | 447 | struct S; |
448 | //- /foo/bar.rs | 448 | //- /foo/bar.rs |
449 | <|> | 449 | $0 |
450 | "#; | 450 | "#; |
451 | check_found_path(code, "super::S", "super::S", "crate::foo::S", "super::S"); | 451 | check_found_path(code, "super::S", "super::S", "crate::foo::S", "super::S"); |
452 | } | 452 | } |
@@ -457,7 +457,7 @@ mod tests { | |||
457 | //- /main.rs | 457 | //- /main.rs |
458 | mod foo; | 458 | mod foo; |
459 | //- /foo.rs | 459 | //- /foo.rs |
460 | <|> | 460 | $0 |
461 | "#; | 461 | "#; |
462 | check_found_path(code, "self", "self", "crate::foo", "self"); | 462 | check_found_path(code, "self", "self", "crate::foo", "self"); |
463 | } | 463 | } |
@@ -468,7 +468,7 @@ mod tests { | |||
468 | //- /main.rs | 468 | //- /main.rs |
469 | mod foo; | 469 | mod foo; |
470 | //- /foo.rs | 470 | //- /foo.rs |
471 | <|> | 471 | $0 |
472 | "#; | 472 | "#; |
473 | check_found_path(code, "crate", "crate", "crate", "crate"); | 473 | check_found_path(code, "crate", "crate", "crate", "crate"); |
474 | } | 474 | } |
@@ -480,7 +480,7 @@ mod tests { | |||
480 | mod foo; | 480 | mod foo; |
481 | struct S; | 481 | struct S; |
482 | //- /foo.rs | 482 | //- /foo.rs |
483 | <|> | 483 | $0 |
484 | "#; | 484 | "#; |
485 | check_found_path(code, "crate::S", "crate::S", "crate::S", "crate::S"); | 485 | check_found_path(code, "crate::S", "crate::S", "crate::S", "crate::S"); |
486 | } | 486 | } |
@@ -489,7 +489,7 @@ mod tests { | |||
489 | fn different_crate() { | 489 | fn different_crate() { |
490 | let code = r#" | 490 | let code = r#" |
491 | //- /main.rs crate:main deps:std | 491 | //- /main.rs crate:main deps:std |
492 | <|> | 492 | $0 |
493 | //- /std.rs crate:std | 493 | //- /std.rs crate:std |
494 | pub struct S; | 494 | pub struct S; |
495 | "#; | 495 | "#; |
@@ -501,7 +501,7 @@ mod tests { | |||
501 | let code = r#" | 501 | let code = r#" |
502 | //- /main.rs crate:main deps:std | 502 | //- /main.rs crate:main deps:std |
503 | extern crate std as std_renamed; | 503 | extern crate std as std_renamed; |
504 | <|> | 504 | $0 |
505 | //- /std.rs crate:std | 505 | //- /std.rs crate:std |
506 | pub struct S; | 506 | pub struct S; |
507 | "#; | 507 | "#; |
@@ -523,7 +523,7 @@ mod tests { | |||
523 | //- /main.rs crate:main deps:syntax | 523 | //- /main.rs crate:main deps:syntax |
524 | 524 | ||
525 | use syntax::ast; | 525 | use syntax::ast; |
526 | <|> | 526 | $0 |
527 | 527 | ||
528 | //- /lib.rs crate:syntax | 528 | //- /lib.rs crate:syntax |
529 | pub mod ast { | 529 | pub mod ast { |
@@ -543,7 +543,7 @@ mod tests { | |||
543 | let code = r#" | 543 | let code = r#" |
544 | //- /main.rs crate:main deps:syntax | 544 | //- /main.rs crate:main deps:syntax |
545 | 545 | ||
546 | <|> | 546 | $0 |
547 | 547 | ||
548 | //- /lib.rs crate:syntax | 548 | //- /lib.rs crate:syntax |
549 | pub mod ast { | 549 | pub mod ast { |
@@ -569,7 +569,7 @@ mod tests { | |||
569 | mod foo { pub(super) struct S; } | 569 | mod foo { pub(super) struct S; } |
570 | pub(crate) use foo::*; | 570 | pub(crate) use foo::*; |
571 | } | 571 | } |
572 | <|> | 572 | $0 |
573 | "#; | 573 | "#; |
574 | check_found_path(code, "bar::S", "bar::S", "crate::bar::S", "self::bar::S"); | 574 | check_found_path(code, "bar::S", "bar::S", "crate::bar::S", "self::bar::S"); |
575 | } | 575 | } |
@@ -582,7 +582,7 @@ mod tests { | |||
582 | mod foo { pub(super) struct S; } | 582 | mod foo { pub(super) struct S; } |
583 | pub(crate) use foo::S as U; | 583 | pub(crate) use foo::S as U; |
584 | } | 584 | } |
585 | <|> | 585 | $0 |
586 | "#; | 586 | "#; |
587 | check_found_path(code, "bar::U", "bar::U", "crate::bar::U", "self::bar::U"); | 587 | check_found_path(code, "bar::U", "bar::U", "crate::bar::U", "self::bar::U"); |
588 | } | 588 | } |
@@ -591,7 +591,7 @@ mod tests { | |||
591 | fn different_crate_reexport() { | 591 | fn different_crate_reexport() { |
592 | let code = r#" | 592 | let code = r#" |
593 | //- /main.rs crate:main deps:std | 593 | //- /main.rs crate:main deps:std |
594 | <|> | 594 | $0 |
595 | //- /std.rs crate:std deps:core | 595 | //- /std.rs crate:std deps:core |
596 | pub use core::S; | 596 | pub use core::S; |
597 | //- /core.rs crate:core | 597 | //- /core.rs crate:core |
@@ -604,7 +604,7 @@ mod tests { | |||
604 | fn prelude() { | 604 | fn prelude() { |
605 | let code = r#" | 605 | let code = r#" |
606 | //- /main.rs crate:main deps:std | 606 | //- /main.rs crate:main deps:std |
607 | <|> | 607 | $0 |
608 | //- /std.rs crate:std | 608 | //- /std.rs crate:std |
609 | pub mod prelude { pub struct S; } | 609 | pub mod prelude { pub struct S; } |
610 | #[prelude_import] | 610 | #[prelude_import] |
@@ -617,7 +617,7 @@ mod tests { | |||
617 | fn enum_variant_from_prelude() { | 617 | fn enum_variant_from_prelude() { |
618 | let code = r#" | 618 | let code = r#" |
619 | //- /main.rs crate:main deps:std | 619 | //- /main.rs crate:main deps:std |
620 | <|> | 620 | $0 |
621 | //- /std.rs crate:std | 621 | //- /std.rs crate:std |
622 | pub mod prelude { | 622 | pub mod prelude { |
623 | pub enum Option<T> { Some(T), None } | 623 | pub enum Option<T> { Some(T), None } |
@@ -637,7 +637,7 @@ mod tests { | |||
637 | pub mod foo; | 637 | pub mod foo; |
638 | pub mod baz; | 638 | pub mod baz; |
639 | struct S; | 639 | struct S; |
640 | <|> | 640 | $0 |
641 | //- /foo.rs | 641 | //- /foo.rs |
642 | pub mod bar { pub struct S; } | 642 | pub mod bar { pub struct S; } |
643 | //- /baz.rs | 643 | //- /baz.rs |
@@ -654,7 +654,7 @@ mod tests { | |||
654 | pub mod bar { pub struct S; } | 654 | pub mod bar { pub struct S; } |
655 | use bar::S; | 655 | use bar::S; |
656 | //- /foo.rs | 656 | //- /foo.rs |
657 | <|> | 657 | $0 |
658 | "#; | 658 | "#; |
659 | // crate::S would be shorter, but using private imports seems wrong | 659 | // crate::S would be shorter, but using private imports seems wrong |
660 | check_found_path(code, "crate::bar::S", "crate::bar::S", "crate::bar::S", "crate::bar::S"); | 660 | check_found_path(code, "crate::bar::S", "crate::bar::S", "crate::bar::S", "crate::bar::S"); |
@@ -668,7 +668,7 @@ mod tests { | |||
668 | pub mod bar; | 668 | pub mod bar; |
669 | pub mod baz; | 669 | pub mod baz; |
670 | //- /bar.rs | 670 | //- /bar.rs |
671 | <|> | 671 | $0 |
672 | //- /foo.rs | 672 | //- /foo.rs |
673 | pub use super::baz; | 673 | pub use super::baz; |
674 | pub struct S; | 674 | pub struct S; |
@@ -683,7 +683,7 @@ mod tests { | |||
683 | mark::check!(prefer_std_paths); | 683 | mark::check!(prefer_std_paths); |
684 | let code = r#" | 684 | let code = r#" |
685 | //- /main.rs crate:main deps:alloc,std | 685 | //- /main.rs crate:main deps:alloc,std |
686 | <|> | 686 | $0 |
687 | 687 | ||
688 | //- /std.rs crate:std deps:alloc | 688 | //- /std.rs crate:std deps:alloc |
689 | pub mod sync { | 689 | pub mod sync { |
@@ -711,7 +711,7 @@ mod tests { | |||
711 | //- /main.rs crate:main deps:core,std | 711 | //- /main.rs crate:main deps:core,std |
712 | #![no_std] | 712 | #![no_std] |
713 | 713 | ||
714 | <|> | 714 | $0 |
715 | 715 | ||
716 | //- /std.rs crate:std deps:core | 716 | //- /std.rs crate:std deps:core |
717 | 717 | ||
@@ -740,7 +740,7 @@ mod tests { | |||
740 | //- /main.rs crate:main deps:alloc,std | 740 | //- /main.rs crate:main deps:alloc,std |
741 | #![no_std] | 741 | #![no_std] |
742 | 742 | ||
743 | <|> | 743 | $0 |
744 | 744 | ||
745 | //- /std.rs crate:std deps:alloc | 745 | //- /std.rs crate:std deps:alloc |
746 | 746 | ||
@@ -767,7 +767,7 @@ mod tests { | |||
767 | fn prefer_shorter_paths_if_not_alloc() { | 767 | fn prefer_shorter_paths_if_not_alloc() { |
768 | let code = r#" | 768 | let code = r#" |
769 | //- /main.rs crate:main deps:megaalloc,std | 769 | //- /main.rs crate:main deps:megaalloc,std |
770 | <|> | 770 | $0 |
771 | 771 | ||
772 | //- /std.rs crate:std deps:megaalloc | 772 | //- /std.rs crate:std deps:megaalloc |
773 | pub mod sync { | 773 | pub mod sync { |
@@ -790,7 +790,7 @@ mod tests { | |||
790 | fn builtins_are_in_scope() { | 790 | fn builtins_are_in_scope() { |
791 | let code = r#" | 791 | let code = r#" |
792 | //- /main.rs | 792 | //- /main.rs |
793 | <|> | 793 | $0 |
794 | 794 | ||
795 | pub mod primitive { | 795 | pub mod primitive { |
796 | pub use u8; | 796 | pub use u8; |
diff --git a/crates/hir_def/src/nameres/tests/incremental.rs b/crates/hir_def/src/nameres/tests/incremental.rs index 8981fa7c9..509e1bbbc 100644 --- a/crates/hir_def/src/nameres/tests/incremental.rs +++ b/crates/hir_def/src/nameres/tests/incremental.rs | |||
@@ -28,7 +28,7 @@ fn typing_inside_a_function_should_not_invalidate_def_map() { | |||
28 | check_def_map_is_not_recomputed( | 28 | check_def_map_is_not_recomputed( |
29 | r" | 29 | r" |
30 | //- /lib.rs | 30 | //- /lib.rs |
31 | mod foo;<|> | 31 | mod foo;$0 |
32 | 32 | ||
33 | use crate::foo::bar::Baz; | 33 | use crate::foo::bar::Baz; |
34 | 34 | ||
@@ -81,7 +81,7 @@ fn typing_inside_a_macro_should_not_invalidate_def_map() { | |||
81 | pub mod bar; | 81 | pub mod bar; |
82 | 82 | ||
83 | //- /foo/bar.rs | 83 | //- /foo/bar.rs |
84 | <|> | 84 | $0 |
85 | m!(X); | 85 | m!(X); |
86 | ", | 86 | ", |
87 | ); | 87 | ); |
diff --git a/crates/hir_expand/src/builtin_derive.rs b/crates/hir_expand/src/builtin_derive.rs index ad378762a..eb257579f 100644 --- a/crates/hir_expand/src/builtin_derive.rs +++ b/crates/hir_expand/src/builtin_derive.rs | |||
@@ -277,7 +277,7 @@ mod tests { | |||
277 | let expander = BuiltinDeriveExpander::find_by_name(&name).unwrap(); | 277 | let expander = BuiltinDeriveExpander::find_by_name(&name).unwrap(); |
278 | let fixture = format!( | 278 | let fixture = format!( |
279 | r#"//- /main.rs crate:main deps:core | 279 | r#"//- /main.rs crate:main deps:core |
280 | <|> | 280 | $0 |
281 | {} | 281 | {} |
282 | //- /lib.rs crate:core | 282 | //- /lib.rs crate:core |
283 | // empty | 283 | // empty |
diff --git a/crates/hir_ty/src/tests.rs b/crates/hir_ty/src/tests.rs index 0a400cb70..3b1675f0b 100644 --- a/crates/hir_ty/src/tests.rs +++ b/crates/hir_ty/src/tests.rs | |||
@@ -314,7 +314,7 @@ fn typing_whitespace_inside_a_function_should_not_invalidate_types() { | |||
314 | " | 314 | " |
315 | //- /lib.rs | 315 | //- /lib.rs |
316 | fn foo() -> i32 { | 316 | fn foo() -> i32 { |
317 | <|>1 + 1 | 317 | $01 + 1 |
318 | } | 318 | } |
319 | ", | 319 | ", |
320 | ); | 320 | ); |
diff --git a/crates/ide/src/call_hierarchy.rs b/crates/ide/src/call_hierarchy.rs index 3c2d39f5d..4d8983cb2 100644 --- a/crates/ide/src/call_hierarchy.rs +++ b/crates/ide/src/call_hierarchy.rs | |||
@@ -178,7 +178,7 @@ mod tests { | |||
178 | //- /lib.rs | 178 | //- /lib.rs |
179 | fn callee() {} | 179 | fn callee() {} |
180 | fn caller() { | 180 | fn caller() { |
181 | call<|>ee(); | 181 | call$0ee(); |
182 | } | 182 | } |
183 | "#, | 183 | "#, |
184 | "callee Function FileId(0) 0..14 3..9", | 184 | "callee Function FileId(0) 0..14 3..9", |
@@ -192,7 +192,7 @@ fn caller() { | |||
192 | check_hierarchy( | 192 | check_hierarchy( |
193 | r#" | 193 | r#" |
194 | //- /lib.rs | 194 | //- /lib.rs |
195 | fn call<|>ee() {} | 195 | fn call$0ee() {} |
196 | fn caller() { | 196 | fn caller() { |
197 | callee(); | 197 | callee(); |
198 | } | 198 | } |
@@ -210,7 +210,7 @@ fn caller() { | |||
210 | //- /lib.rs | 210 | //- /lib.rs |
211 | fn callee() {} | 211 | fn callee() {} |
212 | fn caller() { | 212 | fn caller() { |
213 | call<|>ee(); | 213 | call$0ee(); |
214 | callee(); | 214 | callee(); |
215 | } | 215 | } |
216 | "#, | 216 | "#, |
@@ -227,7 +227,7 @@ fn caller() { | |||
227 | //- /lib.rs | 227 | //- /lib.rs |
228 | fn callee() {} | 228 | fn callee() {} |
229 | fn caller1() { | 229 | fn caller1() { |
230 | call<|>ee(); | 230 | call$0ee(); |
231 | } | 231 | } |
232 | 232 | ||
233 | fn caller2() { | 233 | fn caller2() { |
@@ -250,7 +250,7 @@ fn caller2() { | |||
250 | //- /lib.rs cfg:test | 250 | //- /lib.rs cfg:test |
251 | fn callee() {} | 251 | fn callee() {} |
252 | fn caller1() { | 252 | fn caller1() { |
253 | call<|>ee(); | 253 | call$0ee(); |
254 | } | 254 | } |
255 | 255 | ||
256 | #[cfg(test)] | 256 | #[cfg(test)] |
@@ -281,7 +281,7 @@ mod foo; | |||
281 | use foo::callee; | 281 | use foo::callee; |
282 | 282 | ||
283 | fn caller() { | 283 | fn caller() { |
284 | call<|>ee(); | 284 | call$0ee(); |
285 | } | 285 | } |
286 | 286 | ||
287 | //- /foo/mod.rs | 287 | //- /foo/mod.rs |
@@ -299,7 +299,7 @@ pub fn callee() {} | |||
299 | r#" | 299 | r#" |
300 | //- /lib.rs | 300 | //- /lib.rs |
301 | fn callee() {} | 301 | fn callee() {} |
302 | fn call<|>er() { | 302 | fn call$0er() { |
303 | callee(); | 303 | callee(); |
304 | callee(); | 304 | callee(); |
305 | } | 305 | } |
@@ -318,7 +318,7 @@ fn call<|>er() { | |||
318 | mod foo; | 318 | mod foo; |
319 | use foo::callee; | 319 | use foo::callee; |
320 | 320 | ||
321 | fn call<|>er() { | 321 | fn call$0er() { |
322 | callee(); | 322 | callee(); |
323 | } | 323 | } |
324 | 324 | ||
@@ -337,7 +337,7 @@ pub fn callee() {} | |||
337 | r#" | 337 | r#" |
338 | //- /lib.rs | 338 | //- /lib.rs |
339 | fn caller1() { | 339 | fn caller1() { |
340 | call<|>er2(); | 340 | call$0er2(); |
341 | } | 341 | } |
342 | 342 | ||
343 | fn caller2() { | 343 | fn caller2() { |
@@ -365,7 +365,7 @@ fn a() { | |||
365 | fn b() {} | 365 | fn b() {} |
366 | 366 | ||
367 | fn main() { | 367 | fn main() { |
368 | a<|>() | 368 | a$0() |
369 | } | 369 | } |
370 | "#, | 370 | "#, |
371 | "a Function FileId(0) 0..18 3..4", | 371 | "a Function FileId(0) 0..18 3..4", |
@@ -376,7 +376,7 @@ fn main() { | |||
376 | check_hierarchy( | 376 | check_hierarchy( |
377 | r#" | 377 | r#" |
378 | fn a() { | 378 | fn a() { |
379 | b<|>() | 379 | b$0() |
380 | } | 380 | } |
381 | 381 | ||
382 | fn b() {} | 382 | fn b() {} |
diff --git a/crates/ide/src/diagnostics.rs b/crates/ide/src/diagnostics.rs index 79d126ff2..6931a6190 100644 --- a/crates/ide/src/diagnostics.rs +++ b/crates/ide/src/diagnostics.rs | |||
@@ -315,7 +315,7 @@ fn div(x: i32, y: i32) -> Result<i32, ()> { | |||
315 | if y == 0 { | 315 | if y == 0 { |
316 | return Err(()); | 316 | return Err(()); |
317 | } | 317 | } |
318 | x / y<|> | 318 | x / y$0 |
319 | } | 319 | } |
320 | //- /core/lib.rs crate:core | 320 | //- /core/lib.rs crate:core |
321 | pub mod result { | 321 | pub mod result { |
@@ -346,7 +346,7 @@ fn div<T>(x: T) -> Result<T, i32> { | |||
346 | if x == 0 { | 346 | if x == 0 { |
347 | return Err(7); | 347 | return Err(7); |
348 | } | 348 | } |
349 | <|>x | 349 | $0x |
350 | } | 350 | } |
351 | //- /core/lib.rs crate:core | 351 | //- /core/lib.rs crate:core |
352 | pub mod result { | 352 | pub mod result { |
@@ -379,7 +379,7 @@ fn div(x: i32, y: i32) -> MyResult<i32> { | |||
379 | if y == 0 { | 379 | if y == 0 { |
380 | return Err(()); | 380 | return Err(()); |
381 | } | 381 | } |
382 | x <|>/ y | 382 | x $0/ y |
383 | } | 383 | } |
384 | //- /core/lib.rs crate:core | 384 | //- /core/lib.rs crate:core |
385 | pub mod result { | 385 | pub mod result { |
@@ -444,7 +444,7 @@ pub mod result { | |||
444 | struct TestStruct { one: i32, two: i64 } | 444 | struct TestStruct { one: i32, two: i64 } |
445 | 445 | ||
446 | fn test_fn() { | 446 | fn test_fn() { |
447 | let s = TestStruct {<|>}; | 447 | let s = TestStruct {$0}; |
448 | } | 448 | } |
449 | "#, | 449 | "#, |
450 | r#" | 450 | r#" |
@@ -464,7 +464,7 @@ fn test_fn() { | |||
464 | struct TestStruct { one: i32 } | 464 | struct TestStruct { one: i32 } |
465 | 465 | ||
466 | impl TestStruct { | 466 | impl TestStruct { |
467 | fn test_fn() { let s = Self {<|>}; } | 467 | fn test_fn() { let s = Self {$0}; } |
468 | } | 468 | } |
469 | "#, | 469 | "#, |
470 | r#" | 470 | r#" |
@@ -487,7 +487,7 @@ enum Expr { | |||
487 | 487 | ||
488 | impl Expr { | 488 | impl Expr { |
489 | fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr { | 489 | fn new_bin(lhs: Box<Expr>, rhs: Box<Expr>) -> Expr { |
490 | Expr::Bin {<|> } | 490 | Expr::Bin {$0 } |
491 | } | 491 | } |
492 | } | 492 | } |
493 | "#, | 493 | "#, |
@@ -512,7 +512,7 @@ impl Expr { | |||
512 | struct TestStruct { one: i32, two: i64 } | 512 | struct TestStruct { one: i32, two: i64 } |
513 | 513 | ||
514 | fn test_fn() { | 514 | fn test_fn() { |
515 | let s = TestStruct{ two: 2<|> }; | 515 | let s = TestStruct{ two: 2$0 }; |
516 | } | 516 | } |
517 | "#, | 517 | "#, |
518 | r" | 518 | r" |
@@ -608,7 +608,7 @@ fn here() {} | |||
608 | macro_rules! id { ($($tt:tt)*) => { $($tt)*}; } | 608 | macro_rules! id { ($($tt:tt)*) => { $($tt)*}; } |
609 | 609 | ||
610 | fn main() { | 610 | fn main() { |
611 | let _x = id![Foo { a: <|>42 }]; | 611 | let _x = id![Foo { a: $042 }]; |
612 | } | 612 | } |
613 | 613 | ||
614 | pub struct Foo { pub a: i32, pub b: i32 } | 614 | pub struct Foo { pub a: i32, pub b: i32 } |
@@ -663,7 +663,7 @@ mod a { | |||
663 | check_fix( | 663 | check_fix( |
664 | r" | 664 | r" |
665 | mod b {} | 665 | mod b {} |
666 | use {<|>b}; | 666 | use {$0b}; |
667 | ", | 667 | ", |
668 | r" | 668 | r" |
669 | mod b {} | 669 | mod b {} |
@@ -673,7 +673,7 @@ mod a { | |||
673 | check_fix( | 673 | check_fix( |
674 | r" | 674 | r" |
675 | mod b {} | 675 | mod b {} |
676 | use {b<|>}; | 676 | use {b$0}; |
677 | ", | 677 | ", |
678 | r" | 678 | r" |
679 | mod b {} | 679 | mod b {} |
@@ -683,7 +683,7 @@ mod a { | |||
683 | check_fix( | 683 | check_fix( |
684 | r" | 684 | r" |
685 | mod a { mod c {} } | 685 | mod a { mod c {} } |
686 | use a::{c<|>}; | 686 | use a::{c$0}; |
687 | ", | 687 | ", |
688 | r" | 688 | r" |
689 | mod a { mod c {} } | 689 | mod a { mod c {} } |
@@ -693,7 +693,7 @@ mod a { | |||
693 | check_fix( | 693 | check_fix( |
694 | r" | 694 | r" |
695 | mod a {} | 695 | mod a {} |
696 | use a::{self<|>}; | 696 | use a::{self$0}; |
697 | ", | 697 | ", |
698 | r" | 698 | r" |
699 | mod a {} | 699 | mod a {} |
@@ -703,7 +703,7 @@ mod a { | |||
703 | check_fix( | 703 | check_fix( |
704 | r" | 704 | r" |
705 | mod a { mod c {} mod d { mod e {} } } | 705 | mod a { mod c {} mod d { mod e {} } } |
706 | use a::{c, d::{e<|>}}; | 706 | use a::{c, d::{e$0}}; |
707 | ", | 707 | ", |
708 | r" | 708 | r" |
709 | mod a { mod c {} mod d { mod e {} } } | 709 | mod a { mod c {} mod d { mod e {} } } |
@@ -717,7 +717,7 @@ mod a { | |||
717 | check_fix( | 717 | check_fix( |
718 | r" | 718 | r" |
719 | fn main() { | 719 | fn main() { |
720 | Foo { bar: 3, baz<|>: false}; | 720 | Foo { bar: 3, baz$0: false}; |
721 | } | 721 | } |
722 | struct Foo { | 722 | struct Foo { |
723 | bar: i32 | 723 | bar: i32 |
@@ -743,7 +743,7 @@ struct Foo { | |||
743 | mod foo; | 743 | mod foo; |
744 | 744 | ||
745 | fn main() { | 745 | fn main() { |
746 | foo::Foo { bar: 3, <|>baz: false}; | 746 | foo::Foo { bar: 3, $0baz: false}; |
747 | } | 747 | } |
748 | //- /foo.rs | 748 | //- /foo.rs |
749 | struct Foo { | 749 | struct Foo { |
@@ -777,7 +777,7 @@ struct Foo { | |||
777 | fn test_rename_incorrect_case() { | 777 | fn test_rename_incorrect_case() { |
778 | check_fix( | 778 | check_fix( |
779 | r#" | 779 | r#" |
780 | pub struct test_struct<|> { one: i32 } | 780 | pub struct test_struct$0 { one: i32 } |
781 | 781 | ||
782 | pub fn some_fn(val: test_struct) -> test_struct { | 782 | pub fn some_fn(val: test_struct) -> test_struct { |
783 | test_struct { one: val.one + 1 } | 783 | test_struct { one: val.one + 1 } |
@@ -794,7 +794,7 @@ pub fn some_fn(val: TestStruct) -> TestStruct { | |||
794 | 794 | ||
795 | check_fix( | 795 | check_fix( |
796 | r#" | 796 | r#" |
797 | pub fn some_fn(NonSnakeCase<|>: u8) -> u8 { | 797 | pub fn some_fn(NonSnakeCase$0: u8) -> u8 { |
798 | NonSnakeCase | 798 | NonSnakeCase |
799 | } | 799 | } |
800 | "#, | 800 | "#, |
@@ -807,7 +807,7 @@ pub fn some_fn(non_snake_case: u8) -> u8 { | |||
807 | 807 | ||
808 | check_fix( | 808 | check_fix( |
809 | r#" | 809 | r#" |
810 | pub fn SomeFn<|>(val: u8) -> u8 { | 810 | pub fn SomeFn$0(val: u8) -> u8 { |
811 | if val != 0 { SomeFn(val - 1) } else { val } | 811 | if val != 0 { SomeFn(val - 1) } else { val } |
812 | } | 812 | } |
813 | "#, | 813 | "#, |
@@ -821,7 +821,7 @@ pub fn some_fn(val: u8) -> u8 { | |||
821 | check_fix( | 821 | check_fix( |
822 | r#" | 822 | r#" |
823 | fn some_fn() { | 823 | fn some_fn() { |
824 | let whatAWeird_Formatting<|> = 10; | 824 | let whatAWeird_Formatting$0 = 10; |
825 | another_func(whatAWeird_Formatting); | 825 | another_func(whatAWeird_Formatting); |
826 | } | 826 | } |
827 | "#, | 827 | "#, |
@@ -839,7 +839,7 @@ fn some_fn() { | |||
839 | check_no_diagnostics( | 839 | check_no_diagnostics( |
840 | r#" | 840 | r#" |
841 | fn foo() { | 841 | fn foo() { |
842 | const ANOTHER_ITEM<|>: &str = "some_item"; | 842 | const ANOTHER_ITEM$0: &str = "some_item"; |
843 | } | 843 | } |
844 | "#, | 844 | "#, |
845 | ); | 845 | ); |
@@ -852,7 +852,7 @@ fn foo() { | |||
852 | pub struct TestStruct; | 852 | pub struct TestStruct; |
853 | 853 | ||
854 | impl TestStruct { | 854 | impl TestStruct { |
855 | pub fn SomeFn<|>() -> TestStruct { | 855 | pub fn SomeFn$0() -> TestStruct { |
856 | TestStruct | 856 | TestStruct |
857 | } | 857 | } |
858 | } | 858 | } |
@@ -871,7 +871,7 @@ impl TestStruct { | |||
871 | 871 | ||
872 | #[test] | 872 | #[test] |
873 | fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() { | 873 | fn test_single_incorrect_case_diagnostic_in_function_name_issue_6970() { |
874 | let input = r#"fn FOO<|>() {}"#; | 874 | let input = r#"fn FOO$0() {}"#; |
875 | let expected = r#"fn foo() {}"#; | 875 | let expected = r#"fn foo() {}"#; |
876 | 876 | ||
877 | let (analysis, file_position) = fixture::position(input); | 877 | let (analysis, file_position) = fixture::position(input); |
diff --git a/crates/ide/src/diagnostics/field_shorthand.rs b/crates/ide/src/diagnostics/field_shorthand.rs index f41bcd619..16c6ea827 100644 --- a/crates/ide/src/diagnostics/field_shorthand.rs +++ b/crates/ide/src/diagnostics/field_shorthand.rs | |||
@@ -120,7 +120,7 @@ fn main() { A { 0: 0 } } | |||
120 | struct A { a: &'static str } | 120 | struct A { a: &'static str } |
121 | fn main() { | 121 | fn main() { |
122 | let a = "haha"; | 122 | let a = "haha"; |
123 | A { a<|>: a } | 123 | A { a$0: a } |
124 | } | 124 | } |
125 | "#, | 125 | "#, |
126 | r#" | 126 | r#" |
@@ -138,7 +138,7 @@ struct A { a: &'static str, b: &'static str } | |||
138 | fn main() { | 138 | fn main() { |
139 | let a = "haha"; | 139 | let a = "haha"; |
140 | let b = "bb"; | 140 | let b = "bb"; |
141 | A { a<|>: a, b } | 141 | A { a$0: a, b } |
142 | } | 142 | } |
143 | "#, | 143 | "#, |
144 | r#" | 144 | r#" |
@@ -171,7 +171,7 @@ fn f(a: A) { let A { 0: 0 } = a; } | |||
171 | r#" | 171 | r#" |
172 | struct A { a: &'static str } | 172 | struct A { a: &'static str } |
173 | fn f(a: A) { | 173 | fn f(a: A) { |
174 | let A { a<|>: a } = a; | 174 | let A { a$0: a } = a; |
175 | } | 175 | } |
176 | "#, | 176 | "#, |
177 | r#" | 177 | r#" |
@@ -186,7 +186,7 @@ fn f(a: A) { | |||
186 | r#" | 186 | r#" |
187 | struct A { a: &'static str, b: &'static str } | 187 | struct A { a: &'static str, b: &'static str } |
188 | fn f(a: A) { | 188 | fn f(a: A) { |
189 | let A { a<|>: a, b } = a; | 189 | let A { a$0: a, b } = a; |
190 | } | 190 | } |
191 | "#, | 191 | "#, |
192 | r#" | 192 | r#" |
diff --git a/crates/ide/src/doc_links.rs b/crates/ide/src/doc_links.rs index 367fac05e..1ff818de2 100644 --- a/crates/ide/src/doc_links.rs +++ b/crates/ide/src/doc_links.rs | |||
@@ -464,7 +464,7 @@ mod tests { | |||
464 | fn test_doc_url_struct() { | 464 | fn test_doc_url_struct() { |
465 | check( | 465 | check( |
466 | r#" | 466 | r#" |
467 | pub struct Fo<|>o; | 467 | pub struct Fo$0o; |
468 | "#, | 468 | "#, |
469 | expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]], | 469 | expect![[r#"https://docs.rs/test/*/test/struct.Foo.html"#]], |
470 | ); | 470 | ); |
@@ -474,7 +474,7 @@ pub struct Fo<|>o; | |||
474 | fn test_doc_url_fn() { | 474 | fn test_doc_url_fn() { |
475 | check( | 475 | check( |
476 | r#" | 476 | r#" |
477 | pub fn fo<|>o() {} | 477 | pub fn fo$0o() {} |
478 | "#, | 478 | "#, |
479 | expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]], | 479 | expect![[r##"https://docs.rs/test/*/test/fn.foo.html#method.foo"##]], |
480 | ); | 480 | ); |
@@ -487,7 +487,7 @@ pub fn fo<|>o() {} | |||
487 | pub struct Foo; | 487 | pub struct Foo; |
488 | 488 | ||
489 | impl Foo { | 489 | impl Foo { |
490 | pub fn met<|>hod() {} | 490 | pub fn met$0hod() {} |
491 | } | 491 | } |
492 | 492 | ||
493 | "#, | 493 | "#, |
@@ -500,7 +500,7 @@ impl Foo { | |||
500 | check( | 500 | check( |
501 | r#" | 501 | r#" |
502 | pub trait Bar { | 502 | pub trait Bar { |
503 | fn met<|>hod() {} | 503 | fn met$0hod() {} |
504 | } | 504 | } |
505 | 505 | ||
506 | "#, | 506 | "#, |
@@ -513,7 +513,7 @@ pub trait Bar { | |||
513 | check( | 513 | check( |
514 | r#" | 514 | r#" |
515 | pub trait Foo { | 515 | pub trait Foo { |
516 | fn met<|>hod(); | 516 | fn met$0hod(); |
517 | } | 517 | } |
518 | 518 | ||
519 | "#, | 519 | "#, |
@@ -526,7 +526,7 @@ pub trait Foo { | |||
526 | check( | 526 | check( |
527 | r#" | 527 | r#" |
528 | pub struct Foo { | 528 | pub struct Foo { |
529 | pub fie<|>ld: () | 529 | pub fie$0ld: () |
530 | } | 530 | } |
531 | 531 | ||
532 | "#, | 532 | "#, |
@@ -539,7 +539,7 @@ pub struct Foo { | |||
539 | check( | 539 | check( |
540 | r#" | 540 | r#" |
541 | pub mod foo { | 541 | pub mod foo { |
542 | pub mod ba<|>r {} | 542 | pub mod ba$0r {} |
543 | } | 543 | } |
544 | "#, | 544 | "#, |
545 | expect![[r#"https://docs.rs/test/*/test/foo/bar/index.html"#]], | 545 | expect![[r#"https://docs.rs/test/*/test/foo/bar/index.html"#]], |
@@ -564,7 +564,7 @@ pub mod wrapper { | |||
564 | } | 564 | } |
565 | 565 | ||
566 | fn foo() { | 566 | fn foo() { |
567 | let bar: wrapper::It<|>em; | 567 | let bar: wrapper::It$0em; |
568 | } | 568 | } |
569 | "#, | 569 | "#, |
570 | expect![[r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"#]], | 570 | expect![[r#"https://docs.rs/test/*/test/wrapper/module/struct.Item.html"#]], |
diff --git a/crates/ide/src/expand_macro.rs b/crates/ide/src/expand_macro.rs index 8d75e0f05..ffb3a6f7d 100644 --- a/crates/ide/src/expand_macro.rs +++ b/crates/ide/src/expand_macro.rs | |||
@@ -144,7 +144,7 @@ macro_rules! foo { | |||
144 | macro_rules! baz { | 144 | macro_rules! baz { |
145 | () => { foo!(); } | 145 | () => { foo!(); } |
146 | } | 146 | } |
147 | f<|>oo!(); | 147 | f$0oo!(); |
148 | "#, | 148 | "#, |
149 | expect![[r#" | 149 | expect![[r#" |
150 | foo | 150 | foo |
@@ -165,7 +165,7 @@ macro_rules! foo { | |||
165 | } | 165 | } |
166 | } | 166 | } |
167 | } | 167 | } |
168 | f<|>oo!(); | 168 | f$0oo!(); |
169 | "#, | 169 | "#, |
170 | expect![[r#" | 170 | expect![[r#" |
171 | foo | 171 | foo |
@@ -192,7 +192,7 @@ macro_rules! match_ast { | |||
192 | } | 192 | } |
193 | 193 | ||
194 | fn main() { | 194 | fn main() { |
195 | mat<|>ch_ast! { | 195 | mat$0ch_ast! { |
196 | match container { | 196 | match container { |
197 | ast::TraitDef(it) => {}, | 197 | ast::TraitDef(it) => {}, |
198 | ast::ImplDef(it) => {}, | 198 | ast::ImplDef(it) => {}, |
@@ -226,7 +226,7 @@ macro_rules! match_ast { | |||
226 | 226 | ||
227 | fn main() { | 227 | fn main() { |
228 | let p = f(|it| { | 228 | let p = f(|it| { |
229 | let res = mat<|>ch_ast! { match c {}}; | 229 | let res = mat$0ch_ast! { match c {}}; |
230 | Some(res) | 230 | Some(res) |
231 | })?; | 231 | })?; |
232 | } | 232 | } |
@@ -250,7 +250,7 @@ macro_rules! foo { | |||
250 | } | 250 | } |
251 | 251 | ||
252 | fn main() { | 252 | fn main() { |
253 | let res = fo<|>o!(); | 253 | let res = fo$0o!(); |
254 | } | 254 | } |
255 | "#, | 255 | "#, |
256 | expect![[r#" | 256 | expect![[r#" |
@@ -272,7 +272,7 @@ macro_rules! foo { | |||
272 | } | 272 | } |
273 | 273 | ||
274 | fn main() { | 274 | fn main() { |
275 | let res = fo<|>o!(); | 275 | let res = fo$0o!(); |
276 | } | 276 | } |
277 | "#, | 277 | "#, |
278 | expect![[r#" | 278 | expect![[r#" |
diff --git a/crates/ide/src/extend_selection.rs b/crates/ide/src/extend_selection.rs index 6f3022dfd..56418c960 100644 --- a/crates/ide/src/extend_selection.rs +++ b/crates/ide/src/extend_selection.rs | |||
@@ -334,29 +334,29 @@ mod tests { | |||
334 | 334 | ||
335 | #[test] | 335 | #[test] |
336 | fn test_extend_selection_arith() { | 336 | fn test_extend_selection_arith() { |
337 | do_check(r#"fn foo() { <|>1 + 1 }"#, &["1", "1 + 1", "{ 1 + 1 }"]); | 337 | do_check(r#"fn foo() { $01 + 1 }"#, &["1", "1 + 1", "{ 1 + 1 }"]); |
338 | } | 338 | } |
339 | 339 | ||
340 | #[test] | 340 | #[test] |
341 | fn test_extend_selection_list() { | 341 | fn test_extend_selection_list() { |
342 | do_check(r#"fn foo(<|>x: i32) {}"#, &["x", "x: i32"]); | 342 | do_check(r#"fn foo($0x: i32) {}"#, &["x", "x: i32"]); |
343 | do_check(r#"fn foo(<|>x: i32, y: i32) {}"#, &["x", "x: i32", "x: i32, "]); | 343 | do_check(r#"fn foo($0x: i32, y: i32) {}"#, &["x", "x: i32", "x: i32, "]); |
344 | do_check(r#"fn foo(<|>x: i32,y: i32) {}"#, &["x", "x: i32", "x: i32,", "(x: i32,y: i32)"]); | 344 | do_check(r#"fn foo($0x: i32,y: i32) {}"#, &["x", "x: i32", "x: i32,", "(x: i32,y: i32)"]); |
345 | do_check(r#"fn foo(x: i32, <|>y: i32) {}"#, &["y", "y: i32", ", y: i32"]); | 345 | do_check(r#"fn foo(x: i32, $0y: i32) {}"#, &["y", "y: i32", ", y: i32"]); |
346 | do_check(r#"fn foo(x: i32, <|>y: i32, ) {}"#, &["y", "y: i32", "y: i32, "]); | 346 | do_check(r#"fn foo(x: i32, $0y: i32, ) {}"#, &["y", "y: i32", "y: i32, "]); |
347 | do_check(r#"fn foo(x: i32,<|>y: i32) {}"#, &["y", "y: i32", ",y: i32"]); | 347 | do_check(r#"fn foo(x: i32,$0y: i32) {}"#, &["y", "y: i32", ",y: i32"]); |
348 | 348 | ||
349 | do_check(r#"const FOO: [usize; 2] = [ 22<|> , 33];"#, &["22", "22 , "]); | 349 | do_check(r#"const FOO: [usize; 2] = [ 22$0 , 33];"#, &["22", "22 , "]); |
350 | do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|>];"#, &["33", ", 33"]); | 350 | do_check(r#"const FOO: [usize; 2] = [ 22 , 33$0];"#, &["33", ", 33"]); |
351 | do_check(r#"const FOO: [usize; 2] = [ 22 , 33<|> ,];"#, &["33", "33 ,", "[ 22 , 33 ,]"]); | 351 | do_check(r#"const FOO: [usize; 2] = [ 22 , 33$0 ,];"#, &["33", "33 ,", "[ 22 , 33 ,]"]); |
352 | 352 | ||
353 | do_check(r#"fn main() { (1, 2<|>) }"#, &["2", ", 2", "(1, 2)"]); | 353 | do_check(r#"fn main() { (1, 2$0) }"#, &["2", ", 2", "(1, 2)"]); |
354 | 354 | ||
355 | do_check( | 355 | do_check( |
356 | r#" | 356 | r#" |
357 | const FOO: [usize; 2] = [ | 357 | const FOO: [usize; 2] = [ |
358 | 22, | 358 | 22, |
359 | <|>33, | 359 | $033, |
360 | ]"#, | 360 | ]"#, |
361 | &["33", "33,"], | 361 | &["33", "33,"], |
362 | ); | 362 | ); |
@@ -365,7 +365,7 @@ const FOO: [usize; 2] = [ | |||
365 | r#" | 365 | r#" |
366 | const FOO: [usize; 2] = [ | 366 | const FOO: [usize; 2] = [ |
367 | 22 | 367 | 22 |
368 | , 33<|>, | 368 | , 33$0, |
369 | ]"#, | 369 | ]"#, |
370 | &["33", "33,"], | 370 | &["33", "33,"], |
371 | ); | 371 | ); |
@@ -376,7 +376,7 @@ const FOO: [usize; 2] = [ | |||
376 | do_check( | 376 | do_check( |
377 | r#" | 377 | r#" |
378 | impl S { | 378 | impl S { |
379 | <|> fn foo() { | 379 | $0 fn foo() { |
380 | 380 | ||
381 | } | 381 | } |
382 | }"#, | 382 | }"#, |
@@ -393,7 +393,7 @@ struct A; | |||
393 | /// bla | 393 | /// bla |
394 | /// bla | 394 | /// bla |
395 | struct B { | 395 | struct B { |
396 | <|> | 396 | $0 |
397 | } | 397 | } |
398 | "#, | 398 | "#, |
399 | &["\n \n", "{\n \n}", "/// bla\n/// bla\nstruct B {\n \n}"], | 399 | &["\n \n", "{\n \n}", "/// bla\n/// bla\nstruct B {\n \n}"], |
@@ -407,7 +407,7 @@ struct B { | |||
407 | fn bar(){} | 407 | fn bar(){} |
408 | 408 | ||
409 | // fn foo() { | 409 | // fn foo() { |
410 | // 1 + <|>1 | 410 | // 1 + $01 |
411 | // } | 411 | // } |
412 | 412 | ||
413 | // fn foo(){} | 413 | // fn foo(){} |
@@ -419,7 +419,7 @@ fn bar(){} | |||
419 | r#" | 419 | r#" |
420 | // #[derive(Debug, Clone, Copy, PartialEq, Eq)] | 420 | // #[derive(Debug, Clone, Copy, PartialEq, Eq)] |
421 | // pub enum Direction { | 421 | // pub enum Direction { |
422 | // <|> Next, | 422 | // $0 Next, |
423 | // Prev | 423 | // Prev |
424 | // } | 424 | // } |
425 | "#, | 425 | "#, |
@@ -433,27 +433,27 @@ fn bar(){} | |||
433 | r#" | 433 | r#" |
434 | /* | 434 | /* |
435 | foo | 435 | foo |
436 | _bar1<|>*/ | 436 | _bar1$0*/ |
437 | "#, | 437 | "#, |
438 | &["_bar1", "/*\nfoo\n_bar1*/"], | 438 | &["_bar1", "/*\nfoo\n_bar1*/"], |
439 | ); | 439 | ); |
440 | 440 | ||
441 | do_check(r#"//!<|>foo_2 bar"#, &["foo_2", "//!foo_2 bar"]); | 441 | do_check(r#"//!$0foo_2 bar"#, &["foo_2", "//!foo_2 bar"]); |
442 | 442 | ||
443 | do_check(r#"/<|>/foo bar"#, &["//foo bar"]); | 443 | do_check(r#"/$0/foo bar"#, &["//foo bar"]); |
444 | } | 444 | } |
445 | 445 | ||
446 | #[test] | 446 | #[test] |
447 | fn test_extend_selection_prefer_idents() { | 447 | fn test_extend_selection_prefer_idents() { |
448 | do_check( | 448 | do_check( |
449 | r#" | 449 | r#" |
450 | fn main() { foo<|>+bar;} | 450 | fn main() { foo$0+bar;} |
451 | "#, | 451 | "#, |
452 | &["foo", "foo+bar"], | 452 | &["foo", "foo+bar"], |
453 | ); | 453 | ); |
454 | do_check( | 454 | do_check( |
455 | r#" | 455 | r#" |
456 | fn main() { foo+<|>bar;} | 456 | fn main() { foo+$0bar;} |
457 | "#, | 457 | "#, |
458 | &["bar", "foo+bar"], | 458 | &["bar", "foo+bar"], |
459 | ); | 459 | ); |
@@ -461,18 +461,18 @@ fn main() { foo+<|>bar;} | |||
461 | 461 | ||
462 | #[test] | 462 | #[test] |
463 | fn test_extend_selection_prefer_lifetimes() { | 463 | fn test_extend_selection_prefer_lifetimes() { |
464 | do_check(r#"fn foo<<|>'a>() {}"#, &["'a", "<'a>"]); | 464 | do_check(r#"fn foo<$0'a>() {}"#, &["'a", "<'a>"]); |
465 | do_check(r#"fn foo<'a<|>>() {}"#, &["'a", "<'a>"]); | 465 | do_check(r#"fn foo<'a$0>() {}"#, &["'a", "<'a>"]); |
466 | } | 466 | } |
467 | 467 | ||
468 | #[test] | 468 | #[test] |
469 | fn test_extend_selection_select_first_word() { | 469 | fn test_extend_selection_select_first_word() { |
470 | do_check(r#"// foo bar b<|>az quxx"#, &["baz", "// foo bar baz quxx"]); | 470 | do_check(r#"// foo bar b$0az quxx"#, &["baz", "// foo bar baz quxx"]); |
471 | do_check( | 471 | do_check( |
472 | r#" | 472 | r#" |
473 | impl S { | 473 | impl S { |
474 | fn foo() { | 474 | fn foo() { |
475 | // hel<|>lo world | 475 | // hel$0lo world |
476 | } | 476 | } |
477 | } | 477 | } |
478 | "#, | 478 | "#, |
@@ -486,7 +486,7 @@ fn foo() { | |||
486 | r#" | 486 | r#" |
487 | fn bar(){} | 487 | fn bar(){} |
488 | 488 | ||
489 | " fn f<|>oo() {" | 489 | " fn f$0oo() {" |
490 | "#, | 490 | "#, |
491 | &["foo", "\" fn foo() {\""], | 491 | &["foo", "\" fn foo() {\""], |
492 | ); | 492 | ); |
@@ -499,7 +499,7 @@ fn bar(){} | |||
499 | fn foo<R>() | 499 | fn foo<R>() |
500 | where | 500 | where |
501 | R: req::Request + 'static, | 501 | R: req::Request + 'static, |
502 | R::Params: DeserializeOwned<|> + panic::UnwindSafe + 'static, | 502 | R::Params: DeserializeOwned$0 + panic::UnwindSafe + 'static, |
503 | R::Result: Serialize + 'static, | 503 | R::Result: Serialize + 'static, |
504 | "#, | 504 | "#, |
505 | &[ | 505 | &[ |
@@ -510,26 +510,26 @@ fn foo<R>() | |||
510 | "R::Params: DeserializeOwned + panic::UnwindSafe + 'static,", | 510 | "R::Params: DeserializeOwned + panic::UnwindSafe + 'static,", |
511 | ], | 511 | ], |
512 | ); | 512 | ); |
513 | do_check(r#"fn foo<T>() where T: <|>Copy"#, &["Copy"]); | 513 | do_check(r#"fn foo<T>() where T: $0Copy"#, &["Copy"]); |
514 | do_check(r#"fn foo<T>() where T: <|>Copy + Display"#, &["Copy", "Copy + "]); | 514 | do_check(r#"fn foo<T>() where T: $0Copy + Display"#, &["Copy", "Copy + "]); |
515 | do_check(r#"fn foo<T>() where T: <|>Copy +Display"#, &["Copy", "Copy +"]); | 515 | do_check(r#"fn foo<T>() where T: $0Copy +Display"#, &["Copy", "Copy +"]); |
516 | do_check(r#"fn foo<T>() where T: <|>Copy+Display"#, &["Copy", "Copy+"]); | 516 | do_check(r#"fn foo<T>() where T: $0Copy+Display"#, &["Copy", "Copy+"]); |
517 | do_check(r#"fn foo<T>() where T: Copy + <|>Display"#, &["Display", "+ Display"]); | 517 | do_check(r#"fn foo<T>() where T: Copy + $0Display"#, &["Display", "+ Display"]); |
518 | do_check(r#"fn foo<T>() where T: Copy + <|>Display + Sync"#, &["Display", "Display + "]); | 518 | do_check(r#"fn foo<T>() where T: Copy + $0Display + Sync"#, &["Display", "Display + "]); |
519 | do_check(r#"fn foo<T>() where T: Copy +<|>Display"#, &["Display", "+Display"]); | 519 | do_check(r#"fn foo<T>() where T: Copy +$0Display"#, &["Display", "+Display"]); |
520 | } | 520 | } |
521 | 521 | ||
522 | #[test] | 522 | #[test] |
523 | fn test_extend_trait_bounds_list_inline() { | 523 | fn test_extend_trait_bounds_list_inline() { |
524 | do_check(r#"fn foo<T: <|>Copy>() {}"#, &["Copy"]); | 524 | do_check(r#"fn foo<T: $0Copy>() {}"#, &["Copy"]); |
525 | do_check(r#"fn foo<T: <|>Copy + Display>() {}"#, &["Copy", "Copy + "]); | 525 | do_check(r#"fn foo<T: $0Copy + Display>() {}"#, &["Copy", "Copy + "]); |
526 | do_check(r#"fn foo<T: <|>Copy +Display>() {}"#, &["Copy", "Copy +"]); | 526 | do_check(r#"fn foo<T: $0Copy +Display>() {}"#, &["Copy", "Copy +"]); |
527 | do_check(r#"fn foo<T: <|>Copy+Display>() {}"#, &["Copy", "Copy+"]); | 527 | do_check(r#"fn foo<T: $0Copy+Display>() {}"#, &["Copy", "Copy+"]); |
528 | do_check(r#"fn foo<T: Copy + <|>Display>() {}"#, &["Display", "+ Display"]); | 528 | do_check(r#"fn foo<T: Copy + $0Display>() {}"#, &["Display", "+ Display"]); |
529 | do_check(r#"fn foo<T: Copy + <|>Display + Sync>() {}"#, &["Display", "Display + "]); | 529 | do_check(r#"fn foo<T: Copy + $0Display + Sync>() {}"#, &["Display", "Display + "]); |
530 | do_check(r#"fn foo<T: Copy +<|>Display>() {}"#, &["Display", "+Display"]); | 530 | do_check(r#"fn foo<T: Copy +$0Display>() {}"#, &["Display", "+Display"]); |
531 | do_check( | 531 | do_check( |
532 | r#"fn foo<T: Copy<|> + Display, U: Copy>() {}"#, | 532 | r#"fn foo<T: Copy$0 + Display, U: Copy>() {}"#, |
533 | &[ | 533 | &[ |
534 | "Copy", | 534 | "Copy", |
535 | "Copy + ", | 535 | "Copy + ", |
@@ -544,19 +544,19 @@ fn foo<R>() | |||
544 | #[test] | 544 | #[test] |
545 | fn test_extend_selection_on_tuple_in_type() { | 545 | fn test_extend_selection_on_tuple_in_type() { |
546 | do_check( | 546 | do_check( |
547 | r#"fn main() { let _: (krate, <|>_crate_def_map, module_id) = (); }"#, | 547 | r#"fn main() { let _: (krate, $0_crate_def_map, module_id) = (); }"#, |
548 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], | 548 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], |
549 | ); | 549 | ); |
550 | // white space variations | 550 | // white space variations |
551 | do_check( | 551 | do_check( |
552 | r#"fn main() { let _: (krate,<|>_crate_def_map,module_id) = (); }"#, | 552 | r#"fn main() { let _: (krate,$0_crate_def_map,module_id) = (); }"#, |
553 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], | 553 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], |
554 | ); | 554 | ); |
555 | do_check( | 555 | do_check( |
556 | r#" | 556 | r#" |
557 | fn main() { let _: ( | 557 | fn main() { let _: ( |
558 | krate, | 558 | krate, |
559 | _crate<|>_def_map, | 559 | _crate$0_def_map, |
560 | module_id | 560 | module_id |
561 | ) = (); }"#, | 561 | ) = (); }"#, |
562 | &[ | 562 | &[ |
@@ -570,19 +570,19 @@ fn main() { let _: ( | |||
570 | #[test] | 570 | #[test] |
571 | fn test_extend_selection_on_tuple_in_rvalue() { | 571 | fn test_extend_selection_on_tuple_in_rvalue() { |
572 | do_check( | 572 | do_check( |
573 | r#"fn main() { let var = (krate, _crate_def_map<|>, module_id); }"#, | 573 | r#"fn main() { let var = (krate, _crate_def_map$0, module_id); }"#, |
574 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], | 574 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], |
575 | ); | 575 | ); |
576 | // white space variations | 576 | // white space variations |
577 | do_check( | 577 | do_check( |
578 | r#"fn main() { let var = (krate,_crate<|>_def_map,module_id); }"#, | 578 | r#"fn main() { let var = (krate,_crate$0_def_map,module_id); }"#, |
579 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], | 579 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], |
580 | ); | 580 | ); |
581 | do_check( | 581 | do_check( |
582 | r#" | 582 | r#" |
583 | fn main() { let var = ( | 583 | fn main() { let var = ( |
584 | krate, | 584 | krate, |
585 | _crate_def_map<|>, | 585 | _crate_def_map$0, |
586 | module_id | 586 | module_id |
587 | ); }"#, | 587 | ); }"#, |
588 | &[ | 588 | &[ |
@@ -596,19 +596,19 @@ fn main() { let var = ( | |||
596 | #[test] | 596 | #[test] |
597 | fn test_extend_selection_on_tuple_pat() { | 597 | fn test_extend_selection_on_tuple_pat() { |
598 | do_check( | 598 | do_check( |
599 | r#"fn main() { let (krate, _crate_def_map<|>, module_id) = var; }"#, | 599 | r#"fn main() { let (krate, _crate_def_map$0, module_id) = var; }"#, |
600 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], | 600 | &["_crate_def_map", "_crate_def_map, ", "(krate, _crate_def_map, module_id)"], |
601 | ); | 601 | ); |
602 | // white space variations | 602 | // white space variations |
603 | do_check( | 603 | do_check( |
604 | r#"fn main() { let (krate,_crate<|>_def_map,module_id) = var; }"#, | 604 | r#"fn main() { let (krate,_crate$0_def_map,module_id) = var; }"#, |
605 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], | 605 | &["_crate_def_map", "_crate_def_map,", "(krate,_crate_def_map,module_id)"], |
606 | ); | 606 | ); |
607 | do_check( | 607 | do_check( |
608 | r#" | 608 | r#" |
609 | fn main() { let ( | 609 | fn main() { let ( |
610 | krate, | 610 | krate, |
611 | _crate_def_map<|>, | 611 | _crate_def_map$0, |
612 | module_id | 612 | module_id |
613 | ) = var; }"#, | 613 | ) = var; }"#, |
614 | &[ | 614 | &[ |
@@ -623,7 +623,7 @@ fn main() { let ( | |||
623 | fn extend_selection_inside_macros() { | 623 | fn extend_selection_inside_macros() { |
624 | do_check( | 624 | do_check( |
625 | r#"macro_rules! foo { ($item:item) => {$item} } | 625 | r#"macro_rules! foo { ($item:item) => {$item} } |
626 | foo!{fn hello(na<|>me:usize){}}"#, | 626 | foo!{fn hello(na$0me:usize){}}"#, |
627 | &[ | 627 | &[ |
628 | "name", | 628 | "name", |
629 | "name:usize", | 629 | "name:usize", |
@@ -640,7 +640,7 @@ fn main() { let ( | |||
640 | do_check( | 640 | do_check( |
641 | r#" macro_rules! foo2 { ($item:item) => {$item} } | 641 | r#" macro_rules! foo2 { ($item:item) => {$item} } |
642 | macro_rules! foo { ($item:item) => {foo2!($item);} } | 642 | macro_rules! foo { ($item:item) => {foo2!($item);} } |
643 | foo!{fn hello(na<|>me:usize){}}"#, | 643 | foo!{fn hello(na$0me:usize){}}"#, |
644 | &[ | 644 | &[ |
645 | "name", | 645 | "name", |
646 | "name:usize", | 646 | "name:usize", |
diff --git a/crates/ide/src/fixture.rs b/crates/ide/src/fixture.rs index eb57f9224..cc8218885 100644 --- a/crates/ide/src/fixture.rs +++ b/crates/ide/src/fixture.rs | |||
@@ -20,12 +20,12 @@ pub(crate) fn files(ra_fixture: &str) -> (Analysis, Vec<FileId>) { | |||
20 | (host.analysis(), change_fixture.files) | 20 | (host.analysis(), change_fixture.files) |
21 | } | 21 | } |
22 | 22 | ||
23 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 23 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
24 | pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { | 24 | pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { |
25 | let mut host = AnalysisHost::default(); | 25 | let mut host = AnalysisHost::default(); |
26 | let change_fixture = ChangeFixture::parse(ra_fixture); | 26 | let change_fixture = ChangeFixture::parse(ra_fixture); |
27 | host.db.apply_change(change_fixture.change); | 27 | host.db.apply_change(change_fixture.change); |
28 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 28 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
29 | let offset = match range_or_offset { | 29 | let offset = match range_or_offset { |
30 | RangeOrOffset::Range(_) => panic!(), | 30 | RangeOrOffset::Range(_) => panic!(), |
31 | RangeOrOffset::Offset(it) => it, | 31 | RangeOrOffset::Offset(it) => it, |
@@ -33,12 +33,12 @@ pub(crate) fn position(ra_fixture: &str) -> (Analysis, FilePosition) { | |||
33 | (host.analysis(), FilePosition { file_id, offset }) | 33 | (host.analysis(), FilePosition { file_id, offset }) |
34 | } | 34 | } |
35 | 35 | ||
36 | /// Creates analysis for a single file, returns range marked with a pair of <|>. | 36 | /// Creates analysis for a single file, returns range marked with a pair of $0. |
37 | pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { | 37 | pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { |
38 | let mut host = AnalysisHost::default(); | 38 | let mut host = AnalysisHost::default(); |
39 | let change_fixture = ChangeFixture::parse(ra_fixture); | 39 | let change_fixture = ChangeFixture::parse(ra_fixture); |
40 | host.db.apply_change(change_fixture.change); | 40 | host.db.apply_change(change_fixture.change); |
41 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 41 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
42 | let range = match range_or_offset { | 42 | let range = match range_or_offset { |
43 | RangeOrOffset::Range(it) => it, | 43 | RangeOrOffset::Range(it) => it, |
44 | RangeOrOffset::Offset(_) => panic!(), | 44 | RangeOrOffset::Offset(_) => panic!(), |
@@ -46,12 +46,12 @@ pub(crate) fn range(ra_fixture: &str) -> (Analysis, FileRange) { | |||
46 | (host.analysis(), FileRange { file_id, range }) | 46 | (host.analysis(), FileRange { file_id, range }) |
47 | } | 47 | } |
48 | 48 | ||
49 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 49 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
50 | pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(FileRange, String)>) { | 50 | pub(crate) fn annotations(ra_fixture: &str) -> (Analysis, FilePosition, Vec<(FileRange, String)>) { |
51 | let mut host = AnalysisHost::default(); | 51 | let mut host = AnalysisHost::default(); |
52 | let change_fixture = ChangeFixture::parse(ra_fixture); | 52 | let change_fixture = ChangeFixture::parse(ra_fixture); |
53 | host.db.apply_change(change_fixture.change); | 53 | host.db.apply_change(change_fixture.change); |
54 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 54 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
55 | let offset = match range_or_offset { | 55 | let offset = match range_or_offset { |
56 | RangeOrOffset::Range(_) => panic!(), | 56 | RangeOrOffset::Range(_) => panic!(), |
57 | RangeOrOffset::Offset(it) => it, | 57 | RangeOrOffset::Offset(it) => it, |
diff --git a/crates/ide/src/fn_references.rs b/crates/ide/src/fn_references.rs index 5cbbe306e..f6e5a522b 100644 --- a/crates/ide/src/fn_references.rs +++ b/crates/ide/src/fn_references.rs | |||
@@ -34,7 +34,7 @@ mod tests { | |||
34 | fn test_find_all_methods() { | 34 | fn test_find_all_methods() { |
35 | let (analysis, pos) = fixture::position( | 35 | let (analysis, pos) = fixture::position( |
36 | r#" | 36 | r#" |
37 | fn private_fn() {<|>} | 37 | fn private_fn() {$0} |
38 | 38 | ||
39 | pub fn pub_fn() {} | 39 | pub fn pub_fn() {} |
40 | 40 | ||
@@ -51,7 +51,7 @@ mod tests { | |||
51 | let (analysis, pos) = fixture::position( | 51 | let (analysis, pos) = fixture::position( |
52 | r#" | 52 | r#" |
53 | trait Foo { | 53 | trait Foo { |
54 | fn bar() {<|>} | 54 | fn bar() {$0} |
55 | fn baz() {} | 55 | fn baz() {} |
56 | } | 56 | } |
57 | "#, | 57 | "#, |
@@ -67,7 +67,7 @@ mod tests { | |||
67 | r#" | 67 | r#" |
68 | //- /lib.rs | 68 | //- /lib.rs |
69 | #[test] | 69 | #[test] |
70 | fn foo() {<|>} | 70 | fn foo() {$0} |
71 | 71 | ||
72 | pub fn pub_fn() {} | 72 | pub fn pub_fn() {} |
73 | 73 | ||
diff --git a/crates/ide/src/goto_definition.rs b/crates/ide/src/goto_definition.rs index 912144f8b..95b4cb9e3 100644 --- a/crates/ide/src/goto_definition.rs +++ b/crates/ide/src/goto_definition.rs | |||
@@ -166,7 +166,7 @@ mod tests { | |||
166 | check( | 166 | check( |
167 | r#" | 167 | r#" |
168 | //- /main.rs crate:main deps:std | 168 | //- /main.rs crate:main deps:std |
169 | extern crate std<|>; | 169 | extern crate std$0; |
170 | //- /std/lib.rs crate:std | 170 | //- /std/lib.rs crate:std |
171 | // empty | 171 | // empty |
172 | //^ file | 172 | //^ file |
@@ -179,7 +179,7 @@ mod tests { | |||
179 | check( | 179 | check( |
180 | r#" | 180 | r#" |
181 | //- /main.rs crate:main deps:std | 181 | //- /main.rs crate:main deps:std |
182 | extern crate std as abc<|>; | 182 | extern crate std as abc$0; |
183 | //- /std/lib.rs crate:std | 183 | //- /std/lib.rs crate:std |
184 | // empty | 184 | // empty |
185 | //^ file | 185 | //^ file |
@@ -193,7 +193,7 @@ mod tests { | |||
193 | r#" | 193 | r#" |
194 | struct Foo; | 194 | struct Foo; |
195 | //^^^ | 195 | //^^^ |
196 | enum E { X(Foo<|>) } | 196 | enum E { X(Foo$0) } |
197 | "#, | 197 | "#, |
198 | ); | 198 | ); |
199 | } | 199 | } |
@@ -204,7 +204,7 @@ enum E { X(Foo<|>) } | |||
204 | r#" | 204 | r#" |
205 | struct Foo; | 205 | struct Foo; |
206 | //^^^ | 206 | //^^^ |
207 | enum E { X(<|>Foo) } | 207 | enum E { X($0Foo) } |
208 | "#, | 208 | "#, |
209 | ); | 209 | ); |
210 | } | 210 | } |
@@ -217,7 +217,7 @@ enum E { X(<|>Foo) } | |||
217 | use a::Foo; | 217 | use a::Foo; |
218 | mod a; | 218 | mod a; |
219 | mod b; | 219 | mod b; |
220 | enum E { X(Foo<|>) } | 220 | enum E { X(Foo$0) } |
221 | 221 | ||
222 | //- /a.rs | 222 | //- /a.rs |
223 | struct Foo; | 223 | struct Foo; |
@@ -233,7 +233,7 @@ struct Foo; | |||
233 | check( | 233 | check( |
234 | r#" | 234 | r#" |
235 | //- /lib.rs | 235 | //- /lib.rs |
236 | mod <|>foo; | 236 | mod $0foo; |
237 | 237 | ||
238 | //- /foo.rs | 238 | //- /foo.rs |
239 | // empty | 239 | // empty |
@@ -244,7 +244,7 @@ mod <|>foo; | |||
244 | check( | 244 | check( |
245 | r#" | 245 | r#" |
246 | //- /lib.rs | 246 | //- /lib.rs |
247 | mod <|>foo; | 247 | mod $0foo; |
248 | 248 | ||
249 | //- /foo/mod.rs | 249 | //- /foo/mod.rs |
250 | // empty | 250 | // empty |
@@ -260,7 +260,7 @@ mod <|>foo; | |||
260 | macro_rules! foo { () => { () } } | 260 | macro_rules! foo { () => { () } } |
261 | //^^^ | 261 | //^^^ |
262 | fn bar() { | 262 | fn bar() { |
263 | <|>foo!(); | 263 | $0foo!(); |
264 | } | 264 | } |
265 | "#, | 265 | "#, |
266 | ); | 266 | ); |
@@ -273,7 +273,7 @@ fn bar() { | |||
273 | //- /lib.rs | 273 | //- /lib.rs |
274 | use foo::foo; | 274 | use foo::foo; |
275 | fn bar() { | 275 | fn bar() { |
276 | <|>foo!(); | 276 | $0foo!(); |
277 | } | 277 | } |
278 | 278 | ||
279 | //- /foo/lib.rs | 279 | //- /foo/lib.rs |
@@ -289,7 +289,7 @@ macro_rules! foo { () => { () } } | |||
289 | check( | 289 | check( |
290 | r#" | 290 | r#" |
291 | //- /lib.rs | 291 | //- /lib.rs |
292 | use foo::foo<|>; | 292 | use foo::foo$0; |
293 | 293 | ||
294 | //- /foo/lib.rs | 294 | //- /foo/lib.rs |
295 | #[macro_export] | 295 | #[macro_export] |
@@ -312,7 +312,7 @@ define_fn!(foo); | |||
312 | //^^^ | 312 | //^^^ |
313 | 313 | ||
314 | fn bar() { | 314 | fn bar() { |
315 | <|>foo(); | 315 | $0foo(); |
316 | } | 316 | } |
317 | "#, | 317 | "#, |
318 | ); | 318 | ); |
@@ -331,7 +331,7 @@ macro_rules! define_fn { | |||
331 | //^^^^^^^^^^^^^ | 331 | //^^^^^^^^^^^^^ |
332 | 332 | ||
333 | fn bar() { | 333 | fn bar() { |
334 | <|>foo(); | 334 | $0foo(); |
335 | } | 335 | } |
336 | "#, | 336 | "#, |
337 | ); | 337 | ); |
@@ -347,7 +347,7 @@ macro_rules! foo {() => {0}} | |||
347 | 347 | ||
348 | fn bar() { | 348 | fn bar() { |
349 | match (0,1) { | 349 | match (0,1) { |
350 | (<|>foo!(), _) => {} | 350 | ($0foo!(), _) => {} |
351 | } | 351 | } |
352 | } | 352 | } |
353 | "#, | 353 | "#, |
@@ -363,7 +363,7 @@ macro_rules! foo {() => {0}} | |||
363 | //^^^ | 363 | //^^^ |
364 | fn bar() { | 364 | fn bar() { |
365 | match 0 { | 365 | match 0 { |
366 | <|>foo!() => {} | 366 | $0foo!() => {} |
367 | } | 367 | } |
368 | } | 368 | } |
369 | "#, | 369 | "#, |
@@ -375,7 +375,7 @@ fn bar() { | |||
375 | check( | 375 | check( |
376 | r#" | 376 | r#" |
377 | //- /lib.rs crate:main deps:foo | 377 | //- /lib.rs crate:main deps:foo |
378 | use foo as bar<|>; | 378 | use foo as bar$0; |
379 | 379 | ||
380 | //- /foo/lib.rs crate:foo | 380 | //- /foo/lib.rs crate:foo |
381 | // empty | 381 | // empty |
@@ -389,7 +389,7 @@ use foo as bar<|>; | |||
389 | check( | 389 | check( |
390 | r#" | 390 | r#" |
391 | //- /lib.rs crate:main deps:foo | 391 | //- /lib.rs crate:main deps:foo |
392 | use foo::foo as bar<|>; | 392 | use foo::foo as bar$0; |
393 | 393 | ||
394 | //- /foo/lib.rs crate:foo | 394 | //- /foo/lib.rs crate:foo |
395 | #[macro_export] | 395 | #[macro_export] |
@@ -410,7 +410,7 @@ impl Foo { | |||
410 | } | 410 | } |
411 | 411 | ||
412 | fn bar(foo: &Foo) { | 412 | fn bar(foo: &Foo) { |
413 | foo.frobnicate<|>(); | 413 | foo.frobnicate$0(); |
414 | } | 414 | } |
415 | "#, | 415 | "#, |
416 | ); | 416 | ); |
@@ -425,7 +425,7 @@ struct Foo { | |||
425 | } //^^^^ | 425 | } //^^^^ |
426 | 426 | ||
427 | fn bar(foo: &Foo) { | 427 | fn bar(foo: &Foo) { |
428 | foo.spam<|>; | 428 | foo.spam$0; |
429 | } | 429 | } |
430 | "#, | 430 | "#, |
431 | ); | 431 | ); |
@@ -442,7 +442,7 @@ struct Foo { | |||
442 | 442 | ||
443 | fn bar() -> Foo { | 443 | fn bar() -> Foo { |
444 | Foo { | 444 | Foo { |
445 | spam<|>: 0, | 445 | spam$0: 0, |
446 | } | 446 | } |
447 | } | 447 | } |
448 | "#, | 448 | "#, |
@@ -459,7 +459,7 @@ struct Foo { | |||
459 | } //^^^^ | 459 | } //^^^^ |
460 | 460 | ||
461 | fn bar(foo: Foo) -> Foo { | 461 | fn bar(foo: Foo) -> Foo { |
462 | let Foo { spam<|>: _, } = foo | 462 | let Foo { spam$0: _, } = foo |
463 | } | 463 | } |
464 | "#, | 464 | "#, |
465 | ); | 465 | ); |
@@ -474,7 +474,7 @@ struct Foo { spam: u32 } | |||
474 | //^^^^ | 474 | //^^^^ |
475 | 475 | ||
476 | fn bar() -> Foo { | 476 | fn bar() -> Foo { |
477 | Foo { spam<|>: m!() } | 477 | Foo { spam$0: m!() } |
478 | } | 478 | } |
479 | ", | 479 | ", |
480 | ); | 480 | ); |
@@ -489,7 +489,7 @@ struct Foo(u32); | |||
489 | 489 | ||
490 | fn bar() { | 490 | fn bar() { |
491 | let foo = Foo(0); | 491 | let foo = Foo(0); |
492 | foo.<|>0; | 492 | foo.$00; |
493 | } | 493 | } |
494 | "#, | 494 | "#, |
495 | ); | 495 | ); |
@@ -505,7 +505,7 @@ impl Foo { | |||
505 | } //^^^^^^^^^^ | 505 | } //^^^^^^^^^^ |
506 | 506 | ||
507 | fn bar(foo: &Foo) { | 507 | fn bar(foo: &Foo) { |
508 | Foo::frobnicate<|>(); | 508 | Foo::frobnicate$0(); |
509 | } | 509 | } |
510 | "#, | 510 | "#, |
511 | ); | 511 | ); |
@@ -520,7 +520,7 @@ trait Foo { | |||
520 | } //^^^^^^^^^^ | 520 | } //^^^^^^^^^^ |
521 | 521 | ||
522 | fn bar() { | 522 | fn bar() { |
523 | Foo::frobnicate<|>(); | 523 | Foo::frobnicate$0(); |
524 | } | 524 | } |
525 | "#, | 525 | "#, |
526 | ); | 526 | ); |
@@ -537,7 +537,7 @@ trait Trait { | |||
537 | impl Trait for Foo {} | 537 | impl Trait for Foo {} |
538 | 538 | ||
539 | fn bar() { | 539 | fn bar() { |
540 | Foo::frobnicate<|>(); | 540 | Foo::frobnicate$0(); |
541 | } | 541 | } |
542 | "#, | 542 | "#, |
543 | ); | 543 | ); |
@@ -551,7 +551,7 @@ struct Foo; | |||
551 | impl Foo { | 551 | impl Foo { |
552 | //^^^ | 552 | //^^^ |
553 | pub fn new() -> Self { | 553 | pub fn new() -> Self { |
554 | Self<|> {} | 554 | Self$0 {} |
555 | } | 555 | } |
556 | } | 556 | } |
557 | "#, | 557 | "#, |
@@ -561,7 +561,7 @@ impl Foo { | |||
561 | struct Foo; | 561 | struct Foo; |
562 | impl Foo { | 562 | impl Foo { |
563 | //^^^ | 563 | //^^^ |
564 | pub fn new() -> Self<|> { | 564 | pub fn new() -> Self$0 { |
565 | Self {} | 565 | Self {} |
566 | } | 566 | } |
567 | } | 567 | } |
@@ -573,7 +573,7 @@ impl Foo { | |||
573 | enum Foo { A } | 573 | enum Foo { A } |
574 | impl Foo { | 574 | impl Foo { |
575 | //^^^ | 575 | //^^^ |
576 | pub fn new() -> Self<|> { | 576 | pub fn new() -> Self$0 { |
577 | Foo::A | 577 | Foo::A |
578 | } | 578 | } |
579 | } | 579 | } |
@@ -585,7 +585,7 @@ impl Foo { | |||
585 | enum Foo { A } | 585 | enum Foo { A } |
586 | impl Foo { | 586 | impl Foo { |
587 | //^^^ | 587 | //^^^ |
588 | pub fn thing(a: &Self<|>) { | 588 | pub fn thing(a: &Self$0) { |
589 | } | 589 | } |
590 | } | 590 | } |
591 | "#, | 591 | "#, |
@@ -603,7 +603,7 @@ trait Make { | |||
603 | impl Make for Foo { | 603 | impl Make for Foo { |
604 | //^^^ | 604 | //^^^ |
605 | fn new() -> Self { | 605 | fn new() -> Self { |
606 | Self<|> {} | 606 | Self$0 {} |
607 | } | 607 | } |
608 | } | 608 | } |
609 | "#, | 609 | "#, |
@@ -617,7 +617,7 @@ trait Make { | |||
617 | } | 617 | } |
618 | impl Make for Foo { | 618 | impl Make for Foo { |
619 | //^^^ | 619 | //^^^ |
620 | fn new() -> Self<|> { | 620 | fn new() -> Self$0 { |
621 | Self {} | 621 | Self {} |
622 | } | 622 | } |
623 | } | 623 | } |
@@ -629,7 +629,7 @@ impl Make for Foo { | |||
629 | fn goto_def_when_used_on_definition_name_itself() { | 629 | fn goto_def_when_used_on_definition_name_itself() { |
630 | check( | 630 | check( |
631 | r#" | 631 | r#" |
632 | struct Foo<|> { value: u32 } | 632 | struct Foo$0 { value: u32 } |
633 | //^^^ | 633 | //^^^ |
634 | "#, | 634 | "#, |
635 | ); | 635 | ); |
@@ -637,21 +637,21 @@ struct Foo<|> { value: u32 } | |||
637 | check( | 637 | check( |
638 | r#" | 638 | r#" |
639 | struct Foo { | 639 | struct Foo { |
640 | field<|>: string, | 640 | field$0: string, |
641 | } //^^^^^ | 641 | } //^^^^^ |
642 | "#, | 642 | "#, |
643 | ); | 643 | ); |
644 | 644 | ||
645 | check( | 645 | check( |
646 | r#" | 646 | r#" |
647 | fn foo_test<|>() { } | 647 | fn foo_test$0() { } |
648 | //^^^^^^^^ | 648 | //^^^^^^^^ |
649 | "#, | 649 | "#, |
650 | ); | 650 | ); |
651 | 651 | ||
652 | check( | 652 | check( |
653 | r#" | 653 | r#" |
654 | enum Foo<|> { Variant } | 654 | enum Foo$0 { Variant } |
655 | //^^^ | 655 | //^^^ |
656 | "#, | 656 | "#, |
657 | ); | 657 | ); |
@@ -660,7 +660,7 @@ enum Foo<|> { Variant } | |||
660 | r#" | 660 | r#" |
661 | enum Foo { | 661 | enum Foo { |
662 | Variant1, | 662 | Variant1, |
663 | Variant2<|>, | 663 | Variant2$0, |
664 | //^^^^^^^^ | 664 | //^^^^^^^^ |
665 | Variant3, | 665 | Variant3, |
666 | } | 666 | } |
@@ -669,35 +669,35 @@ enum Foo { | |||
669 | 669 | ||
670 | check( | 670 | check( |
671 | r#" | 671 | r#" |
672 | static INNER<|>: &str = ""; | 672 | static INNER$0: &str = ""; |
673 | //^^^^^ | 673 | //^^^^^ |
674 | "#, | 674 | "#, |
675 | ); | 675 | ); |
676 | 676 | ||
677 | check( | 677 | check( |
678 | r#" | 678 | r#" |
679 | const INNER<|>: &str = ""; | 679 | const INNER$0: &str = ""; |
680 | //^^^^^ | 680 | //^^^^^ |
681 | "#, | 681 | "#, |
682 | ); | 682 | ); |
683 | 683 | ||
684 | check( | 684 | check( |
685 | r#" | 685 | r#" |
686 | type Thing<|> = Option<()>; | 686 | type Thing$0 = Option<()>; |
687 | //^^^^^ | 687 | //^^^^^ |
688 | "#, | 688 | "#, |
689 | ); | 689 | ); |
690 | 690 | ||
691 | check( | 691 | check( |
692 | r#" | 692 | r#" |
693 | trait Foo<|> { } | 693 | trait Foo$0 { } |
694 | //^^^ | 694 | //^^^ |
695 | "#, | 695 | "#, |
696 | ); | 696 | ); |
697 | 697 | ||
698 | check( | 698 | check( |
699 | r#" | 699 | r#" |
700 | mod bar<|> { } | 700 | mod bar$0 { } |
701 | //^^^ | 701 | //^^^ |
702 | "#, | 702 | "#, |
703 | ); | 703 | ); |
@@ -714,7 +714,7 @@ fn foo() {} | |||
714 | //^^^ | 714 | //^^^ |
715 | id! { | 715 | id! { |
716 | fn bar() { | 716 | fn bar() { |
717 | fo<|>o(); | 717 | fo$0o(); |
718 | } | 718 | } |
719 | } | 719 | } |
720 | mod confuse_index { fn foo(); } | 720 | mod confuse_index { fn foo(); } |
@@ -743,7 +743,7 @@ pub mod __export { | |||
743 | fn foo() -> i8 {} | 743 | fn foo() -> i8 {} |
744 | //^^^ | 744 | //^^^ |
745 | fn test() { | 745 | fn test() { |
746 | format!("{}", fo<|>o()) | 746 | format!("{}", fo$0o()) |
747 | } | 747 | } |
748 | "#, | 748 | "#, |
749 | ); | 749 | ); |
@@ -761,7 +761,7 @@ macro_rules! include {} | |||
761 | //^^^^^^^^^^^^^^^^^^^ | 761 | //^^^^^^^^^^^^^^^^^^^ |
762 | 762 | ||
763 | fn f() { | 763 | fn f() { |
764 | foo<|>(); | 764 | foo$0(); |
765 | } | 765 | } |
766 | 766 | ||
767 | mod confuse_index { | 767 | mod confuse_index { |
@@ -778,7 +778,7 @@ fn foo() {} | |||
778 | fn goto_for_type_param() { | 778 | fn goto_for_type_param() { |
779 | check( | 779 | check( |
780 | r#" | 780 | r#" |
781 | struct Foo<T: Clone> { t: <|>T } | 781 | struct Foo<T: Clone> { t: $0T } |
782 | //^ | 782 | //^ |
783 | "#, | 783 | "#, |
784 | ); | 784 | ); |
@@ -796,7 +796,7 @@ fn foo() { | |||
796 | let x = 1; | 796 | let x = 1; |
797 | //^ | 797 | //^ |
798 | id!({ | 798 | id!({ |
799 | let y = <|>x; | 799 | let y = $0x; |
800 | let z = y; | 800 | let z = y; |
801 | }); | 801 | }); |
802 | } | 802 | } |
@@ -814,7 +814,7 @@ fn foo() { | |||
814 | id!({ | 814 | id!({ |
815 | let y = x; | 815 | let y = x; |
816 | //^ | 816 | //^ |
817 | let z = <|>y; | 817 | let z = $0y; |
818 | }); | 818 | }); |
819 | } | 819 | } |
820 | "#, | 820 | "#, |
@@ -829,7 +829,7 @@ fn main() { | |||
829 | fn foo() { | 829 | fn foo() { |
830 | let x = 92; | 830 | let x = 92; |
831 | //^ | 831 | //^ |
832 | <|>x; | 832 | $0x; |
833 | } | 833 | } |
834 | } | 834 | } |
835 | "#, | 835 | "#, |
@@ -843,7 +843,7 @@ fn main() { | |||
843 | fn bar() { | 843 | fn bar() { |
844 | macro_rules! foo { () => { () } } | 844 | macro_rules! foo { () => { () } } |
845 | //^^^ | 845 | //^^^ |
846 | <|>foo!(); | 846 | $0foo!(); |
847 | } | 847 | } |
848 | "#, | 848 | "#, |
849 | ); | 849 | ); |
@@ -857,7 +857,7 @@ struct Foo { x: i32 } | |||
857 | fn main() { | 857 | fn main() { |
858 | let x = 92; | 858 | let x = 92; |
859 | //^ | 859 | //^ |
860 | Foo { x<|> }; | 860 | Foo { x$0 }; |
861 | } | 861 | } |
862 | "#, | 862 | "#, |
863 | ) | 863 | ) |
@@ -872,7 +872,7 @@ enum Foo { | |||
872 | } //^ | 872 | } //^ |
873 | fn baz(foo: Foo) { | 873 | fn baz(foo: Foo) { |
874 | match foo { | 874 | match foo { |
875 | Foo::Bar { x<|> } => x | 875 | Foo::Bar { x$0 } => x |
876 | }; | 876 | }; |
877 | } | 877 | } |
878 | "#, | 878 | "#, |
@@ -887,7 +887,7 @@ enum Foo { Bar } | |||
887 | //^^^ | 887 | //^^^ |
888 | impl Foo { | 888 | impl Foo { |
889 | fn baz(self) { | 889 | fn baz(self) { |
890 | match self { Self::Bar<|> => {} } | 890 | match self { Self::Bar$0 => {} } |
891 | } | 891 | } |
892 | } | 892 | } |
893 | "#, | 893 | "#, |
@@ -902,7 +902,7 @@ enum Foo { Bar { val: i32 } } | |||
902 | //^^^ | 902 | //^^^ |
903 | impl Foo { | 903 | impl Foo { |
904 | fn baz(self) -> i32 { | 904 | fn baz(self) -> i32 { |
905 | match self { Self::Bar<|> { val } => {} } | 905 | match self { Self::Bar$0 { val } => {} } |
906 | } | 906 | } |
907 | } | 907 | } |
908 | "#, | 908 | "#, |
@@ -916,7 +916,7 @@ impl Foo { | |||
916 | enum Foo { Bar } | 916 | enum Foo { Bar } |
917 | //^^^ | 917 | //^^^ |
918 | impl Foo { | 918 | impl Foo { |
919 | fn baz(self) { Self::Bar<|>; } | 919 | fn baz(self) { Self::Bar$0; } |
920 | } | 920 | } |
921 | "#, | 921 | "#, |
922 | ); | 922 | ); |
@@ -929,7 +929,7 @@ impl Foo { | |||
929 | enum Foo { Bar { val: i32 } } | 929 | enum Foo { Bar { val: i32 } } |
930 | //^^^ | 930 | //^^^ |
931 | impl Foo { | 931 | impl Foo { |
932 | fn baz(self) { Self::Bar<|> {val: 4}; } | 932 | fn baz(self) { Self::Bar$0 {val: 4}; } |
933 | } | 933 | } |
934 | "#, | 934 | "#, |
935 | ); | 935 | ); |
@@ -939,7 +939,7 @@ impl Foo { | |||
939 | fn goto_def_for_type_alias_generic_parameter() { | 939 | fn goto_def_for_type_alias_generic_parameter() { |
940 | check( | 940 | check( |
941 | r#" | 941 | r#" |
942 | type Alias<T> = T<|>; | 942 | type Alias<T> = T$0; |
943 | //^ | 943 | //^ |
944 | "#, | 944 | "#, |
945 | ) | 945 | ) |
@@ -950,7 +950,7 @@ type Alias<T> = T<|>; | |||
950 | check( | 950 | check( |
951 | r#" | 951 | r#" |
952 | //- /lib.rs | 952 | //- /lib.rs |
953 | foo::module<|>::mac!(); | 953 | foo::module$0::mac!(); |
954 | 954 | ||
955 | //- /foo/lib.rs | 955 | //- /foo/lib.rs |
956 | pub mod module { | 956 | pub mod module { |
@@ -972,7 +972,7 @@ trait Iterator { | |||
972 | //^^^^ | 972 | //^^^^ |
973 | } | 973 | } |
974 | 974 | ||
975 | fn f() -> impl Iterator<Item<|> = u8> {} | 975 | fn f() -> impl Iterator<Item$0 = u8> {} |
976 | "#, | 976 | "#, |
977 | ); | 977 | ); |
978 | } | 978 | } |
@@ -987,7 +987,7 @@ trait Iterator { | |||
987 | type B; | 987 | type B; |
988 | } | 988 | } |
989 | 989 | ||
990 | fn f() -> impl Iterator<A<|> = u8, B = ()> {} | 990 | fn f() -> impl Iterator<A$0 = u8, B = ()> {} |
991 | "#, | 991 | "#, |
992 | ); | 992 | ); |
993 | check( | 993 | check( |
@@ -998,7 +998,7 @@ trait Iterator { | |||
998 | //^ | 998 | //^ |
999 | } | 999 | } |
1000 | 1000 | ||
1001 | fn f() -> impl Iterator<A = u8, B<|> = ()> {} | 1001 | fn f() -> impl Iterator<A = u8, B$0 = ()> {} |
1002 | "#, | 1002 | "#, |
1003 | ); | 1003 | ); |
1004 | } | 1004 | } |
@@ -1012,7 +1012,7 @@ trait Iterator { | |||
1012 | //^^^^ | 1012 | //^^^^ |
1013 | } | 1013 | } |
1014 | 1014 | ||
1015 | fn g() -> <() as Iterator<Item<|> = ()>>::Item {} | 1015 | fn g() -> <() as Iterator<Item$0 = ()>>::Item {} |
1016 | "#, | 1016 | "#, |
1017 | ); | 1017 | ); |
1018 | } | 1018 | } |
@@ -1027,7 +1027,7 @@ trait Iterator { | |||
1027 | type B; | 1027 | type B; |
1028 | } | 1028 | } |
1029 | 1029 | ||
1030 | fn g() -> <() as Iterator<A<|> = (), B = u8>>::B {} | 1030 | fn g() -> <() as Iterator<A$0 = (), B = u8>>::B {} |
1031 | "#, | 1031 | "#, |
1032 | ); | 1032 | ); |
1033 | check( | 1033 | check( |
@@ -1038,7 +1038,7 @@ trait Iterator { | |||
1038 | //^ | 1038 | //^ |
1039 | } | 1039 | } |
1040 | 1040 | ||
1041 | fn g() -> <() as Iterator<A = (), B<|> = u8>>::A {} | 1041 | fn g() -> <() as Iterator<A = (), B$0 = u8>>::A {} |
1042 | "#, | 1042 | "#, |
1043 | ); | 1043 | ); |
1044 | } | 1044 | } |
@@ -1052,7 +1052,7 @@ struct Foo {} | |||
1052 | impl Foo { | 1052 | impl Foo { |
1053 | fn bar(self: &Foo) { | 1053 | fn bar(self: &Foo) { |
1054 | //^^^^ | 1054 | //^^^^ |
1055 | let foo = sel<|>f; | 1055 | let foo = sel$0f; |
1056 | } | 1056 | } |
1057 | }"#, | 1057 | }"#, |
1058 | ) | 1058 | ) |
@@ -1065,7 +1065,7 @@ impl Foo { | |||
1065 | struct Foo {} | 1065 | struct Foo {} |
1066 | 1066 | ||
1067 | impl Foo { | 1067 | impl Foo { |
1068 | fn bar(&self<|>) { | 1068 | fn bar(&self$0) { |
1069 | //^^^^ | 1069 | //^^^^ |
1070 | } | 1070 | } |
1071 | }"#, | 1071 | }"#, |
@@ -1076,7 +1076,7 @@ impl Foo { | |||
1076 | fn goto_lifetime_param_on_decl() { | 1076 | fn goto_lifetime_param_on_decl() { |
1077 | check( | 1077 | check( |
1078 | r#" | 1078 | r#" |
1079 | fn foo<'foobar<|>>(_: &'foobar ()) { | 1079 | fn foo<'foobar$0>(_: &'foobar ()) { |
1080 | //^^^^^^^ | 1080 | //^^^^^^^ |
1081 | }"#, | 1081 | }"#, |
1082 | ) | 1082 | ) |
@@ -1086,7 +1086,7 @@ fn foo<'foobar<|>>(_: &'foobar ()) { | |||
1086 | fn goto_lifetime_param_decl() { | 1086 | fn goto_lifetime_param_decl() { |
1087 | check( | 1087 | check( |
1088 | r#" | 1088 | r#" |
1089 | fn foo<'foobar>(_: &'foobar<|> ()) { | 1089 | fn foo<'foobar>(_: &'foobar$0 ()) { |
1090 | //^^^^^^^ | 1090 | //^^^^^^^ |
1091 | }"#, | 1091 | }"#, |
1092 | ) | 1092 | ) |
@@ -1097,7 +1097,7 @@ fn foo<'foobar>(_: &'foobar<|> ()) { | |||
1097 | check( | 1097 | check( |
1098 | r#" | 1098 | r#" |
1099 | fn foo<'foobar>(_: &'foobar ()) { | 1099 | fn foo<'foobar>(_: &'foobar ()) { |
1100 | fn foo<'foobar>(_: &'foobar<|> ()) {} | 1100 | fn foo<'foobar>(_: &'foobar$0 ()) {} |
1101 | //^^^^^^^ | 1101 | //^^^^^^^ |
1102 | }"#, | 1102 | }"#, |
1103 | ) | 1103 | ) |
@@ -1108,13 +1108,13 @@ fn foo<'foobar>(_: &'foobar ()) { | |||
1108 | fn goto_lifetime_hrtb() { | 1108 | fn goto_lifetime_hrtb() { |
1109 | check( | 1109 | check( |
1110 | r#"trait Foo<T> {} | 1110 | r#"trait Foo<T> {} |
1111 | fn foo<T>() where for<'a> T: Foo<&'a<|> (u8, u16)>, {} | 1111 | fn foo<T>() where for<'a> T: Foo<&'a$0 (u8, u16)>, {} |
1112 | //^^ | 1112 | //^^ |
1113 | "#, | 1113 | "#, |
1114 | ); | 1114 | ); |
1115 | check( | 1115 | check( |
1116 | r#"trait Foo<T> {} | 1116 | r#"trait Foo<T> {} |
1117 | fn foo<T>() where for<'a<|>> T: Foo<&'a (u8, u16)>, {} | 1117 | fn foo<T>() where for<'a$0> T: Foo<&'a (u8, u16)>, {} |
1118 | //^^ | 1118 | //^^ |
1119 | "#, | 1119 | "#, |
1120 | ); | 1120 | ); |
@@ -1125,7 +1125,7 @@ fn foo<T>() where for<'a<|>> T: Foo<&'a (u8, u16)>, {} | |||
1125 | fn goto_lifetime_hrtb_for_type() { | 1125 | fn goto_lifetime_hrtb_for_type() { |
1126 | check( | 1126 | check( |
1127 | r#"trait Foo<T> {} | 1127 | r#"trait Foo<T> {} |
1128 | fn foo<T>() where T: for<'a> Foo<&'a<|> (u8, u16)>, {} | 1128 | fn foo<T>() where T: for<'a> Foo<&'a$0 (u8, u16)>, {} |
1129 | //^^ | 1129 | //^^ |
1130 | "#, | 1130 | "#, |
1131 | ); | 1131 | ); |
@@ -1139,7 +1139,7 @@ fn foo<'foo>(_: &'foo ()) { | |||
1139 | 'foo: { | 1139 | 'foo: { |
1140 | //^^^^ | 1140 | //^^^^ |
1141 | 'bar: loop { | 1141 | 'bar: loop { |
1142 | break 'foo<|>; | 1142 | break 'foo$0; |
1143 | } | 1143 | } |
1144 | } | 1144 | } |
1145 | }"#, | 1145 | }"#, |
diff --git a/crates/ide/src/goto_implementation.rs b/crates/ide/src/goto_implementation.rs index da9378a97..761a98b2c 100644 --- a/crates/ide/src/goto_implementation.rs +++ b/crates/ide/src/goto_implementation.rs | |||
@@ -107,7 +107,7 @@ mod tests { | |||
107 | fn goto_implementation_works() { | 107 | fn goto_implementation_works() { |
108 | check( | 108 | check( |
109 | r#" | 109 | r#" |
110 | struct Foo<|>; | 110 | struct Foo$0; |
111 | impl Foo {} | 111 | impl Foo {} |
112 | //^^^ | 112 | //^^^ |
113 | "#, | 113 | "#, |
@@ -118,7 +118,7 @@ impl Foo {} | |||
118 | fn goto_implementation_works_multiple_blocks() { | 118 | fn goto_implementation_works_multiple_blocks() { |
119 | check( | 119 | check( |
120 | r#" | 120 | r#" |
121 | struct Foo<|>; | 121 | struct Foo$0; |
122 | impl Foo {} | 122 | impl Foo {} |
123 | //^^^ | 123 | //^^^ |
124 | impl Foo {} | 124 | impl Foo {} |
@@ -131,7 +131,7 @@ impl Foo {} | |||
131 | fn goto_implementation_works_multiple_mods() { | 131 | fn goto_implementation_works_multiple_mods() { |
132 | check( | 132 | check( |
133 | r#" | 133 | r#" |
134 | struct Foo<|>; | 134 | struct Foo$0; |
135 | mod a { | 135 | mod a { |
136 | impl super::Foo {} | 136 | impl super::Foo {} |
137 | //^^^^^^^^^^ | 137 | //^^^^^^^^^^ |
@@ -149,7 +149,7 @@ mod b { | |||
149 | check( | 149 | check( |
150 | r#" | 150 | r#" |
151 | //- /lib.rs | 151 | //- /lib.rs |
152 | struct Foo<|>; | 152 | struct Foo$0; |
153 | mod a; | 153 | mod a; |
154 | mod b; | 154 | mod b; |
155 | //- /a.rs | 155 | //- /a.rs |
@@ -166,7 +166,7 @@ impl crate::Foo {} | |||
166 | fn goto_implementation_for_trait() { | 166 | fn goto_implementation_for_trait() { |
167 | check( | 167 | check( |
168 | r#" | 168 | r#" |
169 | trait T<|> {} | 169 | trait T$0 {} |
170 | struct Foo; | 170 | struct Foo; |
171 | impl T for Foo {} | 171 | impl T for Foo {} |
172 | //^^^ | 172 | //^^^ |
@@ -179,7 +179,7 @@ impl T for Foo {} | |||
179 | check( | 179 | check( |
180 | r#" | 180 | r#" |
181 | //- /lib.rs | 181 | //- /lib.rs |
182 | trait T<|> {}; | 182 | trait T$0 {}; |
183 | struct Foo; | 183 | struct Foo; |
184 | mod a; | 184 | mod a; |
185 | mod b; | 185 | mod b; |
@@ -199,7 +199,7 @@ impl crate::T for crate::Foo {} | |||
199 | r#" | 199 | r#" |
200 | //- /lib.rs | 200 | //- /lib.rs |
201 | trait T {} | 201 | trait T {} |
202 | struct Foo<|>; | 202 | struct Foo$0; |
203 | impl Foo {} | 203 | impl Foo {} |
204 | //^^^ | 204 | //^^^ |
205 | impl T for Foo {} | 205 | impl T for Foo {} |
@@ -216,7 +216,7 @@ impl T for &Foo {} | |||
216 | r#" | 216 | r#" |
217 | #[derive(Copy)] | 217 | #[derive(Copy)] |
218 | //^^^^^^^^^^^^^^^ | 218 | //^^^^^^^^^^^^^^^ |
219 | struct Foo<|>; | 219 | struct Foo$0; |
220 | 220 | ||
221 | mod marker { | 221 | mod marker { |
222 | trait Copy {} | 222 | trait Copy {} |
diff --git a/crates/ide/src/goto_type_definition.rs b/crates/ide/src/goto_type_definition.rs index 7e84e06be..369a59820 100644 --- a/crates/ide/src/goto_type_definition.rs +++ b/crates/ide/src/goto_type_definition.rs | |||
@@ -76,7 +76,7 @@ mod tests { | |||
76 | struct Foo; | 76 | struct Foo; |
77 | //^^^ | 77 | //^^^ |
78 | fn foo() { | 78 | fn foo() { |
79 | let f: Foo; f<|> | 79 | let f: Foo; f$0 |
80 | } | 80 | } |
81 | "#, | 81 | "#, |
82 | ); | 82 | ); |
@@ -89,7 +89,7 @@ fn foo() { | |||
89 | struct Foo; | 89 | struct Foo; |
90 | //^^^ | 90 | //^^^ |
91 | fn foo() { | 91 | fn foo() { |
92 | let f: &Foo; f<|> | 92 | let f: &Foo; f$0 |
93 | } | 93 | } |
94 | "#, | 94 | "#, |
95 | ); | 95 | ); |
@@ -103,7 +103,7 @@ macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | |||
103 | struct Foo {} | 103 | struct Foo {} |
104 | //^^^ | 104 | //^^^ |
105 | id! { | 105 | id! { |
106 | fn bar() { let f<|> = Foo {}; } | 106 | fn bar() { let f$0 = Foo {}; } |
107 | } | 107 | } |
108 | "#, | 108 | "#, |
109 | ); | 109 | ); |
@@ -115,7 +115,7 @@ id! { | |||
115 | r#" | 115 | r#" |
116 | struct Foo; | 116 | struct Foo; |
117 | //^^^ | 117 | //^^^ |
118 | fn foo(<|>f: Foo) {} | 118 | fn foo($0f: Foo) {} |
119 | "#, | 119 | "#, |
120 | ); | 120 | ); |
121 | } | 121 | } |
@@ -129,7 +129,7 @@ struct Foo; | |||
129 | struct Bar(Foo); | 129 | struct Bar(Foo); |
130 | fn foo() { | 130 | fn foo() { |
131 | let bar = Bar(Foo); | 131 | let bar = Bar(Foo); |
132 | bar.<|>0; | 132 | bar.$00; |
133 | } | 133 | } |
134 | "#, | 134 | "#, |
135 | ); | 135 | ); |
@@ -142,7 +142,7 @@ fn foo() { | |||
142 | struct Foo; | 142 | struct Foo; |
143 | //^^^ | 143 | //^^^ |
144 | impl Foo { | 144 | impl Foo { |
145 | fn f(&self<|>) {} | 145 | fn f(&self$0) {} |
146 | } | 146 | } |
147 | "#, | 147 | "#, |
148 | ) | 148 | ) |
diff --git a/crates/ide/src/hover.rs b/crates/ide/src/hover.rs index a12a2475e..8cb4a51d8 100644 --- a/crates/ide/src/hover.rs +++ b/crates/ide/src/hover.rs | |||
@@ -457,7 +457,7 @@ mod tests { | |||
457 | pub fn foo() -> u32 { 1 } | 457 | pub fn foo() -> u32 { 1 } |
458 | 458 | ||
459 | fn main() { | 459 | fn main() { |
460 | let foo_test = foo()<|>; | 460 | let foo_test = foo()$0; |
461 | } | 461 | } |
462 | "#, | 462 | "#, |
463 | expect![[r#" | 463 | expect![[r#" |
@@ -476,7 +476,7 @@ fn main() { | |||
476 | pub fn foo() -> u32 { 1 } | 476 | pub fn foo() -> u32 { 1 } |
477 | 477 | ||
478 | fn main() { | 478 | fn main() { |
479 | let foo_test = foo()<|>; | 479 | let foo_test = foo()$0; |
480 | } | 480 | } |
481 | "#, | 481 | "#, |
482 | expect![[r#" | 482 | expect![[r#" |
@@ -506,7 +506,7 @@ fn main() { | |||
506 | Option::Some(*memo + value) | 506 | Option::Some(*memo + value) |
507 | }; | 507 | }; |
508 | let number = 5u32; | 508 | let number = 5u32; |
509 | let mut iter<|> = scan(OtherStruct { i: num }, closure, number); | 509 | let mut iter$0 = scan(OtherStruct { i: num }, closure, number); |
510 | } | 510 | } |
511 | "#, | 511 | "#, |
512 | expect![[r#" | 512 | expect![[r#" |
@@ -526,7 +526,7 @@ fn main() { | |||
526 | r#" | 526 | r#" |
527 | pub fn foo() -> u32 { 1 } | 527 | pub fn foo() -> u32 { 1 } |
528 | 528 | ||
529 | fn main() { let foo_test = fo<|>o(); } | 529 | fn main() { let foo_test = fo$0o(); } |
530 | "#, | 530 | "#, |
531 | expect![[r#" | 531 | expect![[r#" |
532 | *foo* | 532 | *foo* |
@@ -558,7 +558,7 @@ mod a; | |||
558 | mod b; | 558 | mod b; |
559 | mod c; | 559 | mod c; |
560 | 560 | ||
561 | fn main() { let foo_test = fo<|>o(); } | 561 | fn main() { let foo_test = fo$0o(); } |
562 | "#, | 562 | "#, |
563 | expect![[r#" | 563 | expect![[r#" |
564 | *foo* | 564 | *foo* |
@@ -575,7 +575,7 @@ fn main() { let foo_test = fo<|>o(); } | |||
575 | r#" | 575 | r#" |
576 | pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } | 576 | pub fn foo<'a, T: AsRef<str>>(b: &'a T) -> &'a str { } |
577 | 577 | ||
578 | fn main() { let foo_test = fo<|>o(); } | 578 | fn main() { let foo_test = fo$0o(); } |
579 | "#, | 579 | "#, |
580 | expect![[r#" | 580 | expect![[r#" |
581 | *foo* | 581 | *foo* |
@@ -595,7 +595,7 @@ fn main() { let foo_test = fo<|>o(); } | |||
595 | fn hover_shows_fn_signature_on_fn_name() { | 595 | fn hover_shows_fn_signature_on_fn_name() { |
596 | check( | 596 | check( |
597 | r#" | 597 | r#" |
598 | pub fn foo<|>(a: u32, b: u32) -> u32 {} | 598 | pub fn foo$0(a: u32, b: u32) -> u32 {} |
599 | 599 | ||
600 | fn main() { } | 600 | fn main() { } |
601 | "#, | 601 | "#, |
@@ -623,7 +623,7 @@ fn main() { } | |||
623 | /// # | 623 | /// # |
624 | /// foo(Path::new("hello, world!")) | 624 | /// foo(Path::new("hello, world!")) |
625 | /// ``` | 625 | /// ``` |
626 | pub fn foo<|>(_: &Path) {} | 626 | pub fn foo$0(_: &Path) {} |
627 | 627 | ||
628 | fn main() { } | 628 | fn main() { } |
629 | "#, | 629 | "#, |
@@ -656,7 +656,7 @@ fn main() { } | |||
656 | check( | 656 | check( |
657 | r##" | 657 | r##" |
658 | #[doc = r#"Raw string doc attr"#] | 658 | #[doc = r#"Raw string doc attr"#] |
659 | pub fn foo<|>(_: &Path) {} | 659 | pub fn foo$0(_: &Path) {} |
660 | 660 | ||
661 | fn main() { } | 661 | fn main() { } |
662 | "##, | 662 | "##, |
@@ -686,7 +686,7 @@ fn main() { } | |||
686 | struct Foo { field_a: u32 } | 686 | struct Foo { field_a: u32 } |
687 | 687 | ||
688 | fn main() { | 688 | fn main() { |
689 | let foo = Foo { field_a<|>: 0, }; | 689 | let foo = Foo { field_a$0: 0, }; |
690 | } | 690 | } |
691 | "#, | 691 | "#, |
692 | expect![[r#" | 692 | expect![[r#" |
@@ -705,7 +705,7 @@ fn main() { | |||
705 | // Hovering over the field in the definition | 705 | // Hovering over the field in the definition |
706 | check( | 706 | check( |
707 | r#" | 707 | r#" |
708 | struct Foo { field_a<|>: u32 } | 708 | struct Foo { field_a$0: u32 } |
709 | 709 | ||
710 | fn main() { | 710 | fn main() { |
711 | let foo = Foo { field_a: 0 }; | 711 | let foo = Foo { field_a: 0 }; |
@@ -728,7 +728,7 @@ fn main() { | |||
728 | #[test] | 728 | #[test] |
729 | fn hover_const_static() { | 729 | fn hover_const_static() { |
730 | check( | 730 | check( |
731 | r#"const foo<|>: u32 = 123;"#, | 731 | r#"const foo$0: u32 = 123;"#, |
732 | expect![[r#" | 732 | expect![[r#" |
733 | *foo* | 733 | *foo* |
734 | 734 | ||
@@ -742,7 +742,7 @@ fn main() { | |||
742 | "#]], | 742 | "#]], |
743 | ); | 743 | ); |
744 | check( | 744 | check( |
745 | r#"static foo<|>: u32 = 456;"#, | 745 | r#"static foo$0: u32 = 456;"#, |
746 | expect![[r#" | 746 | expect![[r#" |
747 | *foo* | 747 | *foo* |
748 | 748 | ||
@@ -764,7 +764,7 @@ fn main() { | |||
764 | struct Test<K, T = u8> { k: K, t: T } | 764 | struct Test<K, T = u8> { k: K, t: T } |
765 | 765 | ||
766 | fn main() { | 766 | fn main() { |
767 | let zz<|> = Test { t: 23u8, k: 33 }; | 767 | let zz$0 = Test { t: 23u8, k: 33 }; |
768 | }"#, | 768 | }"#, |
769 | expect![[r#" | 769 | expect![[r#" |
770 | *zz* | 770 | *zz* |
@@ -783,7 +783,7 @@ fn main() { | |||
783 | enum Option<T> { Some(T) } | 783 | enum Option<T> { Some(T) } |
784 | use Option::Some; | 784 | use Option::Some; |
785 | 785 | ||
786 | fn main() { So<|>me(12); } | 786 | fn main() { So$0me(12); } |
787 | "#, | 787 | "#, |
788 | expect![[r#" | 788 | expect![[r#" |
789 | *Some* | 789 | *Some* |
@@ -803,7 +803,7 @@ fn main() { So<|>me(12); } | |||
803 | enum Option<T> { Some(T) } | 803 | enum Option<T> { Some(T) } |
804 | use Option::Some; | 804 | use Option::Some; |
805 | 805 | ||
806 | fn main() { let b<|>ar = Some(12); } | 806 | fn main() { let b$0ar = Some(12); } |
807 | "#, | 807 | "#, |
808 | expect![[r#" | 808 | expect![[r#" |
809 | *bar* | 809 | *bar* |
@@ -821,7 +821,7 @@ fn main() { let b<|>ar = Some(12); } | |||
821 | r#" | 821 | r#" |
822 | enum Option<T> { | 822 | enum Option<T> { |
823 | /// The None variant | 823 | /// The None variant |
824 | Non<|>e | 824 | Non$0e |
825 | } | 825 | } |
826 | "#, | 826 | "#, |
827 | expect![[r#" | 827 | expect![[r#" |
@@ -848,7 +848,7 @@ enum Option<T> { | |||
848 | Some(T) | 848 | Some(T) |
849 | } | 849 | } |
850 | fn main() { | 850 | fn main() { |
851 | let s = Option::Som<|>e(12); | 851 | let s = Option::Som$0e(12); |
852 | } | 852 | } |
853 | "#, | 853 | "#, |
854 | expect![[r#" | 854 | expect![[r#" |
@@ -872,7 +872,7 @@ fn main() { | |||
872 | #[test] | 872 | #[test] |
873 | fn hover_for_local_variable() { | 873 | fn hover_for_local_variable() { |
874 | check( | 874 | check( |
875 | r#"fn func(foo: i32) { fo<|>o; }"#, | 875 | r#"fn func(foo: i32) { fo$0o; }"#, |
876 | expect![[r#" | 876 | expect![[r#" |
877 | *foo* | 877 | *foo* |
878 | 878 | ||
@@ -886,7 +886,7 @@ fn main() { | |||
886 | #[test] | 886 | #[test] |
887 | fn hover_for_local_variable_pat() { | 887 | fn hover_for_local_variable_pat() { |
888 | check( | 888 | check( |
889 | r#"fn func(fo<|>o: i32) {}"#, | 889 | r#"fn func(fo$0o: i32) {}"#, |
890 | expect![[r#" | 890 | expect![[r#" |
891 | *foo* | 891 | *foo* |
892 | 892 | ||
@@ -900,7 +900,7 @@ fn main() { | |||
900 | #[test] | 900 | #[test] |
901 | fn hover_local_var_edge() { | 901 | fn hover_local_var_edge() { |
902 | check( | 902 | check( |
903 | r#"fn func(foo: i32) { if true { <|>foo; }; }"#, | 903 | r#"fn func(foo: i32) { if true { $0foo; }; }"#, |
904 | expect![[r#" | 904 | expect![[r#" |
905 | *foo* | 905 | *foo* |
906 | 906 | ||
@@ -914,7 +914,7 @@ fn main() { | |||
914 | #[test] | 914 | #[test] |
915 | fn hover_for_param_edge() { | 915 | fn hover_for_param_edge() { |
916 | check( | 916 | check( |
917 | r#"fn func(<|>foo: i32) {}"#, | 917 | r#"fn func($0foo: i32) {}"#, |
918 | expect![[r#" | 918 | expect![[r#" |
919 | *foo* | 919 | *foo* |
920 | 920 | ||
@@ -934,7 +934,7 @@ fn main() { | |||
934 | trait DerefMut { | 934 | trait DerefMut { |
935 | type Target: ?Sized; | 935 | type Target: ?Sized; |
936 | } | 936 | } |
937 | fn f(_x<|>: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#, | 937 | fn f(_x$0: impl Deref<Target=u8> + DerefMut<Target=u8>) {}"#, |
938 | expect![[r#" | 938 | expect![[r#" |
939 | *_x* | 939 | *_x* |
940 | 940 | ||
@@ -955,7 +955,7 @@ impl Thing { | |||
955 | fn new() -> Thing { Thing { x: 0 } } | 955 | fn new() -> Thing { Thing { x: 0 } } |
956 | } | 956 | } |
957 | 957 | ||
958 | fn main() { let foo_<|>test = Thing::new(); } | 958 | fn main() { let foo_$0test = Thing::new(); } |
959 | "#, | 959 | "#, |
960 | expect![[r#" | 960 | expect![[r#" |
961 | *foo_test* | 961 | *foo_test* |
@@ -979,7 +979,7 @@ mod wrapper { | |||
979 | } | 979 | } |
980 | } | 980 | } |
981 | 981 | ||
982 | fn main() { let foo_test = wrapper::Thing::new<|>(); } | 982 | fn main() { let foo_test = wrapper::Thing::new$0(); } |
983 | "#, | 983 | "#, |
984 | expect![[r#" | 984 | expect![[r#" |
985 | *new* | 985 | *new* |
@@ -1006,7 +1006,7 @@ impl X { | |||
1006 | 1006 | ||
1007 | fn main() { | 1007 | fn main() { |
1008 | match 1 { | 1008 | match 1 { |
1009 | X::C<|> => {}, | 1009 | X::C$0 => {}, |
1010 | 2 => {}, | 1010 | 2 => {}, |
1011 | _ => {} | 1011 | _ => {} |
1012 | }; | 1012 | }; |
@@ -1032,7 +1032,7 @@ fn main() { | |||
1032 | r#" | 1032 | r#" |
1033 | struct Thing { x: u32 } | 1033 | struct Thing { x: u32 } |
1034 | impl Thing { | 1034 | impl Thing { |
1035 | fn new() -> Self { Self<|> { x: 0 } } | 1035 | fn new() -> Self { Self$0 { x: 0 } } |
1036 | } | 1036 | } |
1037 | "#, | 1037 | "#, |
1038 | expect![[r#" | 1038 | expect![[r#" |
@@ -1051,7 +1051,7 @@ impl Thing { | |||
1051 | r#" | 1051 | r#" |
1052 | struct Thing { x: u32 } | 1052 | struct Thing { x: u32 } |
1053 | impl Thing { | 1053 | impl Thing { |
1054 | fn new() -> Self<|> { Self { x: 0 } } | 1054 | fn new() -> Self$0 { Self { x: 0 } } |
1055 | } | 1055 | } |
1056 | "#, | 1056 | "#, |
1057 | expect![[r#" | 1057 | expect![[r#" |
@@ -1070,7 +1070,7 @@ impl Thing { | |||
1070 | r#" | 1070 | r#" |
1071 | enum Thing { A } | 1071 | enum Thing { A } |
1072 | impl Thing { | 1072 | impl Thing { |
1073 | pub fn new() -> Self<|> { Thing::A } | 1073 | pub fn new() -> Self$0 { Thing::A } |
1074 | } | 1074 | } |
1075 | "#, | 1075 | "#, |
1076 | expect![[r#" | 1076 | expect![[r#" |
@@ -1089,7 +1089,7 @@ impl Thing { | |||
1089 | r#" | 1089 | r#" |
1090 | enum Thing { A } | 1090 | enum Thing { A } |
1091 | impl Thing { | 1091 | impl Thing { |
1092 | pub fn thing(a: Self<|>) {} | 1092 | pub fn thing(a: Self$0) {} |
1093 | } | 1093 | } |
1094 | "#, | 1094 | "#, |
1095 | expect![[r#" | 1095 | expect![[r#" |
@@ -1114,7 +1114,7 @@ fn x() {} | |||
1114 | 1114 | ||
1115 | fn y() { | 1115 | fn y() { |
1116 | let x = 0i32; | 1116 | let x = 0i32; |
1117 | x<|>; | 1117 | x$0; |
1118 | } | 1118 | } |
1119 | "#, | 1119 | "#, |
1120 | expect![[r#" | 1120 | expect![[r#" |
@@ -1133,7 +1133,7 @@ fn y() { | |||
1133 | r#" | 1133 | r#" |
1134 | macro_rules! foo { () => {} } | 1134 | macro_rules! foo { () => {} } |
1135 | 1135 | ||
1136 | fn f() { fo<|>o!(); } | 1136 | fn f() { fo$0o!(); } |
1137 | "#, | 1137 | "#, |
1138 | expect![[r#" | 1138 | expect![[r#" |
1139 | *foo* | 1139 | *foo* |
@@ -1152,7 +1152,7 @@ fn f() { fo<|>o!(); } | |||
1152 | #[test] | 1152 | #[test] |
1153 | fn test_hover_tuple_field() { | 1153 | fn test_hover_tuple_field() { |
1154 | check( | 1154 | check( |
1155 | r#"struct TS(String, i32<|>);"#, | 1155 | r#"struct TS(String, i32$0);"#, |
1156 | expect![[r#" | 1156 | expect![[r#" |
1157 | *i32* | 1157 | *i32* |
1158 | 1158 | ||
@@ -1170,7 +1170,7 @@ fn f() { fo<|>o!(); } | |||
1170 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | 1170 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } |
1171 | fn foo() {} | 1171 | fn foo() {} |
1172 | id! { | 1172 | id! { |
1173 | fn bar() { fo<|>o(); } | 1173 | fn bar() { fo$0o(); } |
1174 | } | 1174 | } |
1175 | "#, | 1175 | "#, |
1176 | expect![[r#" | 1176 | expect![[r#" |
@@ -1192,7 +1192,7 @@ id! { | |||
1192 | check( | 1192 | check( |
1193 | r#" | 1193 | r#" |
1194 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | 1194 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } |
1195 | fn foo(bar:u32) { let a = id!(ba<|>r); } | 1195 | fn foo(bar:u32) { let a = id!(ba$0r); } |
1196 | "#, | 1196 | "#, |
1197 | expect![[r#" | 1197 | expect![[r#" |
1198 | *bar* | 1198 | *bar* |
@@ -1210,7 +1210,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); } | |||
1210 | r#" | 1210 | r#" |
1211 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } | 1211 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } |
1212 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } | 1212 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } |
1213 | fn foo(bar:u32) { let a = id!(ba<|>r); } | 1213 | fn foo(bar:u32) { let a = id!(ba$0r); } |
1214 | "#, | 1214 | "#, |
1215 | expect![[r#" | 1215 | expect![[r#" |
1216 | *bar* | 1216 | *bar* |
@@ -1229,7 +1229,7 @@ fn foo(bar:u32) { let a = id!(ba<|>r); } | |||
1229 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } | 1229 | macro_rules! id_deep { ($($tt:tt)*) => { $($tt)* } } |
1230 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } | 1230 | macro_rules! id { ($($tt:tt)*) => { id_deep!($($tt)*) } } |
1231 | fn bar() -> u32 { 0 } | 1231 | fn bar() -> u32 { 0 } |
1232 | fn foo() { let a = id!([0u32, bar(<|>)] ); } | 1232 | fn foo() { let a = id!([0u32, bar($0)] ); } |
1233 | "#, | 1233 | "#, |
1234 | expect![[r#" | 1234 | expect![[r#" |
1235 | *bar()* | 1235 | *bar()* |
@@ -1247,7 +1247,7 @@ fn foo() { let a = id!([0u32, bar(<|>)] ); } | |||
1247 | macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } | 1247 | macro_rules! arr { ($($tt:tt)*) => { [$($tt)*)] } } |
1248 | fn foo() { | 1248 | fn foo() { |
1249 | let mastered_for_itunes = ""; | 1249 | let mastered_for_itunes = ""; |
1250 | let _ = arr!("Tr<|>acks", &mastered_for_itunes); | 1250 | let _ = arr!("Tr$0acks", &mastered_for_itunes); |
1251 | } | 1251 | } |
1252 | "#, | 1252 | "#, |
1253 | expect![[r#" | 1253 | expect![[r#" |
@@ -1268,7 +1268,7 @@ macro_rules! assert {} | |||
1268 | 1268 | ||
1269 | fn bar() -> bool { true } | 1269 | fn bar() -> bool { true } |
1270 | fn foo() { | 1270 | fn foo() { |
1271 | assert!(ba<|>r()); | 1271 | assert!(ba$0r()); |
1272 | } | 1272 | } |
1273 | "#, | 1273 | "#, |
1274 | expect![[r#" | 1274 | expect![[r#" |
@@ -1293,7 +1293,7 @@ fn foo() { | |||
1293 | macro_rules! format {} | 1293 | macro_rules! format {} |
1294 | 1294 | ||
1295 | fn foo() { | 1295 | fn foo() { |
1296 | format!("hel<|>lo {}", 0); | 1296 | format!("hel$0lo {}", 0); |
1297 | } | 1297 | } |
1298 | "#, | 1298 | "#, |
1299 | ); | 1299 | ); |
@@ -1306,7 +1306,7 @@ fn foo() { | |||
1306 | /// <- `\u{3000}` here | 1306 | /// <- `\u{3000}` here |
1307 | fn foo() { } | 1307 | fn foo() { } |
1308 | 1308 | ||
1309 | fn bar() { fo<|>o(); } | 1309 | fn bar() { fo$0o(); } |
1310 | ", | 1310 | ", |
1311 | expect![[r#" | 1311 | expect![[r#" |
1312 | *foo* | 1312 | *foo* |
@@ -1329,7 +1329,7 @@ fn bar() { fo<|>o(); } | |||
1329 | #[test] | 1329 | #[test] |
1330 | fn test_hover_function_show_qualifiers() { | 1330 | fn test_hover_function_show_qualifiers() { |
1331 | check( | 1331 | check( |
1332 | r#"async fn foo<|>() {}"#, | 1332 | r#"async fn foo$0() {}"#, |
1333 | expect![[r#" | 1333 | expect![[r#" |
1334 | *foo* | 1334 | *foo* |
1335 | 1335 | ||
@@ -1343,7 +1343,7 @@ fn bar() { fo<|>o(); } | |||
1343 | "#]], | 1343 | "#]], |
1344 | ); | 1344 | ); |
1345 | check( | 1345 | check( |
1346 | r#"pub const unsafe fn foo<|>() {}"#, | 1346 | r#"pub const unsafe fn foo$0() {}"#, |
1347 | expect![[r#" | 1347 | expect![[r#" |
1348 | *foo* | 1348 | *foo* |
1349 | 1349 | ||
@@ -1357,7 +1357,7 @@ fn bar() { fo<|>o(); } | |||
1357 | "#]], | 1357 | "#]], |
1358 | ); | 1358 | ); |
1359 | check( | 1359 | check( |
1360 | r#"pub(crate) async unsafe extern "C" fn foo<|>() {}"#, | 1360 | r#"pub(crate) async unsafe extern "C" fn foo$0() {}"#, |
1361 | expect![[r#" | 1361 | expect![[r#" |
1362 | *foo* | 1362 | *foo* |
1363 | 1363 | ||
@@ -1375,7 +1375,7 @@ fn bar() { fo<|>o(); } | |||
1375 | #[test] | 1375 | #[test] |
1376 | fn test_hover_trait_show_qualifiers() { | 1376 | fn test_hover_trait_show_qualifiers() { |
1377 | check_actions( | 1377 | check_actions( |
1378 | r"unsafe trait foo<|>() {}", | 1378 | r"unsafe trait foo$0() {}", |
1379 | expect![[r#" | 1379 | expect![[r#" |
1380 | [ | 1380 | [ |
1381 | Implementation( | 1381 | Implementation( |
@@ -1396,7 +1396,7 @@ fn bar() { fo<|>o(); } | |||
1396 | check( | 1396 | check( |
1397 | r#" | 1397 | r#" |
1398 | //- /main.rs crate:main deps:std | 1398 | //- /main.rs crate:main deps:std |
1399 | extern crate st<|>d; | 1399 | extern crate st$0d; |
1400 | //- /std/lib.rs crate:std | 1400 | //- /std/lib.rs crate:std |
1401 | //! Standard library for this test | 1401 | //! Standard library for this test |
1402 | //! | 1402 | //! |
@@ -1414,7 +1414,7 @@ extern crate st<|>d; | |||
1414 | check( | 1414 | check( |
1415 | r#" | 1415 | r#" |
1416 | //- /main.rs crate:main deps:std | 1416 | //- /main.rs crate:main deps:std |
1417 | extern crate std as ab<|>c; | 1417 | extern crate std as ab$0c; |
1418 | //- /std/lib.rs crate:std | 1418 | //- /std/lib.rs crate:std |
1419 | //! Standard library for this test | 1419 | //! Standard library for this test |
1420 | //! | 1420 | //! |
@@ -1435,7 +1435,7 @@ extern crate std as ab<|>c; | |||
1435 | fn test_hover_mod_with_same_name_as_function() { | 1435 | fn test_hover_mod_with_same_name_as_function() { |
1436 | check( | 1436 | check( |
1437 | r#" | 1437 | r#" |
1438 | use self::m<|>y::Bar; | 1438 | use self::m$0y::Bar; |
1439 | mod my { pub struct Bar; } | 1439 | mod my { pub struct Bar; } |
1440 | 1440 | ||
1441 | fn my() {} | 1441 | fn my() {} |
@@ -1461,7 +1461,7 @@ fn my() {} | |||
1461 | /// bar docs | 1461 | /// bar docs |
1462 | struct Bar; | 1462 | struct Bar; |
1463 | 1463 | ||
1464 | fn foo() { let bar = Ba<|>r; } | 1464 | fn foo() { let bar = Ba$0r; } |
1465 | "#, | 1465 | "#, |
1466 | expect![[r#" | 1466 | expect![[r#" |
1467 | *Bar* | 1467 | *Bar* |
@@ -1488,7 +1488,7 @@ fn foo() { let bar = Ba<|>r; } | |||
1488 | #[doc = "bar docs"] | 1488 | #[doc = "bar docs"] |
1489 | struct Bar; | 1489 | struct Bar; |
1490 | 1490 | ||
1491 | fn foo() { let bar = Ba<|>r; } | 1491 | fn foo() { let bar = Ba$0r; } |
1492 | "#, | 1492 | "#, |
1493 | expect![[r#" | 1493 | expect![[r#" |
1494 | *Bar* | 1494 | *Bar* |
@@ -1517,7 +1517,7 @@ fn foo() { let bar = Ba<|>r; } | |||
1517 | #[doc = "bar docs 2"] | 1517 | #[doc = "bar docs 2"] |
1518 | struct Bar; | 1518 | struct Bar; |
1519 | 1519 | ||
1520 | fn foo() { let bar = Ba<|>r; } | 1520 | fn foo() { let bar = Ba$0r; } |
1521 | "#, | 1521 | "#, |
1522 | expect![[r#" | 1522 | expect![[r#" |
1523 | *Bar* | 1523 | *Bar* |
@@ -1545,7 +1545,7 @@ fn foo() { let bar = Ba<|>r; } | |||
1545 | r#" | 1545 | r#" |
1546 | pub struct Foo; | 1546 | pub struct Foo; |
1547 | /// [Foo](struct.Foo.html) | 1547 | /// [Foo](struct.Foo.html) |
1548 | pub struct B<|>ar | 1548 | pub struct B$0ar |
1549 | "#, | 1549 | "#, |
1550 | expect![[r#" | 1550 | expect![[r#" |
1551 | *Bar* | 1551 | *Bar* |
@@ -1571,7 +1571,7 @@ pub struct B<|>ar | |||
1571 | r#" | 1571 | r#" |
1572 | pub struct Foo; | 1572 | pub struct Foo; |
1573 | /// [struct Foo](struct.Foo.html) | 1573 | /// [struct Foo](struct.Foo.html) |
1574 | pub struct B<|>ar | 1574 | pub struct B$0ar |
1575 | "#, | 1575 | "#, |
1576 | expect![[r#" | 1576 | expect![[r#" |
1577 | *Bar* | 1577 | *Bar* |
@@ -1599,7 +1599,7 @@ pub struct B<|>ar | |||
1599 | pub struct Foo; | 1599 | pub struct Foo; |
1600 | pub struct Bar { | 1600 | pub struct Bar { |
1601 | /// [Foo](struct.Foo.html) | 1601 | /// [Foo](struct.Foo.html) |
1602 | fie<|>ld: () | 1602 | fie$0ld: () |
1603 | } | 1603 | } |
1604 | "#, | 1604 | "#, |
1605 | expect![[r#" | 1605 | expect![[r#" |
@@ -1628,7 +1628,7 @@ pub mod foo { | |||
1628 | pub struct Foo; | 1628 | pub struct Foo; |
1629 | } | 1629 | } |
1630 | /// [Foo](foo::Foo) | 1630 | /// [Foo](foo::Foo) |
1631 | pub struct B<|>ar | 1631 | pub struct B$0ar |
1632 | "#, | 1632 | "#, |
1633 | expect![[r#" | 1633 | expect![[r#" |
1634 | *Bar* | 1634 | *Bar* |
@@ -1658,7 +1658,7 @@ pub mod foo { | |||
1658 | pub struct Foo; | 1658 | pub struct Foo; |
1659 | } | 1659 | } |
1660 | /// [Foo](foo::Foo) | 1660 | /// [Foo](foo::Foo) |
1661 | pub struct B<|>ar | 1661 | pub struct B$0ar |
1662 | "#, | 1662 | "#, |
1663 | expect![[r#" | 1663 | expect![[r#" |
1664 | *Bar* | 1664 | *Bar* |
@@ -1684,7 +1684,7 @@ pub struct B<|>ar | |||
1684 | r#" | 1684 | r#" |
1685 | pub struct Foo; | 1685 | pub struct Foo; |
1686 | /// [Foo] | 1686 | /// [Foo] |
1687 | pub struct B<|>ar | 1687 | pub struct B$0ar |
1688 | "#, | 1688 | "#, |
1689 | expect![[r#" | 1689 | expect![[r#" |
1690 | *Bar* | 1690 | *Bar* |
@@ -1710,7 +1710,7 @@ pub struct B<|>ar | |||
1710 | r#" | 1710 | r#" |
1711 | pub struct Foo; | 1711 | pub struct Foo; |
1712 | /// [`Foo`] | 1712 | /// [`Foo`] |
1713 | pub struct B<|>ar | 1713 | pub struct B$0ar |
1714 | "#, | 1714 | "#, |
1715 | expect![[r#" | 1715 | expect![[r#" |
1716 | *Bar* | 1716 | *Bar* |
@@ -1737,7 +1737,7 @@ pub struct B<|>ar | |||
1737 | pub struct Foo; | 1737 | pub struct Foo; |
1738 | fn Foo() {} | 1738 | fn Foo() {} |
1739 | /// [Foo()] | 1739 | /// [Foo()] |
1740 | pub struct B<|>ar | 1740 | pub struct B$0ar |
1741 | "#, | 1741 | "#, |
1742 | expect![[r#" | 1742 | expect![[r#" |
1743 | *Bar* | 1743 | *Bar* |
@@ -1763,7 +1763,7 @@ pub struct B<|>ar | |||
1763 | r#" | 1763 | r#" |
1764 | pub struct Foo; | 1764 | pub struct Foo; |
1765 | /// [`struct Foo`] | 1765 | /// [`struct Foo`] |
1766 | pub struct B<|>ar | 1766 | pub struct B$0ar |
1767 | "#, | 1767 | "#, |
1768 | expect![[r#" | 1768 | expect![[r#" |
1769 | *Bar* | 1769 | *Bar* |
@@ -1789,7 +1789,7 @@ pub struct B<|>ar | |||
1789 | r#" | 1789 | r#" |
1790 | pub struct Foo; | 1790 | pub struct Foo; |
1791 | /// [`struct@Foo`] | 1791 | /// [`struct@Foo`] |
1792 | pub struct B<|>ar | 1792 | pub struct B$0ar |
1793 | "#, | 1793 | "#, |
1794 | expect![[r#" | 1794 | expect![[r#" |
1795 | *Bar* | 1795 | *Bar* |
@@ -1817,7 +1817,7 @@ pub struct Foo; | |||
1817 | /// [my Foo][foo] | 1817 | /// [my Foo][foo] |
1818 | /// | 1818 | /// |
1819 | /// [foo]: Foo | 1819 | /// [foo]: Foo |
1820 | pub struct B<|>ar | 1820 | pub struct B$0ar |
1821 | "#, | 1821 | "#, |
1822 | expect![[r#" | 1822 | expect![[r#" |
1823 | *Bar* | 1823 | *Bar* |
@@ -1843,7 +1843,7 @@ pub struct B<|>ar | |||
1843 | r#" | 1843 | r#" |
1844 | pub struct Foo; | 1844 | pub struct Foo; |
1845 | /// [external](https://www.google.com) | 1845 | /// [external](https://www.google.com) |
1846 | pub struct B<|>ar | 1846 | pub struct B$0ar |
1847 | "#, | 1847 | "#, |
1848 | expect![[r#" | 1848 | expect![[r#" |
1849 | *Bar* | 1849 | *Bar* |
@@ -1870,7 +1870,7 @@ pub struct B<|>ar | |||
1870 | r#" | 1870 | r#" |
1871 | pub struct Foo; | 1871 | pub struct Foo; |
1872 | /// [baz](Baz) | 1872 | /// [baz](Baz) |
1873 | pub struct B<|>ar | 1873 | pub struct B$0ar |
1874 | "#, | 1874 | "#, |
1875 | expect![[r#" | 1875 | expect![[r#" |
1876 | *Bar* | 1876 | *Bar* |
@@ -1896,7 +1896,7 @@ pub struct B<|>ar | |||
1896 | r#" | 1896 | r#" |
1897 | enum E { | 1897 | enum E { |
1898 | /// [E] | 1898 | /// [E] |
1899 | V<|> { field: i32 } | 1899 | V$0 { field: i32 } |
1900 | } | 1900 | } |
1901 | "#, | 1901 | "#, |
1902 | expect![[r#" | 1902 | expect![[r#" |
@@ -1923,7 +1923,7 @@ enum E { | |||
1923 | r#" | 1923 | r#" |
1924 | struct S { | 1924 | struct S { |
1925 | /// [`S`] | 1925 | /// [`S`] |
1926 | field<|>: i32 | 1926 | field$0: i32 |
1927 | } | 1927 | } |
1928 | "#, | 1928 | "#, |
1929 | expect![[r#" | 1929 | expect![[r#" |
@@ -1969,7 +1969,7 @@ struct S { | |||
1969 | /// | 1969 | /// |
1970 | /// [`Result`]: ../../std/result/enum.Result.html | 1970 | /// [`Result`]: ../../std/result/enum.Result.html |
1971 | /// [^example]: https://www.example.com/ | 1971 | /// [^example]: https://www.example.com/ |
1972 | pub fn fo<|>o() {} | 1972 | pub fn fo$0o() {} |
1973 | "#, | 1973 | "#, |
1974 | expect![[r#" | 1974 | expect![[r#" |
1975 | *foo* | 1975 | *foo* |
@@ -2026,7 +2026,7 @@ macro_rules! bar { | |||
2026 | 2026 | ||
2027 | bar!(); | 2027 | bar!(); |
2028 | 2028 | ||
2029 | fn foo() { let bar = Bar; bar.fo<|>o(); } | 2029 | fn foo() { let bar = Bar; bar.fo$0o(); } |
2030 | "#, | 2030 | "#, |
2031 | expect![[r#" | 2031 | expect![[r#" |
2032 | *foo* | 2032 | *foo* |
@@ -2064,7 +2064,7 @@ macro_rules! bar { | |||
2064 | 2064 | ||
2065 | bar!(); | 2065 | bar!(); |
2066 | 2066 | ||
2067 | fn foo() { let bar = Bar; bar.fo<|>o(); } | 2067 | fn foo() { let bar = Bar; bar.fo$0o(); } |
2068 | "#, | 2068 | "#, |
2069 | expect![[r#" | 2069 | expect![[r#" |
2070 | *foo* | 2070 | *foo* |
@@ -2087,7 +2087,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2087 | #[test] | 2087 | #[test] |
2088 | fn test_hover_trait_has_impl_action() { | 2088 | fn test_hover_trait_has_impl_action() { |
2089 | check_actions( | 2089 | check_actions( |
2090 | r#"trait foo<|>() {}"#, | 2090 | r#"trait foo$0() {}"#, |
2091 | expect![[r#" | 2091 | expect![[r#" |
2092 | [ | 2092 | [ |
2093 | Implementation( | 2093 | Implementation( |
@@ -2106,7 +2106,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2106 | #[test] | 2106 | #[test] |
2107 | fn test_hover_struct_has_impl_action() { | 2107 | fn test_hover_struct_has_impl_action() { |
2108 | check_actions( | 2108 | check_actions( |
2109 | r"struct foo<|>() {}", | 2109 | r"struct foo$0() {}", |
2110 | expect![[r#" | 2110 | expect![[r#" |
2111 | [ | 2111 | [ |
2112 | Implementation( | 2112 | Implementation( |
@@ -2125,7 +2125,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2125 | #[test] | 2125 | #[test] |
2126 | fn test_hover_union_has_impl_action() { | 2126 | fn test_hover_union_has_impl_action() { |
2127 | check_actions( | 2127 | check_actions( |
2128 | r#"union foo<|>() {}"#, | 2128 | r#"union foo$0() {}"#, |
2129 | expect![[r#" | 2129 | expect![[r#" |
2130 | [ | 2130 | [ |
2131 | Implementation( | 2131 | Implementation( |
@@ -2144,7 +2144,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2144 | #[test] | 2144 | #[test] |
2145 | fn test_hover_enum_has_impl_action() { | 2145 | fn test_hover_enum_has_impl_action() { |
2146 | check_actions( | 2146 | check_actions( |
2147 | r"enum foo<|>() { A, B }", | 2147 | r"enum foo$0() { A, B }", |
2148 | expect![[r#" | 2148 | expect![[r#" |
2149 | [ | 2149 | [ |
2150 | Implementation( | 2150 | Implementation( |
@@ -2163,7 +2163,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2163 | #[test] | 2163 | #[test] |
2164 | fn test_hover_self_has_impl_action() { | 2164 | fn test_hover_self_has_impl_action() { |
2165 | check_actions( | 2165 | check_actions( |
2166 | r#"struct foo where Self<|>:;"#, | 2166 | r#"struct foo where Self$0:;"#, |
2167 | expect![[r#" | 2167 | expect![[r#" |
2168 | [ | 2168 | [ |
2169 | Implementation( | 2169 | Implementation( |
@@ -2184,7 +2184,7 @@ fn foo() { let bar = Bar; bar.fo<|>o(); } | |||
2184 | check_actions( | 2184 | check_actions( |
2185 | r#" | 2185 | r#" |
2186 | #[test] | 2186 | #[test] |
2187 | fn foo_<|>test() {} | 2187 | fn foo_$0test() {} |
2188 | "#, | 2188 | "#, |
2189 | expect![[r#" | 2189 | expect![[r#" |
2190 | [ | 2190 | [ |
@@ -2219,7 +2219,7 @@ fn foo_<|>test() {} | |||
2219 | fn test_hover_test_mod_has_action() { | 2219 | fn test_hover_test_mod_has_action() { |
2220 | check_actions( | 2220 | check_actions( |
2221 | r#" | 2221 | r#" |
2222 | mod tests<|> { | 2222 | mod tests$0 { |
2223 | #[test] | 2223 | #[test] |
2224 | fn foo_test() {} | 2224 | fn foo_test() {} |
2225 | } | 2225 | } |
@@ -2254,7 +2254,7 @@ mod tests<|> { | |||
2254 | r#" | 2254 | r#" |
2255 | struct S{ f1: u32 } | 2255 | struct S{ f1: u32 } |
2256 | 2256 | ||
2257 | fn main() { let s<|>t = S{ f1:0 }; } | 2257 | fn main() { let s$0t = S{ f1:0 }; } |
2258 | "#, | 2258 | "#, |
2259 | expect![[r#" | 2259 | expect![[r#" |
2260 | [ | 2260 | [ |
@@ -2287,7 +2287,7 @@ fn main() { let s<|>t = S{ f1:0 }; } | |||
2287 | struct Arg(u32); | 2287 | struct Arg(u32); |
2288 | struct S<T>{ f1: T } | 2288 | struct S<T>{ f1: T } |
2289 | 2289 | ||
2290 | fn main() { let s<|>t = S{ f1:Arg(0) }; } | 2290 | fn main() { let s$0t = S{ f1:Arg(0) }; } |
2291 | "#, | 2291 | "#, |
2292 | expect![[r#" | 2292 | expect![[r#" |
2293 | [ | 2293 | [ |
@@ -2333,7 +2333,7 @@ fn main() { let s<|>t = S{ f1:Arg(0) }; } | |||
2333 | struct Arg(u32); | 2333 | struct Arg(u32); |
2334 | struct S<T>{ f1: T } | 2334 | struct S<T>{ f1: T } |
2335 | 2335 | ||
2336 | fn main() { let s<|>t = S{ f1: S{ f1: Arg(0) } }; } | 2336 | fn main() { let s$0t = S{ f1: S{ f1: Arg(0) } }; } |
2337 | "#, | 2337 | "#, |
2338 | expect![[r#" | 2338 | expect![[r#" |
2339 | [ | 2339 | [ |
@@ -2382,7 +2382,7 @@ mod M { | |||
2382 | pub struct C(u32); | 2382 | pub struct C(u32); |
2383 | } | 2383 | } |
2384 | 2384 | ||
2385 | fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | 2385 | fn main() { let s$0t = (A(1), B(2), M::C(3) ); } |
2386 | "#, | 2386 | "#, |
2387 | expect![[r#" | 2387 | expect![[r#" |
2388 | [ | 2388 | [ |
@@ -2441,7 +2441,7 @@ fn main() { let s<|>t = (A(1), B(2), M::C(3) ); } | |||
2441 | trait Foo {} | 2441 | trait Foo {} |
2442 | fn foo() -> impl Foo {} | 2442 | fn foo() -> impl Foo {} |
2443 | 2443 | ||
2444 | fn main() { let s<|>t = foo(); } | 2444 | fn main() { let s$0t = foo(); } |
2445 | "#, | 2445 | "#, |
2446 | expect![[r#" | 2446 | expect![[r#" |
2447 | [ | 2447 | [ |
@@ -2475,7 +2475,7 @@ trait Foo<T> {} | |||
2475 | struct S; | 2475 | struct S; |
2476 | fn foo() -> impl Foo<S> {} | 2476 | fn foo() -> impl Foo<S> {} |
2477 | 2477 | ||
2478 | fn main() { let s<|>t = foo(); } | 2478 | fn main() { let s$0t = foo(); } |
2479 | "#, | 2479 | "#, |
2480 | expect![[r#" | 2480 | expect![[r#" |
2481 | [ | 2481 | [ |
@@ -2522,7 +2522,7 @@ trait Foo {} | |||
2522 | trait Bar {} | 2522 | trait Bar {} |
2523 | fn foo() -> impl Foo + Bar {} | 2523 | fn foo() -> impl Foo + Bar {} |
2524 | 2524 | ||
2525 | fn main() { let s<|>t = foo(); } | 2525 | fn main() { let s$0t = foo(); } |
2526 | "#, | 2526 | "#, |
2527 | expect![[r#" | 2527 | expect![[r#" |
2528 | [ | 2528 | [ |
@@ -2572,7 +2572,7 @@ struct S2 {} | |||
2572 | 2572 | ||
2573 | fn foo() -> impl Foo<S1> + Bar<S2> {} | 2573 | fn foo() -> impl Foo<S1> + Bar<S2> {} |
2574 | 2574 | ||
2575 | fn main() { let s<|>t = foo(); } | 2575 | fn main() { let s$0t = foo(); } |
2576 | "#, | 2576 | "#, |
2577 | expect![[r#" | 2577 | expect![[r#" |
2578 | [ | 2578 | [ |
@@ -2642,7 +2642,7 @@ fn main() { let s<|>t = foo(); } | |||
2642 | check_actions( | 2642 | check_actions( |
2643 | r#" | 2643 | r#" |
2644 | trait Foo {} | 2644 | trait Foo {} |
2645 | fn foo(ar<|>g: &impl Foo) {} | 2645 | fn foo(ar$0g: &impl Foo) {} |
2646 | "#, | 2646 | "#, |
2647 | expect![[r#" | 2647 | expect![[r#" |
2648 | [ | 2648 | [ |
@@ -2676,7 +2676,7 @@ trait Foo {} | |||
2676 | trait Bar<T> {} | 2676 | trait Bar<T> {} |
2677 | struct S{} | 2677 | struct S{} |
2678 | 2678 | ||
2679 | fn foo(ar<|>g: &impl Foo + Bar<S>) {} | 2679 | fn foo(ar$0g: &impl Foo + Bar<S>) {} |
2680 | "#, | 2680 | "#, |
2681 | expect![[r#" | 2681 | expect![[r#" |
2682 | [ | 2682 | [ |
@@ -2734,7 +2734,7 @@ fn foo(ar<|>g: &impl Foo + Bar<S>) {} | |||
2734 | r#" | 2734 | r#" |
2735 | struct S; | 2735 | struct S; |
2736 | fn foo() { | 2736 | fn foo() { |
2737 | let fo<|>o = async { S }; | 2737 | let fo$0o = async { S }; |
2738 | } | 2738 | } |
2739 | 2739 | ||
2740 | #[prelude_import] use future::*; | 2740 | #[prelude_import] use future::*; |
@@ -2786,7 +2786,7 @@ mod future { | |||
2786 | r#" | 2786 | r#" |
2787 | trait Foo<T> {} | 2787 | trait Foo<T> {} |
2788 | struct S {} | 2788 | struct S {} |
2789 | fn foo(ar<|>g: &impl Foo<S>) {} | 2789 | fn foo(ar$0g: &impl Foo<S>) {} |
2790 | "#, | 2790 | "#, |
2791 | expect![[r#" | 2791 | expect![[r#" |
2792 | [ | 2792 | [ |
@@ -2836,7 +2836,7 @@ impl Foo for S {} | |||
2836 | struct B<T>{} | 2836 | struct B<T>{} |
2837 | fn foo() -> B<dyn Foo> {} | 2837 | fn foo() -> B<dyn Foo> {} |
2838 | 2838 | ||
2839 | fn main() { let s<|>t = foo(); } | 2839 | fn main() { let s$0t = foo(); } |
2840 | "#, | 2840 | "#, |
2841 | expect![[r#" | 2841 | expect![[r#" |
2842 | [ | 2842 | [ |
@@ -2880,7 +2880,7 @@ fn main() { let s<|>t = foo(); } | |||
2880 | check_actions( | 2880 | check_actions( |
2881 | r#" | 2881 | r#" |
2882 | trait Foo {} | 2882 | trait Foo {} |
2883 | fn foo(ar<|>g: &dyn Foo) {} | 2883 | fn foo(ar$0g: &dyn Foo) {} |
2884 | "#, | 2884 | "#, |
2885 | expect![[r#" | 2885 | expect![[r#" |
2886 | [ | 2886 | [ |
@@ -2912,7 +2912,7 @@ fn foo(ar<|>g: &dyn Foo) {} | |||
2912 | r#" | 2912 | r#" |
2913 | trait Foo<T> {} | 2913 | trait Foo<T> {} |
2914 | struct S {} | 2914 | struct S {} |
2915 | fn foo(ar<|>g: &dyn Foo<S>) {} | 2915 | fn foo(ar$0g: &dyn Foo<S>) {} |
2916 | "#, | 2916 | "#, |
2917 | expect![[r#" | 2917 | expect![[r#" |
2918 | [ | 2918 | [ |
@@ -2960,7 +2960,7 @@ trait DynTrait<T> {} | |||
2960 | struct B<T> {} | 2960 | struct B<T> {} |
2961 | struct S {} | 2961 | struct S {} |
2962 | 2962 | ||
2963 | fn foo(a<|>rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} | 2963 | fn foo(a$0rg: &impl ImplTrait<B<dyn DynTrait<B<S>>>>) {} |
2964 | "#, | 2964 | "#, |
2965 | expect![[r#" | 2965 | expect![[r#" |
2966 | [ | 2966 | [ |
@@ -3041,7 +3041,7 @@ impl Foo for S { type Item = Bar; } | |||
3041 | 3041 | ||
3042 | fn test() -> impl Foo { S {} } | 3042 | fn test() -> impl Foo { S {} } |
3043 | 3043 | ||
3044 | fn main() { let s<|>t = test().get(); } | 3044 | fn main() { let s$0t = test().get(); } |
3045 | "#, | 3045 | "#, |
3046 | expect![[r#" | 3046 | expect![[r#" |
3047 | [ | 3047 | [ |
@@ -3074,7 +3074,7 @@ fn main() { let s<|>t = test().get(); } | |||
3074 | struct Bar; | 3074 | struct Bar; |
3075 | struct Foo<const BAR: Bar>; | 3075 | struct Foo<const BAR: Bar>; |
3076 | 3076 | ||
3077 | impl<const BAR: Bar> Foo<BAR<|>> {} | 3077 | impl<const BAR: Bar> Foo<BAR$0> {} |
3078 | "#, | 3078 | "#, |
3079 | expect![[r#" | 3079 | expect![[r#" |
3080 | [ | 3080 | [ |
@@ -3106,7 +3106,7 @@ impl<const BAR: Bar> Foo<BAR<|>> {} | |||
3106 | r#" | 3106 | r#" |
3107 | trait Foo {} | 3107 | trait Foo {} |
3108 | 3108 | ||
3109 | fn foo<T: Foo>(t: T<|>){} | 3109 | fn foo<T: Foo>(t: T$0){} |
3110 | "#, | 3110 | "#, |
3111 | expect![[r#" | 3111 | expect![[r#" |
3112 | [ | 3112 | [ |
@@ -3146,7 +3146,7 @@ pub mod wrapper { | |||
3146 | } | 3146 | } |
3147 | 3147 | ||
3148 | //- /main.rs crate:main deps:name-with-dashes | 3148 | //- /main.rs crate:main deps:name-with-dashes |
3149 | fn main() { let foo_test = name_with_dashes::wrapper::Thing::new<|>(); } | 3149 | fn main() { let foo_test = name_with_dashes::wrapper::Thing::new$0(); } |
3150 | "#, | 3150 | "#, |
3151 | expect![[r#" | 3151 | expect![[r#" |
3152 | *new* | 3152 | *new* |
@@ -3172,7 +3172,7 @@ struct S { | |||
3172 | 3172 | ||
3173 | fn main() { | 3173 | fn main() { |
3174 | let s = S { f: 0 }; | 3174 | let s = S { f: 0 }; |
3175 | let S { f<|> } = &s; | 3175 | let S { f$0 } = &s; |
3176 | } | 3176 | } |
3177 | "#, | 3177 | "#, |
3178 | expect![[r#" | 3178 | expect![[r#" |
@@ -3191,7 +3191,7 @@ fn main() { | |||
3191 | r#" | 3191 | r#" |
3192 | struct Foo {} | 3192 | struct Foo {} |
3193 | impl Foo { | 3193 | impl Foo { |
3194 | fn bar(&sel<|>f) {} | 3194 | fn bar(&sel$0f) {} |
3195 | } | 3195 | } |
3196 | "#, | 3196 | "#, |
3197 | expect![[r#" | 3197 | expect![[r#" |
@@ -3210,7 +3210,7 @@ impl Foo { | |||
3210 | struct Arc<T>(T); | 3210 | struct Arc<T>(T); |
3211 | struct Foo {} | 3211 | struct Foo {} |
3212 | impl Foo { | 3212 | impl Foo { |
3213 | fn bar(sel<|>f: Arc<Foo>) {} | 3213 | fn bar(sel$0f: Arc<Foo>) {} |
3214 | } | 3214 | } |
3215 | "#, | 3215 | "#, |
3216 | expect![[r#" | 3216 | expect![[r#" |
@@ -3227,7 +3227,7 @@ impl Foo { | |||
3227 | check( | 3227 | check( |
3228 | r#" | 3228 | r#" |
3229 | /// Be quick; | 3229 | /// Be quick; |
3230 | mod Foo<|> { | 3230 | mod Foo$0 { |
3231 | //! time is mana | 3231 | //! time is mana |
3232 | 3232 | ||
3233 | /// This comment belongs to the function | 3233 | /// This comment belongs to the function |
@@ -3258,7 +3258,7 @@ mod Foo<|> { | |||
3258 | check( | 3258 | check( |
3259 | r#" | 3259 | r#" |
3260 | #[doc = "Be quick;"] | 3260 | #[doc = "Be quick;"] |
3261 | mod Foo<|> { | 3261 | mod Foo$0 { |
3262 | #![doc = "time is mana"] | 3262 | #![doc = "time is mana"] |
3263 | 3263 | ||
3264 | #[doc = "This comment belongs to the function"] | 3264 | #[doc = "This comment belongs to the function"] |
@@ -3289,7 +3289,7 @@ mod Foo<|> { | |||
3289 | check_hover_no_result( | 3289 | check_hover_no_result( |
3290 | r#" | 3290 | r#" |
3291 | fn no_hover() { | 3291 | fn no_hover() { |
3292 | // no<|>hover | 3292 | // no$0hover |
3293 | } | 3293 | } |
3294 | "#, | 3294 | "#, |
3295 | ); | 3295 | ); |
@@ -3300,7 +3300,7 @@ fn no_hover() { | |||
3300 | check( | 3300 | check( |
3301 | r#" | 3301 | r#" |
3302 | fn foo() { | 3302 | fn foo() { |
3303 | 'label<|>: loop {} | 3303 | 'label$0: loop {} |
3304 | } | 3304 | } |
3305 | "#, | 3305 | "#, |
3306 | expect![[r#" | 3306 | expect![[r#" |
@@ -3316,7 +3316,7 @@ fn foo() { | |||
3316 | #[test] | 3316 | #[test] |
3317 | fn hover_lifetime() { | 3317 | fn hover_lifetime() { |
3318 | check( | 3318 | check( |
3319 | r#"fn foo<'lifetime>(_: &'lifetime<|> ()) {}"#, | 3319 | r#"fn foo<'lifetime>(_: &'lifetime$0 ()) {}"#, |
3320 | expect![[r#" | 3320 | expect![[r#" |
3321 | *'lifetime* | 3321 | *'lifetime* |
3322 | 3322 | ||
@@ -3335,7 +3335,7 @@ struct Foo<T>(T); | |||
3335 | trait Copy {} | 3335 | trait Copy {} |
3336 | trait Clone {} | 3336 | trait Clone {} |
3337 | trait Sized {} | 3337 | trait Sized {} |
3338 | impl<T: Copy + Clone> Foo<T<|>> where T: Sized {} | 3338 | impl<T: Copy + Clone> Foo<T$0> where T: Sized {} |
3339 | "#, | 3339 | "#, |
3340 | expect![[r#" | 3340 | expect![[r#" |
3341 | *T* | 3341 | *T* |
@@ -3348,7 +3348,7 @@ impl<T: Copy + Clone> Foo<T<|>> where T: Sized {} | |||
3348 | check( | 3348 | check( |
3349 | r#" | 3349 | r#" |
3350 | struct Foo<T>(T); | 3350 | struct Foo<T>(T); |
3351 | impl<T> Foo<T<|>> {} | 3351 | impl<T> Foo<T$0> {} |
3352 | "#, | 3352 | "#, |
3353 | expect![[r#" | 3353 | expect![[r#" |
3354 | *T* | 3354 | *T* |
@@ -3362,7 +3362,7 @@ impl<T> Foo<T<|>> {} | |||
3362 | check( | 3362 | check( |
3363 | r#" | 3363 | r#" |
3364 | struct Foo<T>(T); | 3364 | struct Foo<T>(T); |
3365 | impl<T: 'static> Foo<T<|>> {} | 3365 | impl<T: 'static> Foo<T$0> {} |
3366 | "#, | 3366 | "#, |
3367 | expect![[r#" | 3367 | expect![[r#" |
3368 | *T* | 3368 | *T* |
@@ -3379,7 +3379,7 @@ impl<T: 'static> Foo<T<|>> {} | |||
3379 | check( | 3379 | check( |
3380 | r#" | 3380 | r#" |
3381 | struct Foo<const LEN: usize>; | 3381 | struct Foo<const LEN: usize>; |
3382 | impl<const LEN: usize> Foo<LEN<|>> {} | 3382 | impl<const LEN: usize> Foo<LEN$0> {} |
3383 | "#, | 3383 | "#, |
3384 | expect![[r#" | 3384 | expect![[r#" |
3385 | *LEN* | 3385 | *LEN* |
diff --git a/crates/ide/src/join_lines.rs b/crates/ide/src/join_lines.rs index b5a6f66fd..296893d2f 100644 --- a/crates/ide/src/join_lines.rs +++ b/crates/ide/src/join_lines.rs | |||
@@ -104,7 +104,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS | |||
104 | // Special case that turns something like: | 104 | // Special case that turns something like: |
105 | // | 105 | // |
106 | // ``` | 106 | // ``` |
107 | // my_function({<|> | 107 | // my_function({$0 |
108 | // <some-expr> | 108 | // <some-expr> |
109 | // }) | 109 | // }) |
110 | // ``` | 110 | // ``` |
@@ -116,7 +116,7 @@ fn remove_newline(edit: &mut TextEditBuilder, token: &SyntaxToken, offset: TextS | |||
116 | // ditto for | 116 | // ditto for |
117 | // | 117 | // |
118 | // ``` | 118 | // ``` |
119 | // use foo::{<|> | 119 | // use foo::{$0 |
120 | // bar | 120 | // bar |
121 | // }; | 121 | // }; |
122 | // ``` | 122 | // ``` |
@@ -222,13 +222,13 @@ mod tests { | |||
222 | check_join_lines( | 222 | check_join_lines( |
223 | r" | 223 | r" |
224 | fn foo() { | 224 | fn foo() { |
225 | <|>foo(1, | 225 | $0foo(1, |
226 | ) | 226 | ) |
227 | } | 227 | } |
228 | ", | 228 | ", |
229 | r" | 229 | r" |
230 | fn foo() { | 230 | fn foo() { |
231 | <|>foo(1) | 231 | $0foo(1) |
232 | } | 232 | } |
233 | ", | 233 | ", |
234 | ); | 234 | ); |
@@ -239,14 +239,14 @@ fn foo() { | |||
239 | check_join_lines( | 239 | check_join_lines( |
240 | r" | 240 | r" |
241 | pub fn reparse(&self, edit: &AtomTextEdit) -> File { | 241 | pub fn reparse(&self, edit: &AtomTextEdit) -> File { |
242 | <|>self.incremental_reparse(edit).unwrap_or_else(|| { | 242 | $0self.incremental_reparse(edit).unwrap_or_else(|| { |
243 | self.full_reparse(edit) | 243 | self.full_reparse(edit) |
244 | }) | 244 | }) |
245 | } | 245 | } |
246 | ", | 246 | ", |
247 | r" | 247 | r" |
248 | pub fn reparse(&self, edit: &AtomTextEdit) -> File { | 248 | pub fn reparse(&self, edit: &AtomTextEdit) -> File { |
249 | <|>self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) | 249 | $0self.incremental_reparse(edit).unwrap_or_else(|| self.full_reparse(edit)) |
250 | } | 250 | } |
251 | ", | 251 | ", |
252 | ); | 252 | ); |
@@ -257,13 +257,13 @@ pub fn reparse(&self, edit: &AtomTextEdit) -> File { | |||
257 | check_join_lines( | 257 | check_join_lines( |
258 | r" | 258 | r" |
259 | fn foo() { | 259 | fn foo() { |
260 | foo(<|>{ | 260 | foo($0{ |
261 | 92 | 261 | 92 |
262 | }) | 262 | }) |
263 | }", | 263 | }", |
264 | r" | 264 | r" |
265 | fn foo() { | 265 | fn foo() { |
266 | foo(<|>92) | 266 | foo($092) |
267 | }", | 267 | }", |
268 | ); | 268 | ); |
269 | } | 269 | } |
@@ -274,7 +274,7 @@ fn foo() { | |||
274 | fn foo() { | 274 | fn foo() { |
275 | loop { | 275 | loop { |
276 | match x { | 276 | match x { |
277 | 92 => <|>{ | 277 | 92 => $0{ |
278 | continue; | 278 | continue; |
279 | } | 279 | } |
280 | } | 280 | } |
@@ -285,7 +285,7 @@ fn foo() { | |||
285 | fn foo() { | 285 | fn foo() { |
286 | loop { | 286 | loop { |
287 | match x { | 287 | match x { |
288 | 92 => <|>continue, | 288 | 92 => $0continue, |
289 | } | 289 | } |
290 | } | 290 | } |
291 | } | 291 | } |
@@ -299,7 +299,7 @@ fn foo() { | |||
299 | r" | 299 | r" |
300 | fn foo(e: Result<U, V>) { | 300 | fn foo(e: Result<U, V>) { |
301 | match e { | 301 | match e { |
302 | Ok(u) => <|>{ | 302 | Ok(u) => $0{ |
303 | u.foo() | 303 | u.foo() |
304 | } | 304 | } |
305 | Err(v) => v, | 305 | Err(v) => v, |
@@ -308,7 +308,7 @@ fn foo(e: Result<U, V>) { | |||
308 | r" | 308 | r" |
309 | fn foo(e: Result<U, V>) { | 309 | fn foo(e: Result<U, V>) { |
310 | match e { | 310 | match e { |
311 | Ok(u) => <|>u.foo(), | 311 | Ok(u) => $0u.foo(), |
312 | Err(v) => v, | 312 | Err(v) => v, |
313 | } | 313 | } |
314 | }", | 314 | }", |
@@ -321,7 +321,7 @@ fn foo(e: Result<U, V>) { | |||
321 | r" | 321 | r" |
322 | fn foo() { | 322 | fn foo() { |
323 | match ty { | 323 | match ty { |
324 | <|> Some(ty) => { | 324 | $0 Some(ty) => { |
325 | match ty { | 325 | match ty { |
326 | _ => false, | 326 | _ => false, |
327 | } | 327 | } |
@@ -333,7 +333,7 @@ fn foo() { | |||
333 | r" | 333 | r" |
334 | fn foo() { | 334 | fn foo() { |
335 | match ty { | 335 | match ty { |
336 | <|> Some(ty) => match ty { | 336 | $0 Some(ty) => match ty { |
337 | _ => false, | 337 | _ => false, |
338 | }, | 338 | }, |
339 | _ => true, | 339 | _ => true, |
@@ -350,7 +350,7 @@ fn foo() { | |||
350 | r" | 350 | r" |
351 | fn foo(e: Result<U, V>) { | 351 | fn foo(e: Result<U, V>) { |
352 | match e { | 352 | match e { |
353 | Ok(u) => <|>{ | 353 | Ok(u) => $0{ |
354 | u.foo() | 354 | u.foo() |
355 | }, | 355 | }, |
356 | Err(v) => v, | 356 | Err(v) => v, |
@@ -359,7 +359,7 @@ fn foo(e: Result<U, V>) { | |||
359 | r" | 359 | r" |
360 | fn foo(e: Result<U, V>) { | 360 | fn foo(e: Result<U, V>) { |
361 | match e { | 361 | match e { |
362 | Ok(u) => <|>u.foo(), | 362 | Ok(u) => $0u.foo(), |
363 | Err(v) => v, | 363 | Err(v) => v, |
364 | } | 364 | } |
365 | }", | 365 | }", |
@@ -370,7 +370,7 @@ fn foo(e: Result<U, V>) { | |||
370 | r" | 370 | r" |
371 | fn foo(e: Result<U, V>) { | 371 | fn foo(e: Result<U, V>) { |
372 | match e { | 372 | match e { |
373 | Ok(u) => <|>{ | 373 | Ok(u) => $0{ |
374 | u.foo() | 374 | u.foo() |
375 | } , | 375 | } , |
376 | Err(v) => v, | 376 | Err(v) => v, |
@@ -379,7 +379,7 @@ fn foo(e: Result<U, V>) { | |||
379 | r" | 379 | r" |
380 | fn foo(e: Result<U, V>) { | 380 | fn foo(e: Result<U, V>) { |
381 | match e { | 381 | match e { |
382 | Ok(u) => <|>u.foo() , | 382 | Ok(u) => $0u.foo() , |
383 | Err(v) => v, | 383 | Err(v) => v, |
384 | } | 384 | } |
385 | }", | 385 | }", |
@@ -390,7 +390,7 @@ fn foo(e: Result<U, V>) { | |||
390 | r" | 390 | r" |
391 | fn foo(e: Result<U, V>) { | 391 | fn foo(e: Result<U, V>) { |
392 | match e { | 392 | match e { |
393 | Ok(u) => <|>{ | 393 | Ok(u) => $0{ |
394 | u.foo() | 394 | u.foo() |
395 | } | 395 | } |
396 | , | 396 | , |
@@ -400,7 +400,7 @@ fn foo(e: Result<U, V>) { | |||
400 | r" | 400 | r" |
401 | fn foo(e: Result<U, V>) { | 401 | fn foo(e: Result<U, V>) { |
402 | match e { | 402 | match e { |
403 | Ok(u) => <|>u.foo() | 403 | Ok(u) => $0u.foo() |
404 | , | 404 | , |
405 | Err(v) => v, | 405 | Err(v) => v, |
406 | } | 406 | } |
@@ -414,13 +414,13 @@ fn foo(e: Result<U, V>) { | |||
414 | check_join_lines( | 414 | check_join_lines( |
415 | r" | 415 | r" |
416 | fn foo() { | 416 | fn foo() { |
417 | let x = (<|>{ | 417 | let x = ($0{ |
418 | 4 | 418 | 4 |
419 | },); | 419 | },); |
420 | }", | 420 | }", |
421 | r" | 421 | r" |
422 | fn foo() { | 422 | fn foo() { |
423 | let x = (<|>4,); | 423 | let x = ($04,); |
424 | }", | 424 | }", |
425 | ); | 425 | ); |
426 | 426 | ||
@@ -428,13 +428,13 @@ fn foo() { | |||
428 | check_join_lines( | 428 | check_join_lines( |
429 | r" | 429 | r" |
430 | fn foo() { | 430 | fn foo() { |
431 | let x = (<|>{ | 431 | let x = ($0{ |
432 | 4 | 432 | 4 |
433 | } ,); | 433 | } ,); |
434 | }", | 434 | }", |
435 | r" | 435 | r" |
436 | fn foo() { | 436 | fn foo() { |
437 | let x = (<|>4 ,); | 437 | let x = ($04 ,); |
438 | }", | 438 | }", |
439 | ); | 439 | ); |
440 | 440 | ||
@@ -442,14 +442,14 @@ fn foo() { | |||
442 | check_join_lines( | 442 | check_join_lines( |
443 | r" | 443 | r" |
444 | fn foo() { | 444 | fn foo() { |
445 | let x = (<|>{ | 445 | let x = ($0{ |
446 | 4 | 446 | 4 |
447 | } | 447 | } |
448 | ,); | 448 | ,); |
449 | }", | 449 | }", |
450 | r" | 450 | r" |
451 | fn foo() { | 451 | fn foo() { |
452 | let x = (<|>4 | 452 | let x = ($04 |
453 | ,); | 453 | ,); |
454 | }", | 454 | }", |
455 | ); | 455 | ); |
@@ -460,11 +460,11 @@ fn foo() { | |||
460 | // No space after the '{' | 460 | // No space after the '{' |
461 | check_join_lines( | 461 | check_join_lines( |
462 | r" | 462 | r" |
463 | <|>use syntax::{ | 463 | $0use syntax::{ |
464 | TextSize, TextRange, | 464 | TextSize, TextRange, |
465 | };", | 465 | };", |
466 | r" | 466 | r" |
467 | <|>use syntax::{TextSize, TextRange, | 467 | $0use syntax::{TextSize, TextRange, |
468 | };", | 468 | };", |
469 | ); | 469 | ); |
470 | } | 470 | } |
@@ -475,11 +475,11 @@ fn foo() { | |||
475 | check_join_lines( | 475 | check_join_lines( |
476 | r" | 476 | r" |
477 | use syntax::{ | 477 | use syntax::{ |
478 | <|> TextSize, TextRange | 478 | $0 TextSize, TextRange |
479 | };", | 479 | };", |
480 | r" | 480 | r" |
481 | use syntax::{ | 481 | use syntax::{ |
482 | <|> TextSize, TextRange};", | 482 | $0 TextSize, TextRange};", |
483 | ); | 483 | ); |
484 | } | 484 | } |
485 | 485 | ||
@@ -489,11 +489,11 @@ use syntax::{ | |||
489 | check_join_lines( | 489 | check_join_lines( |
490 | r" | 490 | r" |
491 | use syntax::{ | 491 | use syntax::{ |
492 | <|> TextSize, TextRange, | 492 | $0 TextSize, TextRange, |
493 | };", | 493 | };", |
494 | r" | 494 | r" |
495 | use syntax::{ | 495 | use syntax::{ |
496 | <|> TextSize, TextRange};", | 496 | $0 TextSize, TextRange};", |
497 | ); | 497 | ); |
498 | } | 498 | } |
499 | 499 | ||
@@ -502,14 +502,14 @@ use syntax::{ | |||
502 | check_join_lines( | 502 | check_join_lines( |
503 | r" | 503 | r" |
504 | use syntax::{ | 504 | use syntax::{ |
505 | algo::<|>{ | 505 | algo::$0{ |
506 | find_token_at_offset, | 506 | find_token_at_offset, |
507 | }, | 507 | }, |
508 | ast, | 508 | ast, |
509 | };", | 509 | };", |
510 | r" | 510 | r" |
511 | use syntax::{ | 511 | use syntax::{ |
512 | algo::<|>find_token_at_offset, | 512 | algo::$0find_token_at_offset, |
513 | ast, | 513 | ast, |
514 | };", | 514 | };", |
515 | ); | 515 | ); |
@@ -520,13 +520,13 @@ use syntax::{ | |||
520 | check_join_lines( | 520 | check_join_lines( |
521 | r" | 521 | r" |
522 | fn foo() { | 522 | fn foo() { |
523 | // Hello<|> | 523 | // Hello$0 |
524 | // world! | 524 | // world! |
525 | } | 525 | } |
526 | ", | 526 | ", |
527 | r" | 527 | r" |
528 | fn foo() { | 528 | fn foo() { |
529 | // Hello<|> world! | 529 | // Hello$0 world! |
530 | } | 530 | } |
531 | ", | 531 | ", |
532 | ); | 532 | ); |
@@ -537,13 +537,13 @@ fn foo() { | |||
537 | check_join_lines( | 537 | check_join_lines( |
538 | r" | 538 | r" |
539 | fn foo() { | 539 | fn foo() { |
540 | /// Hello<|> | 540 | /// Hello$0 |
541 | /// world! | 541 | /// world! |
542 | } | 542 | } |
543 | ", | 543 | ", |
544 | r" | 544 | r" |
545 | fn foo() { | 545 | fn foo() { |
546 | /// Hello<|> world! | 546 | /// Hello$0 world! |
547 | } | 547 | } |
548 | ", | 548 | ", |
549 | ); | 549 | ); |
@@ -554,13 +554,13 @@ fn foo() { | |||
554 | check_join_lines( | 554 | check_join_lines( |
555 | r" | 555 | r" |
556 | fn foo() { | 556 | fn foo() { |
557 | //! Hello<|> | 557 | //! Hello$0 |
558 | //! world! | 558 | //! world! |
559 | } | 559 | } |
560 | ", | 560 | ", |
561 | r" | 561 | r" |
562 | fn foo() { | 562 | fn foo() { |
563 | //! Hello<|> world! | 563 | //! Hello$0 world! |
564 | } | 564 | } |
565 | ", | 565 | ", |
566 | ); | 566 | ); |
@@ -571,13 +571,13 @@ fn foo() { | |||
571 | check_join_lines( | 571 | check_join_lines( |
572 | r" | 572 | r" |
573 | fn foo() { | 573 | fn foo() { |
574 | // Hello<|> | 574 | // Hello$0 |
575 | /* world! */ | 575 | /* world! */ |
576 | } | 576 | } |
577 | ", | 577 | ", |
578 | r" | 578 | r" |
579 | fn foo() { | 579 | fn foo() { |
580 | // Hello<|> world! */ | 580 | // Hello$0 world! */ |
581 | } | 581 | } |
582 | ", | 582 | ", |
583 | ); | 583 | ); |
@@ -588,7 +588,7 @@ fn foo() { | |||
588 | check_join_lines( | 588 | check_join_lines( |
589 | r" | 589 | r" |
590 | fn foo() { | 590 | fn foo() { |
591 | // The<|> | 591 | // The$0 |
592 | /* quick | 592 | /* quick |
593 | brown | 593 | brown |
594 | fox! */ | 594 | fox! */ |
@@ -596,7 +596,7 @@ fn foo() { | |||
596 | ", | 596 | ", |
597 | r" | 597 | r" |
598 | fn foo() { | 598 | fn foo() { |
599 | // The<|> quick | 599 | // The$0 quick |
600 | brown | 600 | brown |
601 | fox! */ | 601 | fox! */ |
602 | } | 602 | } |
@@ -621,10 +621,10 @@ fn foo() { | |||
621 | check_join_lines_sel( | 621 | check_join_lines_sel( |
622 | r" | 622 | r" |
623 | fn foo() { | 623 | fn foo() { |
624 | <|>foo(1, | 624 | $0foo(1, |
625 | 2, | 625 | 2, |
626 | 3, | 626 | 3, |
627 | <|>) | 627 | $0) |
628 | } | 628 | } |
629 | ", | 629 | ", |
630 | r" | 630 | r" |
@@ -639,9 +639,9 @@ fn foo() { | |||
639 | fn test_join_lines_selection_struct() { | 639 | fn test_join_lines_selection_struct() { |
640 | check_join_lines_sel( | 640 | check_join_lines_sel( |
641 | r" | 641 | r" |
642 | struct Foo <|>{ | 642 | struct Foo $0{ |
643 | f: u32, | 643 | f: u32, |
644 | }<|> | 644 | }$0 |
645 | ", | 645 | ", |
646 | r" | 646 | r" |
647 | struct Foo { f: u32 } | 647 | struct Foo { f: u32 } |
@@ -654,9 +654,9 @@ struct Foo { f: u32 } | |||
654 | check_join_lines_sel( | 654 | check_join_lines_sel( |
655 | r" | 655 | r" |
656 | fn foo() { | 656 | fn foo() { |
657 | join(<|>type_params.type_params() | 657 | join($0type_params.type_params() |
658 | .filter_map(|it| it.name()) | 658 | .filter_map(|it| it.name()) |
659 | .map(|it| it.text())<|>) | 659 | .map(|it| it.text())$0) |
660 | }", | 660 | }", |
661 | r" | 661 | r" |
662 | fn foo() { | 662 | fn foo() { |
@@ -671,9 +671,9 @@ fn foo() { | |||
671 | r" | 671 | r" |
672 | pub fn handle_find_matching_brace() { | 672 | pub fn handle_find_matching_brace() { |
673 | params.offsets | 673 | params.offsets |
674 | .map(|offset| <|>{ | 674 | .map(|offset| $0{ |
675 | world.analysis().matching_brace(&file, offset).unwrap_or(offset) | 675 | world.analysis().matching_brace(&file, offset).unwrap_or(offset) |
676 | }<|>) | 676 | }$0) |
677 | .collect(); | 677 | .collect(); |
678 | }", | 678 | }", |
679 | r" | 679 | r" |
@@ -691,7 +691,7 @@ pub fn handle_find_matching_brace() { | |||
691 | r" | 691 | r" |
692 | fn main() { | 692 | fn main() { |
693 | let _ = { | 693 | let _ = { |
694 | // <|>foo | 694 | // $0foo |
695 | // bar | 695 | // bar |
696 | 92 | 696 | 92 |
697 | }; | 697 | }; |
@@ -700,7 +700,7 @@ fn main() { | |||
700 | r" | 700 | r" |
701 | fn main() { | 701 | fn main() { |
702 | let _ = { | 702 | let _ = { |
703 | // <|>foo bar | 703 | // $0foo bar |
704 | 92 | 704 | 92 |
705 | }; | 705 | }; |
706 | } | 706 | } |
@@ -712,12 +712,12 @@ fn main() { | |||
712 | fn join_lines_mandatory_blocks_block() { | 712 | fn join_lines_mandatory_blocks_block() { |
713 | check_join_lines( | 713 | check_join_lines( |
714 | r" | 714 | r" |
715 | <|>fn foo() { | 715 | $0fn foo() { |
716 | 92 | 716 | 92 |
717 | } | 717 | } |
718 | ", | 718 | ", |
719 | r" | 719 | r" |
720 | <|>fn foo() { 92 | 720 | $0fn foo() { 92 |
721 | } | 721 | } |
722 | ", | 722 | ", |
723 | ); | 723 | ); |
@@ -725,14 +725,14 @@ fn main() { | |||
725 | check_join_lines( | 725 | check_join_lines( |
726 | r" | 726 | r" |
727 | fn foo() { | 727 | fn foo() { |
728 | <|>if true { | 728 | $0if true { |
729 | 92 | 729 | 92 |
730 | } | 730 | } |
731 | } | 731 | } |
732 | ", | 732 | ", |
733 | r" | 733 | r" |
734 | fn foo() { | 734 | fn foo() { |
735 | <|>if true { 92 | 735 | $0if true { 92 |
736 | } | 736 | } |
737 | } | 737 | } |
738 | ", | 738 | ", |
@@ -741,14 +741,14 @@ fn foo() { | |||
741 | check_join_lines( | 741 | check_join_lines( |
742 | r" | 742 | r" |
743 | fn foo() { | 743 | fn foo() { |
744 | <|>loop { | 744 | $0loop { |
745 | 92 | 745 | 92 |
746 | } | 746 | } |
747 | } | 747 | } |
748 | ", | 748 | ", |
749 | r" | 749 | r" |
750 | fn foo() { | 750 | fn foo() { |
751 | <|>loop { 92 | 751 | $0loop { 92 |
752 | } | 752 | } |
753 | } | 753 | } |
754 | ", | 754 | ", |
@@ -757,14 +757,14 @@ fn foo() { | |||
757 | check_join_lines( | 757 | check_join_lines( |
758 | r" | 758 | r" |
759 | fn foo() { | 759 | fn foo() { |
760 | <|>unsafe { | 760 | $0unsafe { |
761 | 92 | 761 | 92 |
762 | } | 762 | } |
763 | } | 763 | } |
764 | ", | 764 | ", |
765 | r" | 765 | r" |
766 | fn foo() { | 766 | fn foo() { |
767 | <|>unsafe { 92 | 767 | $0unsafe { 92 |
768 | } | 768 | } |
769 | } | 769 | } |
770 | ", | 770 | ", |
diff --git a/crates/ide/src/matching_brace.rs b/crates/ide/src/matching_brace.rs index d70248afe..1bfa1439d 100644 --- a/crates/ide/src/matching_brace.rs +++ b/crates/ide/src/matching_brace.rs | |||
@@ -58,15 +58,15 @@ mod tests { | |||
58 | assert_eq_text!(after, &actual); | 58 | assert_eq_text!(after, &actual); |
59 | } | 59 | } |
60 | 60 | ||
61 | do_check("struct Foo { a: i32, }<|>", "struct Foo <|>{ a: i32, }"); | 61 | do_check("struct Foo { a: i32, }$0", "struct Foo $0{ a: i32, }"); |
62 | do_check("fn main() { |x: i32|<|> x * 2;}", "fn main() { <|>|x: i32| x * 2;}"); | 62 | do_check("fn main() { |x: i32|$0 x * 2;}", "fn main() { $0|x: i32| x * 2;}"); |
63 | do_check("fn main() { <|>|x: i32| x * 2;}", "fn main() { |x: i32<|>| x * 2;}"); | 63 | do_check("fn main() { $0|x: i32| x * 2;}", "fn main() { |x: i32$0| x * 2;}"); |
64 | 64 | ||
65 | { | 65 | { |
66 | mark::check!(pipes_not_braces); | 66 | mark::check!(pipes_not_braces); |
67 | do_check( | 67 | do_check( |
68 | "fn main() { match 92 { 1 | 2 |<|> 3 => 92 } }", | 68 | "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", |
69 | "fn main() { match 92 { 1 | 2 |<|> 3 => 92 } }", | 69 | "fn main() { match 92 { 1 | 2 |$0 3 => 92 } }", |
70 | ); | 70 | ); |
71 | } | 71 | } |
72 | } | 72 | } |
diff --git a/crates/ide/src/parent_module.rs b/crates/ide/src/parent_module.rs index be344a09b..d343638fb 100644 --- a/crates/ide/src/parent_module.rs +++ b/crates/ide/src/parent_module.rs | |||
@@ -74,7 +74,7 @@ mod tests { | |||
74 | //- /lib.rs | 74 | //- /lib.rs |
75 | mod foo; | 75 | mod foo; |
76 | //- /foo.rs | 76 | //- /foo.rs |
77 | <|>// empty | 77 | $0// empty |
78 | ", | 78 | ", |
79 | ); | 79 | ); |
80 | let nav = analysis.parent_module(pos).unwrap().pop().unwrap(); | 80 | let nav = analysis.parent_module(pos).unwrap().pop().unwrap(); |
@@ -90,7 +90,7 @@ mod tests { | |||
90 | mod foo; | 90 | mod foo; |
91 | 91 | ||
92 | //- /foo.rs | 92 | //- /foo.rs |
93 | mod <|>bar; | 93 | mod $0bar; |
94 | 94 | ||
95 | //- /foo/bar.rs | 95 | //- /foo/bar.rs |
96 | // empty | 96 | // empty |
@@ -107,7 +107,7 @@ mod tests { | |||
107 | //- /lib.rs | 107 | //- /lib.rs |
108 | mod foo { | 108 | mod foo { |
109 | mod bar { | 109 | mod bar { |
110 | mod baz { <|> } | 110 | mod baz { $0 } |
111 | } | 111 | } |
112 | } | 112 | } |
113 | ", | 113 | ", |
@@ -123,7 +123,7 @@ mod tests { | |||
123 | //- /main.rs | 123 | //- /main.rs |
124 | mod foo; | 124 | mod foo; |
125 | //- /foo.rs | 125 | //- /foo.rs |
126 | <|> | 126 | $0 |
127 | "#, | 127 | "#, |
128 | ); | 128 | ); |
129 | assert_eq!(analysis.crate_for(file_id).unwrap().len(), 1); | 129 | assert_eq!(analysis.crate_for(file_id).unwrap().len(), 1); |
diff --git a/crates/ide/src/references.rs b/crates/ide/src/references.rs index fa58fc319..c95ed669c 100644 --- a/crates/ide/src/references.rs +++ b/crates/ide/src/references.rs | |||
@@ -331,7 +331,7 @@ mod tests { | |||
331 | fn test_struct_literal_after_space() { | 331 | fn test_struct_literal_after_space() { |
332 | check( | 332 | check( |
333 | r#" | 333 | r#" |
334 | struct Foo <|>{ | 334 | struct Foo $0{ |
335 | a: i32, | 335 | a: i32, |
336 | } | 336 | } |
337 | impl Foo { | 337 | impl Foo { |
@@ -354,7 +354,7 @@ fn main() { | |||
354 | fn test_struct_literal_before_space() { | 354 | fn test_struct_literal_before_space() { |
355 | check( | 355 | check( |
356 | r#" | 356 | r#" |
357 | struct Foo<|> {} | 357 | struct Foo$0 {} |
358 | fn main() { | 358 | fn main() { |
359 | let f: Foo; | 359 | let f: Foo; |
360 | f = Foo {}; | 360 | f = Foo {}; |
@@ -373,7 +373,7 @@ struct Foo<|> {} | |||
373 | fn test_struct_literal_with_generic_type() { | 373 | fn test_struct_literal_with_generic_type() { |
374 | check( | 374 | check( |
375 | r#" | 375 | r#" |
376 | struct Foo<T> <|>{} | 376 | struct Foo<T> $0{} |
377 | fn main() { | 377 | fn main() { |
378 | let f: Foo::<i32>; | 378 | let f: Foo::<i32>; |
379 | f = Foo {}; | 379 | f = Foo {}; |
@@ -391,7 +391,7 @@ struct Foo<T> <|>{} | |||
391 | fn test_struct_literal_for_tuple() { | 391 | fn test_struct_literal_for_tuple() { |
392 | check( | 392 | check( |
393 | r#" | 393 | r#" |
394 | struct Foo<|>(i32); | 394 | struct Foo$0(i32); |
395 | 395 | ||
396 | fn main() { | 396 | fn main() { |
397 | let f: Foo; | 397 | let f: Foo; |
@@ -410,7 +410,7 @@ fn main() { | |||
410 | fn test_enum_after_space() { | 410 | fn test_enum_after_space() { |
411 | check( | 411 | check( |
412 | r#" | 412 | r#" |
413 | enum Foo <|>{ | 413 | enum Foo $0{ |
414 | A, | 414 | A, |
415 | B, | 415 | B, |
416 | } | 416 | } |
@@ -431,7 +431,7 @@ fn main() { | |||
431 | fn test_enum_before_space() { | 431 | fn test_enum_before_space() { |
432 | check( | 432 | check( |
433 | r#" | 433 | r#" |
434 | enum Foo<|> { | 434 | enum Foo$0 { |
435 | A, | 435 | A, |
436 | B, | 436 | B, |
437 | } | 437 | } |
@@ -453,7 +453,7 @@ fn main() { | |||
453 | fn test_enum_with_generic_type() { | 453 | fn test_enum_with_generic_type() { |
454 | check( | 454 | check( |
455 | r#" | 455 | r#" |
456 | enum Foo<T> <|>{ | 456 | enum Foo<T> $0{ |
457 | A(T), | 457 | A(T), |
458 | B, | 458 | B, |
459 | } | 459 | } |
@@ -474,7 +474,7 @@ fn main() { | |||
474 | fn test_enum_for_tuple() { | 474 | fn test_enum_for_tuple() { |
475 | check( | 475 | check( |
476 | r#" | 476 | r#" |
477 | enum Foo<|>{ | 477 | enum Foo$0{ |
478 | A(i8), | 478 | A(i8), |
479 | B(i8), | 479 | B(i8), |
480 | } | 480 | } |
@@ -498,7 +498,7 @@ fn main() { | |||
498 | fn main() { | 498 | fn main() { |
499 | let mut i = 1; | 499 | let mut i = 1; |
500 | let j = 1; | 500 | let j = 1; |
501 | i = i<|> + j; | 501 | i = i$0 + j; |
502 | 502 | ||
503 | { | 503 | { |
504 | i = 0; | 504 | i = 0; |
@@ -522,7 +522,7 @@ fn main() { | |||
522 | check( | 522 | check( |
523 | r#" | 523 | r#" |
524 | fn foo() { | 524 | fn foo() { |
525 | let spam<|> = 92; | 525 | let spam$0 = 92; |
526 | spam + spam | 526 | spam + spam |
527 | } | 527 | } |
528 | fn bar() { | 528 | fn bar() { |
@@ -543,7 +543,7 @@ fn bar() { | |||
543 | fn test_find_all_refs_for_param_inside() { | 543 | fn test_find_all_refs_for_param_inside() { |
544 | check( | 544 | check( |
545 | r#" | 545 | r#" |
546 | fn foo(i : u32) -> u32 { i<|> } | 546 | fn foo(i : u32) -> u32 { i$0 } |
547 | "#, | 547 | "#, |
548 | expect![[r#" | 548 | expect![[r#" |
549 | i ValueParam FileId(0) 7..8 Other | 549 | i ValueParam FileId(0) 7..8 Other |
@@ -557,7 +557,7 @@ fn foo(i : u32) -> u32 { i<|> } | |||
557 | fn test_find_all_refs_for_fn_param() { | 557 | fn test_find_all_refs_for_fn_param() { |
558 | check( | 558 | check( |
559 | r#" | 559 | r#" |
560 | fn foo(i<|> : u32) -> u32 { i } | 560 | fn foo(i$0 : u32) -> u32 { i } |
561 | "#, | 561 | "#, |
562 | expect![[r#" | 562 | expect![[r#" |
563 | i ValueParam FileId(0) 7..8 Other | 563 | i ValueParam FileId(0) 7..8 Other |
@@ -573,7 +573,7 @@ fn foo(i<|> : u32) -> u32 { i } | |||
573 | r#" | 573 | r#" |
574 | //- /lib.rs | 574 | //- /lib.rs |
575 | struct Foo { | 575 | struct Foo { |
576 | pub spam<|>: u32, | 576 | pub spam$0: u32, |
577 | } | 577 | } |
578 | 578 | ||
579 | fn main(s: Foo) { | 579 | fn main(s: Foo) { |
@@ -594,7 +594,7 @@ fn main(s: Foo) { | |||
594 | r#" | 594 | r#" |
595 | struct Foo; | 595 | struct Foo; |
596 | impl Foo { | 596 | impl Foo { |
597 | fn f<|>(&self) { } | 597 | fn f$0(&self) { } |
598 | } | 598 | } |
599 | "#, | 599 | "#, |
600 | expect![[r#" | 600 | expect![[r#" |
@@ -610,7 +610,7 @@ impl Foo { | |||
610 | r#" | 610 | r#" |
611 | enum Foo { | 611 | enum Foo { |
612 | A, | 612 | A, |
613 | B<|>, | 613 | B$0, |
614 | C, | 614 | C, |
615 | } | 615 | } |
616 | "#, | 616 | "#, |
@@ -627,7 +627,7 @@ enum Foo { | |||
627 | r#" | 627 | r#" |
628 | enum Foo { | 628 | enum Foo { |
629 | A, | 629 | A, |
630 | B { field<|>: u8 }, | 630 | B { field$0: u8 }, |
631 | C, | 631 | C, |
632 | } | 632 | } |
633 | "#, | 633 | "#, |
@@ -669,7 +669,7 @@ pub struct Bar { | |||
669 | } | 669 | } |
670 | 670 | ||
671 | fn f() { | 671 | fn f() { |
672 | let i = foo::Foo<|> { n: 5 }; | 672 | let i = foo::Foo$0 { n: 5 }; |
673 | } | 673 | } |
674 | "#, | 674 | "#, |
675 | expect![[r#" | 675 | expect![[r#" |
@@ -689,7 +689,7 @@ fn f() { | |||
689 | check( | 689 | check( |
690 | r#" | 690 | r#" |
691 | //- /lib.rs | 691 | //- /lib.rs |
692 | mod foo<|>; | 692 | mod foo$0; |
693 | 693 | ||
694 | use foo::Foo; | 694 | use foo::Foo; |
695 | 695 | ||
@@ -726,7 +726,7 @@ fn f() { | |||
726 | } | 726 | } |
727 | 727 | ||
728 | //- /foo/some.rs | 728 | //- /foo/some.rs |
729 | pub(super) struct Foo<|> { | 729 | pub(super) struct Foo$0 { |
730 | pub n: u32, | 730 | pub n: u32, |
731 | } | 731 | } |
732 | "#, | 732 | "#, |
@@ -746,7 +746,7 @@ pub(super) struct Foo<|> { | |||
746 | mod foo; | 746 | mod foo; |
747 | mod bar; | 747 | mod bar; |
748 | 748 | ||
749 | pub fn quux<|>() {} | 749 | pub fn quux$0() {} |
750 | 750 | ||
751 | //- /foo.rs | 751 | //- /foo.rs |
752 | fn f() { super::quux(); } | 752 | fn f() { super::quux(); } |
@@ -782,7 +782,7 @@ pub(super) struct Foo<|> { | |||
782 | check( | 782 | check( |
783 | r#" | 783 | r#" |
784 | #[macro_export] | 784 | #[macro_export] |
785 | macro_rules! m1<|> { () => (()) } | 785 | macro_rules! m1$0 { () => (()) } |
786 | 786 | ||
787 | fn foo() { | 787 | fn foo() { |
788 | m1(); | 788 | m1(); |
@@ -803,7 +803,7 @@ fn foo() { | |||
803 | check( | 803 | check( |
804 | r#" | 804 | r#" |
805 | fn foo() { | 805 | fn foo() { |
806 | let mut i<|> = 0; | 806 | let mut i$0 = 0; |
807 | i = i + 1; | 807 | i = i + 1; |
808 | } | 808 | } |
809 | "#, | 809 | "#, |
@@ -826,7 +826,7 @@ struct S { | |||
826 | 826 | ||
827 | fn foo() { | 827 | fn foo() { |
828 | let mut s = S{f: 0}; | 828 | let mut s = S{f: 0}; |
829 | s.f<|> = 0; | 829 | s.f$0 = 0; |
830 | } | 830 | } |
831 | "#, | 831 | "#, |
832 | expect![[r#" | 832 | expect![[r#" |
@@ -843,7 +843,7 @@ fn foo() { | |||
843 | check( | 843 | check( |
844 | r#" | 844 | r#" |
845 | fn foo() { | 845 | fn foo() { |
846 | let i<|>; | 846 | let i$0; |
847 | i = 1; | 847 | i = 1; |
848 | } | 848 | } |
849 | "#, | 849 | "#, |
@@ -863,7 +863,7 @@ mod foo { | |||
863 | pub struct Foo; | 863 | pub struct Foo; |
864 | 864 | ||
865 | impl Foo { | 865 | impl Foo { |
866 | pub fn new<|>() -> Foo { Foo } | 866 | pub fn new$0() -> Foo { Foo } |
867 | } | 867 | } |
868 | } | 868 | } |
869 | 869 | ||
@@ -886,7 +886,7 @@ fn main() { | |||
886 | //- /lib.rs | 886 | //- /lib.rs |
887 | mod foo { mod bar; } | 887 | mod foo { mod bar; } |
888 | 888 | ||
889 | fn f<|>() {} | 889 | fn f$0() {} |
890 | 890 | ||
891 | //- /foo/bar.rs | 891 | //- /foo/bar.rs |
892 | use crate::f; | 892 | use crate::f; |
@@ -907,7 +907,7 @@ fn g() { f(); } | |||
907 | check( | 907 | check( |
908 | r#" | 908 | r#" |
909 | struct S { | 909 | struct S { |
910 | field<|>: u8, | 910 | field$0: u8, |
911 | } | 911 | } |
912 | 912 | ||
913 | fn f(s: S) { | 913 | fn f(s: S) { |
@@ -930,7 +930,7 @@ fn f(s: S) { | |||
930 | r#" | 930 | r#" |
931 | enum En { | 931 | enum En { |
932 | Variant { | 932 | Variant { |
933 | field<|>: u8, | 933 | field$0: u8, |
934 | } | 934 | } |
935 | } | 935 | } |
936 | 936 | ||
@@ -955,7 +955,7 @@ fn f(e: En) { | |||
955 | mod m { | 955 | mod m { |
956 | pub enum En { | 956 | pub enum En { |
957 | Variant { | 957 | Variant { |
958 | field<|>: u8, | 958 | field$0: u8, |
959 | } | 959 | } |
960 | } | 960 | } |
961 | } | 961 | } |
@@ -980,7 +980,7 @@ struct Foo { bar: i32 } | |||
980 | 980 | ||
981 | impl Foo { | 981 | impl Foo { |
982 | fn foo(self) { | 982 | fn foo(self) { |
983 | let x = self<|>.bar; | 983 | let x = self$0.bar; |
984 | if true { | 984 | if true { |
985 | let _ = match () { | 985 | let _ = match () { |
986 | () => self, | 986 | () => self, |
@@ -1032,7 +1032,7 @@ impl Foo { | |||
1032 | r#" | 1032 | r#" |
1033 | trait Foo<'a> {} | 1033 | trait Foo<'a> {} |
1034 | impl<'a> Foo<'a> for &'a () {} | 1034 | impl<'a> Foo<'a> for &'a () {} |
1035 | fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> { | 1035 | fn foo<'a, 'b: 'a>(x: &'a$0 ()) -> &'a () where &'a (): Foo<'a> { |
1036 | fn bar<'a>(_: &'a ()) {} | 1036 | fn bar<'a>(_: &'a ()) {} |
1037 | x | 1037 | x |
1038 | } | 1038 | } |
@@ -1053,7 +1053,7 @@ fn foo<'a, 'b: 'a>(x: &'a<|> ()) -> &'a () where &'a (): Foo<'a> { | |||
1053 | fn test_find_lifetimes_type_alias() { | 1053 | fn test_find_lifetimes_type_alias() { |
1054 | check( | 1054 | check( |
1055 | r#" | 1055 | r#" |
1056 | type Foo<'a, T> where T: 'a<|> = &'a T; | 1056 | type Foo<'a, T> where T: 'a$0 = &'a T; |
1057 | "#, | 1057 | "#, |
1058 | expect![[r#" | 1058 | expect![[r#" |
1059 | 'a LifetimeParam FileId(0) 9..11 9..11 Lifetime | 1059 | 'a LifetimeParam FileId(0) 9..11 9..11 Lifetime |
@@ -1072,7 +1072,7 @@ trait Foo<'a> { | |||
1072 | fn foo() -> &'a (); | 1072 | fn foo() -> &'a (); |
1073 | } | 1073 | } |
1074 | impl<'a> Foo<'a> for &'a () { | 1074 | impl<'a> Foo<'a> for &'a () { |
1075 | fn foo() -> &'a<|> () { | 1075 | fn foo() -> &'a$0 () { |
1076 | unimplemented!() | 1076 | unimplemented!() |
1077 | } | 1077 | } |
1078 | } | 1078 | } |
@@ -1093,7 +1093,7 @@ impl<'a> Foo<'a> for &'a () { | |||
1093 | r#" | 1093 | r#" |
1094 | macro_rules! foo {($i:ident) => {$i} } | 1094 | macro_rules! foo {($i:ident) => {$i} } |
1095 | fn main() { | 1095 | fn main() { |
1096 | let a<|> = "test"; | 1096 | let a$0 = "test"; |
1097 | foo!(a); | 1097 | foo!(a); |
1098 | } | 1098 | } |
1099 | "#, | 1099 | "#, |
@@ -1112,7 +1112,7 @@ fn main() { | |||
1112 | macro_rules! foo {($i:ident) => {$i} } | 1112 | macro_rules! foo {($i:ident) => {$i} } |
1113 | fn main() { | 1113 | fn main() { |
1114 | let a = "test"; | 1114 | let a = "test"; |
1115 | foo!(a<|>); | 1115 | foo!(a$0); |
1116 | } | 1116 | } |
1117 | "#, | 1117 | "#, |
1118 | expect![[r#" | 1118 | expect![[r#" |
@@ -1130,7 +1130,7 @@ fn main() { | |||
1130 | fn foo<'a>() -> &'a () { | 1130 | fn foo<'a>() -> &'a () { |
1131 | 'a: loop { | 1131 | 'a: loop { |
1132 | 'b: loop { | 1132 | 'b: loop { |
1133 | continue 'a<|>; | 1133 | continue 'a$0; |
1134 | } | 1134 | } |
1135 | break 'a; | 1135 | break 'a; |
1136 | } | 1136 | } |
@@ -1149,7 +1149,7 @@ fn foo<'a>() -> &'a () { | |||
1149 | fn test_find_const_param() { | 1149 | fn test_find_const_param() { |
1150 | check( | 1150 | check( |
1151 | r#" | 1151 | r#" |
1152 | fn foo<const FOO<|>: usize>() -> usize { | 1152 | fn foo<const FOO$0: usize>() -> usize { |
1153 | FOO | 1153 | FOO |
1154 | } | 1154 | } |
1155 | "#, | 1155 | "#, |
diff --git a/crates/ide/src/references/rename.rs b/crates/ide/src/references/rename.rs index 854bf194e..53d79333c 100644 --- a/crates/ide/src/references/rename.rs +++ b/crates/ide/src/references/rename.rs | |||
@@ -493,19 +493,19 @@ mod tests { | |||
493 | 493 | ||
494 | #[test] | 494 | #[test] |
495 | fn test_rename_to_underscore() { | 495 | fn test_rename_to_underscore() { |
496 | check("_", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let _ = 1; }"#); | 496 | check("_", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let _ = 1; }"#); |
497 | } | 497 | } |
498 | 498 | ||
499 | #[test] | 499 | #[test] |
500 | fn test_rename_to_raw_identifier() { | 500 | fn test_rename_to_raw_identifier() { |
501 | check("r#fn", r#"fn main() { let i<|> = 1; }"#, r#"fn main() { let r#fn = 1; }"#); | 501 | check("r#fn", r#"fn main() { let i$0 = 1; }"#, r#"fn main() { let r#fn = 1; }"#); |
502 | } | 502 | } |
503 | 503 | ||
504 | #[test] | 504 | #[test] |
505 | fn test_rename_to_invalid_identifier1() { | 505 | fn test_rename_to_invalid_identifier1() { |
506 | check( | 506 | check( |
507 | "invalid!", | 507 | "invalid!", |
508 | r#"fn main() { let i<|> = 1; }"#, | 508 | r#"fn main() { let i$0 = 1; }"#, |
509 | "error: Invalid name `invalid!`: not an identifier", | 509 | "error: Invalid name `invalid!`: not an identifier", |
510 | ); | 510 | ); |
511 | } | 511 | } |
@@ -514,7 +514,7 @@ mod tests { | |||
514 | fn test_rename_to_invalid_identifier2() { | 514 | fn test_rename_to_invalid_identifier2() { |
515 | check( | 515 | check( |
516 | "multiple tokens", | 516 | "multiple tokens", |
517 | r#"fn main() { let i<|> = 1; }"#, | 517 | r#"fn main() { let i$0 = 1; }"#, |
518 | "error: Invalid name `multiple tokens`: not an identifier", | 518 | "error: Invalid name `multiple tokens`: not an identifier", |
519 | ); | 519 | ); |
520 | } | 520 | } |
@@ -523,7 +523,7 @@ mod tests { | |||
523 | fn test_rename_to_invalid_identifier3() { | 523 | fn test_rename_to_invalid_identifier3() { |
524 | check( | 524 | check( |
525 | "let", | 525 | "let", |
526 | r#"fn main() { let i<|> = 1; }"#, | 526 | r#"fn main() { let i$0 = 1; }"#, |
527 | "error: Invalid name `let`: not an identifier", | 527 | "error: Invalid name `let`: not an identifier", |
528 | ); | 528 | ); |
529 | } | 529 | } |
@@ -532,7 +532,7 @@ mod tests { | |||
532 | fn test_rename_to_invalid_identifier_lifetime() { | 532 | fn test_rename_to_invalid_identifier_lifetime() { |
533 | check( | 533 | check( |
534 | "'foo", | 534 | "'foo", |
535 | r#"fn main() { let i<|> = 1; }"#, | 535 | r#"fn main() { let i$0 = 1; }"#, |
536 | "error: Invalid name `'foo`: not an identifier", | 536 | "error: Invalid name `'foo`: not an identifier", |
537 | ); | 537 | ); |
538 | } | 538 | } |
@@ -541,7 +541,7 @@ mod tests { | |||
541 | fn test_rename_to_invalid_identifier_lifetime2() { | 541 | fn test_rename_to_invalid_identifier_lifetime2() { |
542 | check( | 542 | check( |
543 | "foo", | 543 | "foo", |
544 | r#"fn main<'a>(_: &'a<|> ()) {}"#, | 544 | r#"fn main<'a>(_: &'a$0 ()) {}"#, |
545 | "error: Invalid name `foo`: not a lifetime identifier", | 545 | "error: Invalid name `foo`: not a lifetime identifier", |
546 | ); | 546 | ); |
547 | } | 547 | } |
@@ -554,7 +554,7 @@ mod tests { | |||
554 | fn main() { | 554 | fn main() { |
555 | let mut i = 1; | 555 | let mut i = 1; |
556 | let j = 1; | 556 | let j = 1; |
557 | i = i<|> + j; | 557 | i = i$0 + j; |
558 | 558 | ||
559 | { i = 0; } | 559 | { i = 0; } |
560 | 560 | ||
@@ -579,7 +579,7 @@ fn main() { | |||
579 | fn test_rename_unresolved_reference() { | 579 | fn test_rename_unresolved_reference() { |
580 | check( | 580 | check( |
581 | "new_name", | 581 | "new_name", |
582 | r#"fn main() { let _ = unresolved_ref<|>; }"#, | 582 | r#"fn main() { let _ = unresolved_ref$0; }"#, |
583 | "error: No references found at position", | 583 | "error: No references found at position", |
584 | ); | 584 | ); |
585 | } | 585 | } |
@@ -591,7 +591,7 @@ fn main() { | |||
591 | r#" | 591 | r#" |
592 | macro_rules! foo {($i:ident) => {$i} } | 592 | macro_rules! foo {($i:ident) => {$i} } |
593 | fn main() { | 593 | fn main() { |
594 | let a<|> = "test"; | 594 | let a$0 = "test"; |
595 | foo!(a); | 595 | foo!(a); |
596 | } | 596 | } |
597 | "#, | 597 | "#, |
@@ -613,7 +613,7 @@ fn main() { | |||
613 | macro_rules! foo {($i:ident) => {$i} } | 613 | macro_rules! foo {($i:ident) => {$i} } |
614 | fn main() { | 614 | fn main() { |
615 | let a = "test"; | 615 | let a = "test"; |
616 | foo!(a<|>); | 616 | foo!(a$0); |
617 | } | 617 | } |
618 | "#, | 618 | "#, |
619 | r#" | 619 | r#" |
@@ -634,7 +634,7 @@ fn main() { | |||
634 | macro_rules! define_fn {($id:ident) => { fn $id{} }} | 634 | macro_rules! define_fn {($id:ident) => { fn $id{} }} |
635 | define_fn!(foo); | 635 | define_fn!(foo); |
636 | fn main() { | 636 | fn main() { |
637 | fo<|>o(); | 637 | fo$0o(); |
638 | } | 638 | } |
639 | "#, | 639 | "#, |
640 | r#" | 640 | r#" |
@@ -653,7 +653,7 @@ fn main() { | |||
653 | "bar", | 653 | "bar", |
654 | r#" | 654 | r#" |
655 | macro_rules! define_fn {($id:ident) => { fn $id{} }} | 655 | macro_rules! define_fn {($id:ident) => { fn $id{} }} |
656 | define_fn!(fo<|>o); | 656 | define_fn!(fo$0o); |
657 | fn main() { | 657 | fn main() { |
658 | foo(); | 658 | foo(); |
659 | } | 659 | } |
@@ -670,17 +670,17 @@ fn main() { | |||
670 | 670 | ||
671 | #[test] | 671 | #[test] |
672 | fn test_rename_for_param_inside() { | 672 | fn test_rename_for_param_inside() { |
673 | check("j", r#"fn foo(i : u32) -> u32 { i<|> }"#, r#"fn foo(j : u32) -> u32 { j }"#); | 673 | check("j", r#"fn foo(i : u32) -> u32 { i$0 }"#, r#"fn foo(j : u32) -> u32 { j }"#); |
674 | } | 674 | } |
675 | 675 | ||
676 | #[test] | 676 | #[test] |
677 | fn test_rename_refs_for_fn_param() { | 677 | fn test_rename_refs_for_fn_param() { |
678 | check("j", r#"fn foo(i<|> : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#); | 678 | check("j", r#"fn foo(i$0 : u32) -> u32 { i }"#, r#"fn foo(j : u32) -> u32 { j }"#); |
679 | } | 679 | } |
680 | 680 | ||
681 | #[test] | 681 | #[test] |
682 | fn test_rename_for_mut_param() { | 682 | fn test_rename_for_mut_param() { |
683 | check("j", r#"fn foo(mut i<|> : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#); | 683 | check("j", r#"fn foo(mut i$0 : u32) -> u32 { i }"#, r#"fn foo(mut j : u32) -> u32 { j }"#); |
684 | } | 684 | } |
685 | 685 | ||
686 | #[test] | 686 | #[test] |
@@ -688,7 +688,7 @@ fn main() { | |||
688 | check( | 688 | check( |
689 | "j", | 689 | "j", |
690 | r#" | 690 | r#" |
691 | struct Foo { i<|>: i32 } | 691 | struct Foo { i$0: i32 } |
692 | 692 | ||
693 | impl Foo { | 693 | impl Foo { |
694 | fn new(i: i32) -> Self { | 694 | fn new(i: i32) -> Self { |
@@ -714,7 +714,7 @@ impl Foo { | |||
714 | check( | 714 | check( |
715 | "j", | 715 | "j", |
716 | r#" | 716 | r#" |
717 | struct Foo { i<|>: i32 } | 717 | struct Foo { i$0: i32 } |
718 | 718 | ||
719 | impl Foo { | 719 | impl Foo { |
720 | fn new(i: i32) -> Self { | 720 | fn new(i: i32) -> Self { |
@@ -743,7 +743,7 @@ impl Foo { | |||
743 | struct Foo { i: i32 } | 743 | struct Foo { i: i32 } |
744 | 744 | ||
745 | impl Foo { | 745 | impl Foo { |
746 | fn new(i<|>: i32) -> Self { | 746 | fn new(i$0: i32) -> Self { |
747 | Self { i } | 747 | Self { i } |
748 | } | 748 | } |
749 | } | 749 | } |
@@ -765,7 +765,7 @@ impl Foo { | |||
765 | check( | 765 | check( |
766 | "j", | 766 | "j", |
767 | r#" | 767 | r#" |
768 | struct Foo { i<|>: i32 } | 768 | struct Foo { i$0: i32 } |
769 | struct Bar { i: i32 } | 769 | struct Bar { i: i32 } |
770 | 770 | ||
771 | impl Bar { | 771 | impl Bar { |
@@ -794,7 +794,7 @@ impl Bar { | |||
794 | r#" | 794 | r#" |
795 | struct Foo { i: i32 } | 795 | struct Foo { i: i32 } |
796 | 796 | ||
797 | fn baz(i<|>: i32) -> Self { | 797 | fn baz(i$0: i32) -> Self { |
798 | let x = Foo { i }; | 798 | let x = Foo { i }; |
799 | { | 799 | { |
800 | let i = 0; | 800 | let i = 0; |
@@ -825,7 +825,7 @@ fn baz(j: i32) -> Self { | |||
825 | mod bar; | 825 | mod bar; |
826 | 826 | ||
827 | //- /bar.rs | 827 | //- /bar.rs |
828 | mod foo<|>; | 828 | mod foo$0; |
829 | 829 | ||
830 | //- /bar/foo.rs | 830 | //- /bar/foo.rs |
831 | // empty | 831 | // empty |
@@ -883,7 +883,7 @@ fn main() {} | |||
883 | pub struct FooContent; | 883 | pub struct FooContent; |
884 | 884 | ||
885 | //- /bar.rs | 885 | //- /bar.rs |
886 | use crate::foo<|>::FooContent; | 886 | use crate::foo$0::FooContent; |
887 | "#, | 887 | "#, |
888 | expect![[r#" | 888 | expect![[r#" |
889 | RangeInfo { | 889 | RangeInfo { |
@@ -943,7 +943,7 @@ use crate::foo<|>::FooContent; | |||
943 | "foo2", | 943 | "foo2", |
944 | r#" | 944 | r#" |
945 | //- /lib.rs | 945 | //- /lib.rs |
946 | mod fo<|>o; | 946 | mod fo$0o; |
947 | //- /foo/mod.rs | 947 | //- /foo/mod.rs |
948 | // emtpy | 948 | // emtpy |
949 | "#, | 949 | "#, |
@@ -992,7 +992,7 @@ mod fo<|>o; | |||
992 | "bar", | 992 | "bar", |
993 | r#" | 993 | r#" |
994 | //- /lib.rs | 994 | //- /lib.rs |
995 | mod outer { mod fo<|>o; } | 995 | mod outer { mod fo$0o; } |
996 | 996 | ||
997 | //- /outer/foo.rs | 997 | //- /outer/foo.rs |
998 | // emtpy | 998 | // emtpy |
@@ -1041,7 +1041,7 @@ mod outer { mod fo<|>o; } | |||
1041 | check( | 1041 | check( |
1042 | "baz", | 1042 | "baz", |
1043 | r#" | 1043 | r#" |
1044 | mod <|>foo { pub fn bar() {} } | 1044 | mod $0foo { pub fn bar() {} } |
1045 | 1045 | ||
1046 | fn main() { foo::bar(); } | 1046 | fn main() { foo::bar(); } |
1047 | "#, | 1047 | "#, |
@@ -1065,7 +1065,7 @@ fn f() { | |||
1065 | } | 1065 | } |
1066 | 1066 | ||
1067 | //- /bar.rs | 1067 | //- /bar.rs |
1068 | pub mod foo<|>; | 1068 | pub mod foo$0; |
1069 | 1069 | ||
1070 | //- /bar/foo.rs | 1070 | //- /bar/foo.rs |
1071 | // pub fn fun() {} | 1071 | // pub fn fun() {} |
@@ -1128,7 +1128,7 @@ pub mod foo<|>; | |||
1128 | "Baz", | 1128 | "Baz", |
1129 | r#" | 1129 | r#" |
1130 | mod foo { | 1130 | mod foo { |
1131 | pub enum Foo { Bar<|> } | 1131 | pub enum Foo { Bar$0 } |
1132 | } | 1132 | } |
1133 | 1133 | ||
1134 | fn func(f: foo::Foo) { | 1134 | fn func(f: foo::Foo) { |
@@ -1157,7 +1157,7 @@ fn func(f: foo::Foo) { | |||
1157 | "baz", | 1157 | "baz", |
1158 | r#" | 1158 | r#" |
1159 | mod foo { | 1159 | mod foo { |
1160 | pub struct Foo { pub bar<|>: uint } | 1160 | pub struct Foo { pub bar$0: uint } |
1161 | } | 1161 | } |
1162 | 1162 | ||
1163 | fn foo(f: foo::Foo) { | 1163 | fn foo(f: foo::Foo) { |
@@ -1184,7 +1184,7 @@ fn foo(f: foo::Foo) { | |||
1184 | struct Foo { i: i32 } | 1184 | struct Foo { i: i32 } |
1185 | 1185 | ||
1186 | impl Foo { | 1186 | impl Foo { |
1187 | fn f(foo<|>: &mut Foo) -> i32 { | 1187 | fn f(foo$0: &mut Foo) -> i32 { |
1188 | foo.i | 1188 | foo.i |
1189 | } | 1189 | } |
1190 | } | 1190 | } |
@@ -1205,7 +1205,7 @@ impl Foo { | |||
1205 | struct Foo { i: i32 } | 1205 | struct Foo { i: i32 } |
1206 | 1206 | ||
1207 | impl Foo { | 1207 | impl Foo { |
1208 | fn f(foo<|>: Foo) -> i32 { | 1208 | fn f(foo$0: Foo) -> i32 { |
1209 | foo.i | 1209 | foo.i |
1210 | } | 1210 | } |
1211 | } | 1211 | } |
@@ -1229,7 +1229,7 @@ impl Foo { | |||
1229 | r#" | 1229 | r#" |
1230 | struct Foo { i: i32 } | 1230 | struct Foo { i: i32 } |
1231 | 1231 | ||
1232 | fn f(foo<|>: &mut Foo) -> i32 { | 1232 | fn f(foo$0: &mut Foo) -> i32 { |
1233 | foo.i | 1233 | foo.i |
1234 | } | 1234 | } |
1235 | "#, | 1235 | "#, |
@@ -1242,7 +1242,7 @@ struct Foo { i: i32 } | |||
1242 | struct Bar; | 1242 | struct Bar; |
1243 | 1243 | ||
1244 | impl Bar { | 1244 | impl Bar { |
1245 | fn f(foo<|>: &mut Foo) -> i32 { | 1245 | fn f(foo$0: &mut Foo) -> i32 { |
1246 | foo.i | 1246 | foo.i |
1247 | } | 1247 | } |
1248 | } | 1248 | } |
@@ -1258,7 +1258,7 @@ impl Bar { | |||
1258 | r#" | 1258 | r#" |
1259 | struct Foo { i: i32 } | 1259 | struct Foo { i: i32 } |
1260 | impl Foo { | 1260 | impl Foo { |
1261 | fn f(x: (), foo<|>: &mut Foo) -> i32 { | 1261 | fn f(x: (), foo$0: &mut Foo) -> i32 { |
1262 | foo.i | 1262 | foo.i |
1263 | } | 1263 | } |
1264 | } | 1264 | } |
@@ -1274,7 +1274,7 @@ impl Foo { | |||
1274 | r#" | 1274 | r#" |
1275 | struct Foo { i: i32 } | 1275 | struct Foo { i: i32 } |
1276 | impl &Foo { | 1276 | impl &Foo { |
1277 | fn f(foo<|>: &Foo) -> i32 { | 1277 | fn f(foo$0: &Foo) -> i32 { |
1278 | foo.i | 1278 | foo.i |
1279 | } | 1279 | } |
1280 | } | 1280 | } |
@@ -1298,7 +1298,7 @@ impl &Foo { | |||
1298 | struct Foo { i: i32 } | 1298 | struct Foo { i: i32 } |
1299 | 1299 | ||
1300 | impl Foo { | 1300 | impl Foo { |
1301 | fn f(&mut <|>self) -> i32 { | 1301 | fn f(&mut $0self) -> i32 { |
1302 | self.i | 1302 | self.i |
1303 | } | 1303 | } |
1304 | } | 1304 | } |
@@ -1323,7 +1323,7 @@ impl Foo { | |||
1323 | struct Foo { i: i32 } | 1323 | struct Foo { i: i32 } |
1324 | 1324 | ||
1325 | impl Foo { | 1325 | impl Foo { |
1326 | fn f(<|>self) -> i32 { | 1326 | fn f($0self) -> i32 { |
1327 | self.i | 1327 | self.i |
1328 | } | 1328 | } |
1329 | } | 1329 | } |
@@ -1350,7 +1350,7 @@ struct Foo { i: i32 } | |||
1350 | impl Foo { | 1350 | impl Foo { |
1351 | fn f(&self) -> i32 { | 1351 | fn f(&self) -> i32 { |
1352 | let self_var = 1; | 1352 | let self_var = 1; |
1353 | self<|>.i | 1353 | self$0.i |
1354 | } | 1354 | } |
1355 | } | 1355 | } |
1356 | "#, | 1356 | "#, |
@@ -1373,7 +1373,7 @@ impl Foo { | |||
1373 | check( | 1373 | check( |
1374 | "bar", | 1374 | "bar", |
1375 | r#" | 1375 | r#" |
1376 | struct Foo { i<|>: i32 } | 1376 | struct Foo { i$0: i32 } |
1377 | 1377 | ||
1378 | fn foo(bar: i32) -> Foo { | 1378 | fn foo(bar: i32) -> Foo { |
1379 | Foo { i: bar } | 1379 | Foo { i: bar } |
@@ -1394,7 +1394,7 @@ fn foo(bar: i32) -> Foo { | |||
1394 | check( | 1394 | check( |
1395 | "baz", | 1395 | "baz", |
1396 | r#" | 1396 | r#" |
1397 | struct Foo { i<|>: i32 } | 1397 | struct Foo { i$0: i32 } |
1398 | 1398 | ||
1399 | fn foo(foo: Foo) { | 1399 | fn foo(foo: Foo) { |
1400 | let Foo { i: baz } = foo; | 1400 | let Foo { i: baz } = foo; |
@@ -1433,7 +1433,7 @@ struct Foo { | |||
1433 | 1433 | ||
1434 | fn foo(foo: Foo) { | 1434 | fn foo(foo: Foo) { |
1435 | let Foo { i: b } = foo; | 1435 | let Foo { i: b } = foo; |
1436 | let _ = b<|>; | 1436 | let _ = b$0; |
1437 | } | 1437 | } |
1438 | "#, | 1438 | "#, |
1439 | expected_fixture, | 1439 | expected_fixture, |
@@ -1447,7 +1447,7 @@ struct Foo { | |||
1447 | 1447 | ||
1448 | fn foo(foo: Foo) { | 1448 | fn foo(foo: Foo) { |
1449 | let Foo { i } = foo; | 1449 | let Foo { i } = foo; |
1450 | let _ = i<|>; | 1450 | let _ = i$0; |
1451 | } | 1451 | } |
1452 | "#, | 1452 | "#, |
1453 | expected_fixture, | 1453 | expected_fixture, |
@@ -1464,7 +1464,7 @@ struct Foo { | |||
1464 | } | 1464 | } |
1465 | 1465 | ||
1466 | fn foo(Foo { i }: foo) -> i32 { | 1466 | fn foo(Foo { i }: foo) -> i32 { |
1467 | i<|> | 1467 | i$0 |
1468 | } | 1468 | } |
1469 | "#, | 1469 | "#, |
1470 | r#" | 1470 | r#" |
@@ -1488,7 +1488,7 @@ trait Foo<'a> { | |||
1488 | fn foo() -> &'a (); | 1488 | fn foo() -> &'a (); |
1489 | } | 1489 | } |
1490 | impl<'a> Foo<'a> for &'a () { | 1490 | impl<'a> Foo<'a> for &'a () { |
1491 | fn foo() -> &'a<|> () { | 1491 | fn foo() -> &'a$0 () { |
1492 | unimplemented!() | 1492 | unimplemented!() |
1493 | } | 1493 | } |
1494 | } | 1494 | } |
@@ -1520,7 +1520,7 @@ fn main() { | |||
1520 | let test_variable = CustomOption::Some(22); | 1520 | let test_variable = CustomOption::Some(22); |
1521 | 1521 | ||
1522 | match test_variable { | 1522 | match test_variable { |
1523 | CustomOption::Some(foo<|>) if foo == 11 => {} | 1523 | CustomOption::Some(foo$0) if foo == 11 => {} |
1524 | _ => (), | 1524 | _ => (), |
1525 | } | 1525 | } |
1526 | }"#, | 1526 | }"#, |
@@ -1549,7 +1549,7 @@ fn main() { | |||
1549 | fn foo<'a>() -> &'a () { | 1549 | fn foo<'a>() -> &'a () { |
1550 | 'a: { | 1550 | 'a: { |
1551 | 'b: loop { | 1551 | 'b: loop { |
1552 | break 'a<|>; | 1552 | break 'a$0; |
1553 | } | 1553 | } |
1554 | } | 1554 | } |
1555 | } | 1555 | } |
diff --git a/crates/ide/src/runnables.rs b/crates/ide/src/runnables.rs index f4030f3ef..557563d7e 100644 --- a/crates/ide/src/runnables.rs +++ b/crates/ide/src/runnables.rs | |||
@@ -329,7 +329,7 @@ mod tests { | |||
329 | check( | 329 | check( |
330 | r#" | 330 | r#" |
331 | //- /lib.rs | 331 | //- /lib.rs |
332 | <|> | 332 | $0 |
333 | fn main() {} | 333 | fn main() {} |
334 | 334 | ||
335 | #[test] | 335 | #[test] |
@@ -425,7 +425,7 @@ fn bench() {} | |||
425 | check( | 425 | check( |
426 | r#" | 426 | r#" |
427 | //- /lib.rs | 427 | //- /lib.rs |
428 | <|> | 428 | $0 |
429 | fn main() {} | 429 | fn main() {} |
430 | 430 | ||
431 | /// ``` | 431 | /// ``` |
@@ -573,7 +573,7 @@ struct StructWithRunnable(String); | |||
573 | check( | 573 | check( |
574 | r#" | 574 | r#" |
575 | //- /lib.rs | 575 | //- /lib.rs |
576 | <|> | 576 | $0 |
577 | fn main() {} | 577 | fn main() {} |
578 | 578 | ||
579 | struct Data; | 579 | struct Data; |
@@ -625,7 +625,7 @@ impl Data { | |||
625 | check( | 625 | check( |
626 | r#" | 626 | r#" |
627 | //- /lib.rs | 627 | //- /lib.rs |
628 | <|> | 628 | $0 |
629 | mod test_mod { | 629 | mod test_mod { |
630 | #[test] | 630 | #[test] |
631 | fn test_foo1() {} | 631 | fn test_foo1() {} |
@@ -679,7 +679,7 @@ mod test_mod { | |||
679 | check( | 679 | check( |
680 | r#" | 680 | r#" |
681 | //- /lib.rs | 681 | //- /lib.rs |
682 | <|> | 682 | $0 |
683 | mod root_tests { | 683 | mod root_tests { |
684 | mod nested_tests_0 { | 684 | mod nested_tests_0 { |
685 | mod nested_tests_1 { | 685 | mod nested_tests_1 { |
@@ -819,7 +819,7 @@ mod root_tests { | |||
819 | check( | 819 | check( |
820 | r#" | 820 | r#" |
821 | //- /lib.rs crate:foo cfg:feature=foo | 821 | //- /lib.rs crate:foo cfg:feature=foo |
822 | <|> | 822 | $0 |
823 | #[test] | 823 | #[test] |
824 | #[cfg(feature = "foo")] | 824 | #[cfg(feature = "foo")] |
825 | fn test_foo1() {} | 825 | fn test_foo1() {} |
@@ -864,7 +864,7 @@ fn test_foo1() {} | |||
864 | check( | 864 | check( |
865 | r#" | 865 | r#" |
866 | //- /lib.rs crate:foo cfg:feature=foo,feature=bar | 866 | //- /lib.rs crate:foo cfg:feature=foo,feature=bar |
867 | <|> | 867 | $0 |
868 | #[test] | 868 | #[test] |
869 | #[cfg(all(feature = "foo", feature = "bar"))] | 869 | #[cfg(all(feature = "foo", feature = "bar"))] |
870 | fn test_foo1() {} | 870 | fn test_foo1() {} |
@@ -919,7 +919,7 @@ fn test_foo1() {} | |||
919 | check( | 919 | check( |
920 | r#" | 920 | r#" |
921 | //- /lib.rs | 921 | //- /lib.rs |
922 | <|> | 922 | $0 |
923 | mod test_mod { | 923 | mod test_mod { |
924 | fn foo1() {} | 924 | fn foo1() {} |
925 | } | 925 | } |
@@ -938,7 +938,7 @@ mod test_mod { | |||
938 | //- /lib.rs | 938 | //- /lib.rs |
939 | mod foo; | 939 | mod foo; |
940 | //- /foo.rs | 940 | //- /foo.rs |
941 | struct Foo;<|> | 941 | struct Foo;$0 |
942 | impl Foo { | 942 | impl Foo { |
943 | /// ``` | 943 | /// ``` |
944 | /// let x = 5; | 944 | /// let x = 5; |
diff --git a/crates/ide/src/syntax_tree.rs b/crates/ide/src/syntax_tree.rs index 6dd05c05d..1f26f8043 100644 --- a/crates/ide/src/syntax_tree.rs +++ b/crates/ide/src/syntax_tree.rs | |||
@@ -85,7 +85,7 @@ fn syntax_tree_for_token(node: &SyntaxToken, text_range: TextRange) -> Option<St | |||
85 | .trim_end_matches('"') | 85 | .trim_end_matches('"') |
86 | .trim() | 86 | .trim() |
87 | // Remove custom markers | 87 | // Remove custom markers |
88 | .replace("<|>", ""); | 88 | .replace("$0", ""); |
89 | 89 | ||
90 | let parsed = SourceFile::parse(&text); | 90 | let parsed = SourceFile::parse(&text); |
91 | 91 | ||
@@ -182,7 +182,7 @@ [email protected] | |||
182 | 182 | ||
183 | #[test] | 183 | #[test] |
184 | fn test_syntax_tree_with_range() { | 184 | fn test_syntax_tree_with_range() { |
185 | let (analysis, range) = fixture::range(r#"<|>fn foo() {}<|>"#.trim()); | 185 | let (analysis, range) = fixture::range(r#"$0fn foo() {}$0"#.trim()); |
186 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); | 186 | let syn = analysis.syntax_tree(range.file_id, Some(range.range)).unwrap(); |
187 | 187 | ||
188 | assert_eq_text!( | 188 | assert_eq_text!( |
@@ -206,10 +206,10 @@ [email protected] | |||
206 | 206 | ||
207 | let (analysis, range) = fixture::range( | 207 | let (analysis, range) = fixture::range( |
208 | r#"fn test() { | 208 | r#"fn test() { |
209 | <|>assert!(" | 209 | $0assert!(" |
210 | fn foo() { | 210 | fn foo() { |
211 | } | 211 | } |
212 | ", "");<|> | 212 | ", "");$0 |
213 | }"# | 213 | }"# |
214 | .trim(), | 214 | .trim(), |
215 | ); | 215 | ); |
@@ -243,8 +243,8 @@ [email protected] | |||
243 | let (analysis, range) = fixture::range( | 243 | let (analysis, range) = fixture::range( |
244 | r#"fn test() { | 244 | r#"fn test() { |
245 | assert!(" | 245 | assert!(" |
246 | <|>fn foo() { | 246 | $0fn foo() { |
247 | }<|> | 247 | }$0 |
248 | fn bar() { | 248 | fn bar() { |
249 | } | 249 | } |
250 | ", ""); | 250 | ", ""); |
@@ -277,8 +277,8 @@ [email protected] | |||
277 | let (analysis, range) = fixture::range( | 277 | let (analysis, range) = fixture::range( |
278 | r###"fn test() { | 278 | r###"fn test() { |
279 | assert!(r#" | 279 | assert!(r#" |
280 | <|>fn foo() { | 280 | $0fn foo() { |
281 | }<|> | 281 | }$0 |
282 | fn bar() { | 282 | fn bar() { |
283 | } | 283 | } |
284 | "#, ""); | 284 | "#, ""); |
@@ -310,11 +310,11 @@ [email protected] | |||
310 | // With a raw string | 310 | // With a raw string |
311 | let (analysis, range) = fixture::range( | 311 | let (analysis, range) = fixture::range( |
312 | r###"fn test() { | 312 | r###"fn test() { |
313 | assert!(r<|>#" | 313 | assert!(r$0#" |
314 | fn foo() { | 314 | fn foo() { |
315 | } | 315 | } |
316 | fn bar() { | 316 | fn bar() { |
317 | }"<|>#, ""); | 317 | }"$0#, ""); |
318 | }"### | 318 | }"### |
319 | .trim(), | 319 | .trim(), |
320 | ); | 320 | ); |
diff --git a/crates/ide/src/typing.rs b/crates/ide/src/typing.rs index 43458a3a2..88c905003 100644 --- a/crates/ide/src/typing.rs +++ b/crates/ide/src/typing.rs | |||
@@ -170,7 +170,7 @@ mod tests { | |||
170 | fn test_on_eq_typed() { | 170 | fn test_on_eq_typed() { |
171 | // do_check(r" | 171 | // do_check(r" |
172 | // fn foo() { | 172 | // fn foo() { |
173 | // let foo =<|> | 173 | // let foo =$0 |
174 | // } | 174 | // } |
175 | // ", r" | 175 | // ", r" |
176 | // fn foo() { | 176 | // fn foo() { |
@@ -181,7 +181,7 @@ mod tests { | |||
181 | '=', | 181 | '=', |
182 | r" | 182 | r" |
183 | fn foo() { | 183 | fn foo() { |
184 | let foo <|> 1 + 1 | 184 | let foo $0 1 + 1 |
185 | } | 185 | } |
186 | ", | 186 | ", |
187 | r" | 187 | r" |
@@ -192,7 +192,7 @@ fn foo() { | |||
192 | ); | 192 | ); |
193 | // do_check(r" | 193 | // do_check(r" |
194 | // fn foo() { | 194 | // fn foo() { |
195 | // let foo =<|> | 195 | // let foo =$0 |
196 | // let bar = 1; | 196 | // let bar = 1; |
197 | // } | 197 | // } |
198 | // ", r" | 198 | // ", r" |
@@ -210,7 +210,7 @@ fn foo() { | |||
210 | r" | 210 | r" |
211 | fn main() { | 211 | fn main() { |
212 | xs.foo() | 212 | xs.foo() |
213 | <|> | 213 | $0 |
214 | } | 214 | } |
215 | ", | 215 | ", |
216 | r" | 216 | r" |
@@ -225,7 +225,7 @@ fn foo() { | |||
225 | r" | 225 | r" |
226 | fn main() { | 226 | fn main() { |
227 | xs.foo() | 227 | xs.foo() |
228 | <|> | 228 | $0 |
229 | } | 229 | } |
230 | ", | 230 | ", |
231 | ) | 231 | ) |
@@ -238,7 +238,7 @@ fn foo() { | |||
238 | r" | 238 | r" |
239 | fn main() { | 239 | fn main() { |
240 | xs.foo() | 240 | xs.foo() |
241 | <|>; | 241 | $0; |
242 | } | 242 | } |
243 | ", | 243 | ", |
244 | r" | 244 | r" |
@@ -253,7 +253,7 @@ fn foo() { | |||
253 | r" | 253 | r" |
254 | fn main() { | 254 | fn main() { |
255 | xs.foo() | 255 | xs.foo() |
256 | <|>; | 256 | $0; |
257 | } | 257 | } |
258 | ", | 258 | ", |
259 | ) | 259 | ) |
@@ -266,7 +266,7 @@ fn foo() { | |||
266 | r#" | 266 | r#" |
267 | fn main() { | 267 | fn main() { |
268 | let _ = foo | 268 | let _ = foo |
269 | <|> | 269 | $0 |
270 | bar() | 270 | bar() |
271 | } | 271 | } |
272 | "#, | 272 | "#, |
@@ -288,7 +288,7 @@ fn main() { | |||
288 | fn main() { | 288 | fn main() { |
289 | xs.foo() | 289 | xs.foo() |
290 | .first() | 290 | .first() |
291 | <|> | 291 | $0 |
292 | } | 292 | } |
293 | ", | 293 | ", |
294 | r" | 294 | r" |
@@ -305,7 +305,7 @@ fn main() { | |||
305 | fn main() { | 305 | fn main() { |
306 | xs.foo() | 306 | xs.foo() |
307 | .first() | 307 | .first() |
308 | <|> | 308 | $0 |
309 | } | 309 | } |
310 | ", | 310 | ", |
311 | ); | 311 | ); |
@@ -318,7 +318,7 @@ fn main() { | |||
318 | r" | 318 | r" |
319 | fn source_impl() { | 319 | fn source_impl() { |
320 | let var = enum_defvariant_list().unwrap() | 320 | let var = enum_defvariant_list().unwrap() |
321 | <|> | 321 | $0 |
322 | .nth(92) | 322 | .nth(92) |
323 | .unwrap(); | 323 | .unwrap(); |
324 | } | 324 | } |
@@ -337,7 +337,7 @@ fn main() { | |||
337 | r" | 337 | r" |
338 | fn source_impl() { | 338 | fn source_impl() { |
339 | let var = enum_defvariant_list().unwrap() | 339 | let var = enum_defvariant_list().unwrap() |
340 | <|> | 340 | $0 |
341 | .nth(92) | 341 | .nth(92) |
342 | .unwrap(); | 342 | .unwrap(); |
343 | } | 343 | } |
@@ -351,7 +351,7 @@ fn main() { | |||
351 | '.', | 351 | '.', |
352 | r" | 352 | r" |
353 | fn main() { | 353 | fn main() { |
354 | <|> | 354 | $0 |
355 | } | 355 | } |
356 | ", | 356 | ", |
357 | ); | 357 | ); |
@@ -359,7 +359,7 @@ fn main() { | |||
359 | '.', | 359 | '.', |
360 | r" | 360 | r" |
361 | fn main() { | 361 | fn main() { |
362 | <|> | 362 | $0 |
363 | } | 363 | } |
364 | ", | 364 | ", |
365 | ); | 365 | ); |
@@ -367,6 +367,6 @@ fn main() { | |||
367 | 367 | ||
368 | #[test] | 368 | #[test] |
369 | fn adds_space_after_return_type() { | 369 | fn adds_space_after_return_type() { |
370 | type_char('>', "fn foo() -<|>{ 92 }", "fn foo() -> { 92 }") | 370 | type_char('>', "fn foo() -$0{ 92 }", "fn foo() -> { 92 }") |
371 | } | 371 | } |
372 | } | 372 | } |
diff --git a/crates/ide/src/typing/on_enter.rs b/crates/ide/src/typing/on_enter.rs index f4ea30352..63cd51b69 100644 --- a/crates/ide/src/typing/on_enter.rs +++ b/crates/ide/src/typing/on_enter.rs | |||
@@ -136,7 +136,7 @@ mod tests { | |||
136 | fn continues_doc_comment() { | 136 | fn continues_doc_comment() { |
137 | do_check( | 137 | do_check( |
138 | r" | 138 | r" |
139 | /// Some docs<|> | 139 | /// Some docs$0 |
140 | fn foo() { | 140 | fn foo() { |
141 | } | 141 | } |
142 | ", | 142 | ", |
@@ -151,7 +151,7 @@ fn foo() { | |||
151 | do_check( | 151 | do_check( |
152 | r" | 152 | r" |
153 | impl S { | 153 | impl S { |
154 | /// Some<|> docs. | 154 | /// Some$0 docs. |
155 | fn foo() {} | 155 | fn foo() {} |
156 | } | 156 | } |
157 | ", | 157 | ", |
@@ -166,7 +166,7 @@ impl S { | |||
166 | 166 | ||
167 | do_check( | 167 | do_check( |
168 | r" | 168 | r" |
169 | ///<|> Some docs | 169 | ///$0 Some docs |
170 | fn foo() { | 170 | fn foo() { |
171 | } | 171 | } |
172 | ", | 172 | ", |
@@ -181,7 +181,7 @@ fn foo() { | |||
181 | 181 | ||
182 | #[test] | 182 | #[test] |
183 | fn does_not_continue_before_doc_comment() { | 183 | fn does_not_continue_before_doc_comment() { |
184 | do_check_noop(r"<|>//! docz"); | 184 | do_check_noop(r"$0//! docz"); |
185 | } | 185 | } |
186 | 186 | ||
187 | #[test] | 187 | #[test] |
@@ -189,7 +189,7 @@ fn foo() { | |||
189 | do_check( | 189 | do_check( |
190 | r" | 190 | r" |
191 | fn main() { | 191 | fn main() { |
192 | // Fix<|> me | 192 | // Fix$0 me |
193 | let x = 1 + 1; | 193 | let x = 1 + 1; |
194 | } | 194 | } |
195 | ", | 195 | ", |
@@ -208,7 +208,7 @@ fn main() { | |||
208 | do_check( | 208 | do_check( |
209 | r" | 209 | r" |
210 | fn main() { | 210 | fn main() { |
211 | // Fix<|> | 211 | // Fix$0 |
212 | // me | 212 | // me |
213 | let x = 1 + 1; | 213 | let x = 1 + 1; |
214 | } | 214 | } |
@@ -229,7 +229,7 @@ fn main() { | |||
229 | do_check_noop( | 229 | do_check_noop( |
230 | r" | 230 | r" |
231 | fn main() { | 231 | fn main() { |
232 | // Fix me<|> | 232 | // Fix me$0 |
233 | let x = 1 + 1; | 233 | let x = 1 + 1; |
234 | } | 234 | } |
235 | ", | 235 | ", |
@@ -242,7 +242,7 @@ fn main() { | |||
242 | do_check( | 242 | do_check( |
243 | r#" | 243 | r#" |
244 | fn main() { | 244 | fn main() { |
245 | // Fix me <|> | 245 | // Fix me $0 |
246 | let x = 1 + 1; | 246 | let x = 1 + 1; |
247 | } | 247 | } |
248 | "#, | 248 | "#, |
@@ -261,7 +261,7 @@ fn main() { | |||
261 | do_check( | 261 | do_check( |
262 | " | 262 | " |
263 | fn main() { | 263 | fn main() { |
264 | // Fix me \t\t <|> | 264 | // Fix me \t\t $0 |
265 | let x = 1 + 1; | 265 | let x = 1 + 1; |
266 | } | 266 | } |
267 | ", | 267 | ", |
diff --git a/crates/ide_db/src/call_info/tests.rs b/crates/ide_db/src/call_info/tests.rs index 9335aeaa5..c714cf280 100644 --- a/crates/ide_db/src/call_info/tests.rs +++ b/crates/ide_db/src/call_info/tests.rs | |||
@@ -3,12 +3,12 @@ use base_db::{fixture::ChangeFixture, FilePosition}; | |||
3 | use expect_test::{expect, Expect}; | 3 | use expect_test::{expect, Expect}; |
4 | use test_utils::{mark, RangeOrOffset}; | 4 | use test_utils::{mark, RangeOrOffset}; |
5 | 5 | ||
6 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 6 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
7 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 7 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
8 | let change_fixture = ChangeFixture::parse(ra_fixture); | 8 | let change_fixture = ChangeFixture::parse(ra_fixture); |
9 | let mut database = RootDatabase::default(); | 9 | let mut database = RootDatabase::default(); |
10 | database.apply_change(change_fixture.change); | 10 | database.apply_change(change_fixture.change); |
11 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 11 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
12 | let offset = match range_or_offset { | 12 | let offset = match range_or_offset { |
13 | RangeOrOffset::Range(_) => panic!(), | 13 | RangeOrOffset::Range(_) => panic!(), |
14 | RangeOrOffset::Offset(it) => it, | 14 | RangeOrOffset::Offset(it) => it, |
@@ -49,7 +49,7 @@ fn test_fn_signature_two_args() { | |||
49 | check( | 49 | check( |
50 | r#" | 50 | r#" |
51 | fn foo(x: u32, y: u32) -> u32 {x + y} | 51 | fn foo(x: u32, y: u32) -> u32 {x + y} |
52 | fn bar() { foo(<|>3, ); } | 52 | fn bar() { foo($03, ); } |
53 | "#, | 53 | "#, |
54 | expect![[r#" | 54 | expect![[r#" |
55 | fn foo(x: u32, y: u32) -> u32 | 55 | fn foo(x: u32, y: u32) -> u32 |
@@ -59,7 +59,7 @@ fn bar() { foo(<|>3, ); } | |||
59 | check( | 59 | check( |
60 | r#" | 60 | r#" |
61 | fn foo(x: u32, y: u32) -> u32 {x + y} | 61 | fn foo(x: u32, y: u32) -> u32 {x + y} |
62 | fn bar() { foo(3<|>, ); } | 62 | fn bar() { foo(3$0, ); } |
63 | "#, | 63 | "#, |
64 | expect![[r#" | 64 | expect![[r#" |
65 | fn foo(x: u32, y: u32) -> u32 | 65 | fn foo(x: u32, y: u32) -> u32 |
@@ -69,7 +69,7 @@ fn bar() { foo(3<|>, ); } | |||
69 | check( | 69 | check( |
70 | r#" | 70 | r#" |
71 | fn foo(x: u32, y: u32) -> u32 {x + y} | 71 | fn foo(x: u32, y: u32) -> u32 {x + y} |
72 | fn bar() { foo(3,<|> ); } | 72 | fn bar() { foo(3,$0 ); } |
73 | "#, | 73 | "#, |
74 | expect![[r#" | 74 | expect![[r#" |
75 | fn foo(x: u32, y: u32) -> u32 | 75 | fn foo(x: u32, y: u32) -> u32 |
@@ -79,7 +79,7 @@ fn bar() { foo(3,<|> ); } | |||
79 | check( | 79 | check( |
80 | r#" | 80 | r#" |
81 | fn foo(x: u32, y: u32) -> u32 {x + y} | 81 | fn foo(x: u32, y: u32) -> u32 {x + y} |
82 | fn bar() { foo(3, <|>); } | 82 | fn bar() { foo(3, $0); } |
83 | "#, | 83 | "#, |
84 | expect![[r#" | 84 | expect![[r#" |
85 | fn foo(x: u32, y: u32) -> u32 | 85 | fn foo(x: u32, y: u32) -> u32 |
@@ -93,7 +93,7 @@ fn test_fn_signature_two_args_empty() { | |||
93 | check( | 93 | check( |
94 | r#" | 94 | r#" |
95 | fn foo(x: u32, y: u32) -> u32 {x + y} | 95 | fn foo(x: u32, y: u32) -> u32 {x + y} |
96 | fn bar() { foo(<|>); } | 96 | fn bar() { foo($0); } |
97 | "#, | 97 | "#, |
98 | expect![[r#" | 98 | expect![[r#" |
99 | fn foo(x: u32, y: u32) -> u32 | 99 | fn foo(x: u32, y: u32) -> u32 |
@@ -110,7 +110,7 @@ fn foo<T, U: Copy + Display>(x: T, y: U) -> u32 | |||
110 | where T: Copy + Display, U: Debug | 110 | where T: Copy + Display, U: Debug |
111 | { x + y } | 111 | { x + y } |
112 | 112 | ||
113 | fn bar() { foo(<|>3, ); } | 113 | fn bar() { foo($03, ); } |
114 | "#, | 114 | "#, |
115 | expect![[r#" | 115 | expect![[r#" |
116 | fn foo(x: i32, y: {unknown}) -> u32 | 116 | fn foo(x: i32, y: {unknown}) -> u32 |
@@ -124,7 +124,7 @@ fn test_fn_signature_no_params() { | |||
124 | check( | 124 | check( |
125 | r#" | 125 | r#" |
126 | fn foo<T>() -> T where T: Copy + Display {} | 126 | fn foo<T>() -> T where T: Copy + Display {} |
127 | fn bar() { foo(<|>); } | 127 | fn bar() { foo($0); } |
128 | "#, | 128 | "#, |
129 | expect![[r#" | 129 | expect![[r#" |
130 | fn foo() -> {unknown} | 130 | fn foo() -> {unknown} |
@@ -140,7 +140,7 @@ fn test_fn_signature_for_impl() { | |||
140 | struct F; | 140 | struct F; |
141 | impl F { pub fn new() { } } | 141 | impl F { pub fn new() { } } |
142 | fn bar() { | 142 | fn bar() { |
143 | let _ : F = F::new(<|>); | 143 | let _ : F = F::new($0); |
144 | } | 144 | } |
145 | "#, | 145 | "#, |
146 | expect![[r#" | 146 | expect![[r#" |
@@ -159,7 +159,7 @@ impl S { pub fn do_it(&self) {} } | |||
159 | 159 | ||
160 | fn bar() { | 160 | fn bar() { |
161 | let s: S = S; | 161 | let s: S = S; |
162 | s.do_it(<|>); | 162 | s.do_it($0); |
163 | } | 163 | } |
164 | "#, | 164 | "#, |
165 | expect![[r#" | 165 | expect![[r#" |
@@ -178,7 +178,7 @@ impl S { | |||
178 | fn foo(&self, x: i32) {} | 178 | fn foo(&self, x: i32) {} |
179 | } | 179 | } |
180 | 180 | ||
181 | fn main() { S.foo(<|>); } | 181 | fn main() { S.foo($0); } |
182 | "#, | 182 | "#, |
183 | expect![[r#" | 183 | expect![[r#" |
184 | fn foo(&self, x: i32) | 184 | fn foo(&self, x: i32) |
@@ -196,7 +196,7 @@ impl S { | |||
196 | fn foo(&self, x: i32) {} | 196 | fn foo(&self, x: i32) {} |
197 | } | 197 | } |
198 | 198 | ||
199 | fn main() { S::foo(<|>); } | 199 | fn main() { S::foo($0); } |
200 | "#, | 200 | "#, |
201 | expect![[r#" | 201 | expect![[r#" |
202 | fn foo(self: &S, x: i32) | 202 | fn foo(self: &S, x: i32) |
@@ -216,7 +216,7 @@ fn foo(j: u32) -> u32 { | |||
216 | } | 216 | } |
217 | 217 | ||
218 | fn bar() { | 218 | fn bar() { |
219 | let _ = foo(<|>); | 219 | let _ = foo($0); |
220 | } | 220 | } |
221 | "#, | 221 | "#, |
222 | expect![[r#" | 222 | expect![[r#" |
@@ -246,7 +246,7 @@ pub fn add_one(x: i32) -> i32 { | |||
246 | } | 246 | } |
247 | 247 | ||
248 | pub fn do() { | 248 | pub fn do() { |
249 | add_one(<|> | 249 | add_one($0 |
250 | }"#, | 250 | }"#, |
251 | expect![[r##" | 251 | expect![[r##" |
252 | Adds one to the number given. | 252 | Adds one to the number given. |
@@ -287,7 +287,7 @@ impl addr { | |||
287 | 287 | ||
288 | pub fn do_it() { | 288 | pub fn do_it() { |
289 | addr {}; | 289 | addr {}; |
290 | addr::add_one(<|>); | 290 | addr::add_one($0); |
291 | } | 291 | } |
292 | "#, | 292 | "#, |
293 | expect![[r##" | 293 | expect![[r##" |
@@ -331,7 +331,7 @@ impl<E> WriteHandler<E> { | |||
331 | } | 331 | } |
332 | 332 | ||
333 | pub fn foo(mut r: WriteHandler<()>) { | 333 | pub fn foo(mut r: WriteHandler<()>) { |
334 | r.finished(<|>); | 334 | r.finished($0); |
335 | } | 335 | } |
336 | "#, | 336 | "#, |
337 | expect![[r#" | 337 | expect![[r#" |
@@ -351,7 +351,7 @@ fn call_info_bad_offset() { | |||
351 | check( | 351 | check( |
352 | r#" | 352 | r#" |
353 | fn foo(x: u32, y: u32) -> u32 {x + y} | 353 | fn foo(x: u32, y: u32) -> u32 {x + y} |
354 | fn bar() { foo <|> (3, ); } | 354 | fn bar() { foo $0 (3, ); } |
355 | "#, | 355 | "#, |
356 | expect![[""]], | 356 | expect![[""]], |
357 | ); | 357 | ); |
@@ -368,7 +368,7 @@ fn bar(_: u32) { } | |||
368 | 368 | ||
369 | fn main() { | 369 | fn main() { |
370 | let foo = Foo; | 370 | let foo = Foo; |
371 | std::thread::spawn(move || foo.bar(<|>)); | 371 | std::thread::spawn(move || foo.bar($0)); |
372 | } | 372 | } |
373 | "#, | 373 | "#, |
374 | expect![[r#" | 374 | expect![[r#" |
@@ -385,7 +385,7 @@ fn works_for_tuple_structs() { | |||
385 | /// A cool tuple struct | 385 | /// A cool tuple struct |
386 | struct S(u32, i32); | 386 | struct S(u32, i32); |
387 | fn main() { | 387 | fn main() { |
388 | let s = S(0, <|>); | 388 | let s = S(0, $0); |
389 | } | 389 | } |
390 | "#, | 390 | "#, |
391 | expect![[r#" | 391 | expect![[r#" |
@@ -403,7 +403,7 @@ fn generic_struct() { | |||
403 | r#" | 403 | r#" |
404 | struct S<T>(T); | 404 | struct S<T>(T); |
405 | fn main() { | 405 | fn main() { |
406 | let s = S(<|>); | 406 | let s = S($0); |
407 | } | 407 | } |
408 | "#, | 408 | "#, |
409 | expect![[r#" | 409 | expect![[r#" |
@@ -427,7 +427,7 @@ enum E { | |||
427 | } | 427 | } |
428 | 428 | ||
429 | fn main() { | 429 | fn main() { |
430 | let a = E::A(<|>); | 430 | let a = E::A($0); |
431 | } | 431 | } |
432 | "#, | 432 | "#, |
433 | expect![[r#" | 433 | expect![[r#" |
@@ -445,7 +445,7 @@ fn cant_call_struct_record() { | |||
445 | r#" | 445 | r#" |
446 | struct S { x: u32, y: i32 } | 446 | struct S { x: u32, y: i32 } |
447 | fn main() { | 447 | fn main() { |
448 | let s = S(<|>); | 448 | let s = S($0); |
449 | } | 449 | } |
450 | "#, | 450 | "#, |
451 | expect![[""]], | 451 | expect![[""]], |
@@ -466,7 +466,7 @@ enum E { | |||
466 | } | 466 | } |
467 | 467 | ||
468 | fn main() { | 468 | fn main() { |
469 | let a = E::C(<|>); | 469 | let a = E::C($0); |
470 | } | 470 | } |
471 | "#, | 471 | "#, |
472 | expect![[""]], | 472 | expect![[""]], |
@@ -480,7 +480,7 @@ fn fn_signature_for_call_in_macro() { | |||
480 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } | 480 | macro_rules! id { ($($tt:tt)*) => { $($tt)* } } |
481 | fn foo() { } | 481 | fn foo() { } |
482 | id! { | 482 | id! { |
483 | fn bar() { foo(<|>); } | 483 | fn bar() { foo($0); } |
484 | } | 484 | } |
485 | "#, | 485 | "#, |
486 | expect![[r#" | 486 | expect![[r#" |
@@ -497,7 +497,7 @@ fn call_info_for_lambdas() { | |||
497 | struct S; | 497 | struct S; |
498 | fn foo(s: S) -> i32 { 92 } | 498 | fn foo(s: S) -> i32 { 92 } |
499 | fn main() { | 499 | fn main() { |
500 | (|s| foo(s))(<|>) | 500 | (|s| foo(s))($0) |
501 | } | 501 | } |
502 | "#, | 502 | "#, |
503 | expect![[r#" | 503 | expect![[r#" |
@@ -512,7 +512,7 @@ fn call_info_for_fn_ptr() { | |||
512 | check( | 512 | check( |
513 | r#" | 513 | r#" |
514 | fn main(f: fn(i32, f64) -> char) { | 514 | fn main(f: fn(i32, f64) -> char) { |
515 | f(0, <|>) | 515 | f(0, $0) |
516 | } | 516 | } |
517 | "#, | 517 | "#, |
518 | expect![[r#" | 518 | expect![[r#" |
diff --git a/crates/ide_db/src/defs.rs b/crates/ide_db/src/defs.rs index cc5078bf0..be1c64b03 100644 --- a/crates/ide_db/src/defs.rs +++ b/crates/ide_db/src/defs.rs | |||
@@ -358,7 +358,7 @@ impl NameRefClass { | |||
358 | if let Some(path) = macro_call.path() { | 358 | if let Some(path) = macro_call.path() { |
359 | if path.qualifier().is_none() { | 359 | if path.qualifier().is_none() { |
360 | // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment | 360 | // Only use this to resolve single-segment macro calls like `foo!()`. Multi-segment |
361 | // paths are handled below (allowing `log<|>::info!` to resolve to the log crate). | 361 | // paths are handled below (allowing `log$0::info!` to resolve to the log crate). |
362 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { | 362 | if let Some(macro_def) = sema.resolve_macro_call(¯o_call) { |
363 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); | 363 | return Some(NameRefClass::Definition(Definition::Macro(macro_def))); |
364 | } | 364 | } |
diff --git a/crates/ide_db/src/traits/tests.rs b/crates/ide_db/src/traits/tests.rs index 09c7ac3ec..84bb25505 100644 --- a/crates/ide_db/src/traits/tests.rs +++ b/crates/ide_db/src/traits/tests.rs | |||
@@ -5,12 +5,12 @@ use hir::Semantics; | |||
5 | use syntax::ast::{self, AstNode}; | 5 | use syntax::ast::{self, AstNode}; |
6 | use test_utils::RangeOrOffset; | 6 | use test_utils::RangeOrOffset; |
7 | 7 | ||
8 | /// Creates analysis from a multi-file fixture, returns positions marked with <|>. | 8 | /// Creates analysis from a multi-file fixture, returns positions marked with $0. |
9 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { | 9 | pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { |
10 | let change_fixture = ChangeFixture::parse(ra_fixture); | 10 | let change_fixture = ChangeFixture::parse(ra_fixture); |
11 | let mut database = RootDatabase::default(); | 11 | let mut database = RootDatabase::default(); |
12 | database.apply_change(change_fixture.change); | 12 | database.apply_change(change_fixture.change); |
13 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker (<|>)"); | 13 | let (file_id, range_or_offset) = change_fixture.file_position.expect("expected a marker ($0)"); |
14 | let offset = match range_or_offset { | 14 | let offset = match range_or_offset { |
15 | RangeOrOffset::Range(_) => panic!(), | 15 | RangeOrOffset::Range(_) => panic!(), |
16 | RangeOrOffset::Offset(it) => it, | 16 | RangeOrOffset::Offset(it) => it, |
@@ -55,7 +55,7 @@ pub trait Foo { | |||
55 | fn bar(); | 55 | fn bar(); |
56 | } | 56 | } |
57 | impl Foo for u8 { | 57 | impl Foo for u8 { |
58 | <|> | 58 | $0 |
59 | } | 59 | } |
60 | "#, | 60 | "#, |
61 | expect![["Foo"]], | 61 | expect![["Foo"]], |
@@ -68,7 +68,7 @@ pub trait Foo { | |||
68 | impl Foo for u8 { | 68 | impl Foo for u8 { |
69 | fn bar() { | 69 | fn bar() { |
70 | fn baz() { | 70 | fn baz() { |
71 | <|> | 71 | $0 |
72 | } | 72 | } |
73 | baz(); | 73 | baz(); |
74 | } | 74 | } |
@@ -83,7 +83,7 @@ pub trait Foo { | |||
83 | } | 83 | } |
84 | pub struct Bar; | 84 | pub struct Bar; |
85 | impl Bar { | 85 | impl Bar { |
86 | <|> | 86 | $0 |
87 | } | 87 | } |
88 | "#, | 88 | "#, |
89 | expect![[""]], | 89 | expect![[""]], |
@@ -99,7 +99,7 @@ pub trait Foo { | |||
99 | fn bar(); | 99 | fn bar(); |
100 | } | 100 | } |
101 | impl Foo for u8 { | 101 | impl Foo for u8 { |
102 | <|> | 102 | $0 |
103 | }"#, | 103 | }"#, |
104 | expect![[r#" | 104 | expect![[r#" |
105 | FOO | 105 | FOO |
@@ -114,7 +114,7 @@ pub trait Foo { | |||
114 | } | 114 | } |
115 | impl Foo for u8 { | 115 | impl Foo for u8 { |
116 | const FOO: u8 = 10; | 116 | const FOO: u8 = 10; |
117 | <|> | 117 | $0 |
118 | }"#, | 118 | }"#, |
119 | expect![[r#" | 119 | expect![[r#" |
120 | bar"#]], | 120 | bar"#]], |
@@ -128,7 +128,7 @@ pub trait Foo { | |||
128 | } | 128 | } |
129 | impl Foo for u8 { | 129 | impl Foo for u8 { |
130 | const FOO: u8 = 10; | 130 | const FOO: u8 = 10; |
131 | fn bar() {<|>} | 131 | fn bar() {$0} |
132 | }"#, | 132 | }"#, |
133 | expect![[r#""#]], | 133 | expect![[r#""#]], |
134 | ); | 134 | ); |
@@ -137,7 +137,7 @@ impl Foo for u8 { | |||
137 | r#" | 137 | r#" |
138 | pub struct Foo; | 138 | pub struct Foo; |
139 | impl Foo { | 139 | impl Foo { |
140 | fn bar() {<|>} | 140 | fn bar() {$0} |
141 | }"#, | 141 | }"#, |
142 | expect![[r#""#]], | 142 | expect![[r#""#]], |
143 | ); | 143 | ); |
diff --git a/crates/rust-analyzer/src/to_proto.rs b/crates/rust-analyzer/src/to_proto.rs index bb221c1d1..bc9999ddc 100644 --- a/crates/rust-analyzer/src/to_proto.rs +++ b/crates/rust-analyzer/src/to_proto.rs | |||
@@ -861,7 +861,7 @@ mod tests { | |||
861 | fn foo(arg: &Foo) {} | 861 | fn foo(arg: &Foo) {} |
862 | fn main() { | 862 | fn main() { |
863 | let arg = Foo; | 863 | let arg = Foo; |
864 | foo(<|>) | 864 | foo($0) |
865 | }"#; | 865 | }"#; |
866 | 866 | ||
867 | let (offset, text) = test_utils::extract_offset(fixture); | 867 | let (offset, text) = test_utils::extract_offset(fixture); |
diff --git a/crates/ssr/src/tests.rs b/crates/ssr/src/tests.rs index db9cb8ca1..d6918c22d 100644 --- a/crates/ssr/src/tests.rs +++ b/crates/ssr/src/tests.rs | |||
@@ -59,7 +59,7 @@ fn parser_undefined_placeholder_in_replacement() { | |||
59 | ); | 59 | ); |
60 | } | 60 | } |
61 | 61 | ||
62 | /// `code` may optionally contain a cursor marker `<|>`. If it doesn't, then the position will be | 62 | /// `code` may optionally contain a cursor marker `$0`. If it doesn't, then the position will be |
63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. | 63 | /// the start of the file. If there's a second cursor marker, then we'll return a single range. |
64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { | 64 | pub(crate) fn single_file(code: &str) -> (ide_db::RootDatabase, FilePosition, Vec<FileRange>) { |
65 | use ide_db::base_db::fixture::WithFixture; | 65 | use ide_db::base_db::fixture::WithFixture; |
@@ -596,7 +596,7 @@ fn replace_function_call() { | |||
596 | // This test also makes sure that we ignore empty-ranges. | 596 | // This test also makes sure that we ignore empty-ranges. |
597 | assert_ssr_transform( | 597 | assert_ssr_transform( |
598 | "foo() ==>> bar()", | 598 | "foo() ==>> bar()", |
599 | "fn foo() {<|><|>} fn bar() {} fn f1() {foo(); foo();}", | 599 | "fn foo() {$0$0} fn bar() {} fn f1() {foo(); foo();}", |
600 | expect![["fn foo() {} fn bar() {} fn f1() {bar(); bar();}"]], | 600 | expect![["fn foo() {} fn bar() {} fn f1() {bar(); bar();}"]], |
601 | ); | 601 | ); |
602 | } | 602 | } |
@@ -706,7 +706,7 @@ fn replace_associated_trait_constant() { | |||
706 | 706 | ||
707 | #[test] | 707 | #[test] |
708 | fn replace_path_in_different_contexts() { | 708 | fn replace_path_in_different_contexts() { |
709 | // Note the <|> inside module a::b which marks the point where the rule is interpreted. We | 709 | // Note the $0 inside module a::b which marks the point where the rule is interpreted. We |
710 | // replace foo with bar, but both need different path qualifiers in different contexts. In f4, | 710 | // replace foo with bar, but both need different path qualifiers in different contexts. In f4, |
711 | // foo is unqualified because of a use statement, however the replacement needs to be fully | 711 | // foo is unqualified because of a use statement, however the replacement needs to be fully |
712 | // qualified. | 712 | // qualified. |
@@ -714,7 +714,7 @@ fn replace_path_in_different_contexts() { | |||
714 | "c::foo() ==>> c::bar()", | 714 | "c::foo() ==>> c::bar()", |
715 | r#" | 715 | r#" |
716 | mod a { | 716 | mod a { |
717 | pub mod b {<|> | 717 | pub mod b {$0 |
718 | pub mod c { | 718 | pub mod c { |
719 | pub fn foo() {} | 719 | pub fn foo() {} |
720 | pub fn bar() {} | 720 | pub fn bar() {} |
@@ -1096,7 +1096,7 @@ fn pattern_is_a_single_segment_path() { | |||
1096 | fn f1() -> i32 { | 1096 | fn f1() -> i32 { |
1097 | let foo = 1; | 1097 | let foo = 1; |
1098 | let bar = 2; | 1098 | let bar = 2; |
1099 | foo<|> | 1099 | foo$0 |
1100 | } | 1100 | } |
1101 | "#, | 1101 | "#, |
1102 | expect![[r#" | 1102 | expect![[r#" |
@@ -1128,7 +1128,7 @@ fn replace_local_variable_reference() { | |||
1128 | let foo = 5; | 1128 | let foo = 5; |
1129 | res += foo + 1; | 1129 | res += foo + 1; |
1130 | let foo = 10; | 1130 | let foo = 10; |
1131 | res += foo + 2;<|> | 1131 | res += foo + 2;$0 |
1132 | res += foo + 3; | 1132 | res += foo + 3; |
1133 | let foo = 15; | 1133 | let foo = 15; |
1134 | res += foo + 4; | 1134 | res += foo + 4; |
@@ -1160,9 +1160,9 @@ fn replace_path_within_selection() { | |||
1160 | let foo = 41; | 1160 | let foo = 41; |
1161 | let bar = 42; | 1161 | let bar = 42; |
1162 | do_stuff(foo); | 1162 | do_stuff(foo); |
1163 | do_stuff(foo);<|> | 1163 | do_stuff(foo);$0 |
1164 | do_stuff(foo); | 1164 | do_stuff(foo); |
1165 | do_stuff(foo);<|> | 1165 | do_stuff(foo);$0 |
1166 | do_stuff(foo); | 1166 | do_stuff(foo); |
1167 | }"#, | 1167 | }"#, |
1168 | expect![[r#" | 1168 | expect![[r#" |
@@ -1185,9 +1185,9 @@ fn replace_nonpath_within_selection() { | |||
1185 | "$a + $b ==>> $b * $a", | 1185 | "$a + $b ==>> $b * $a", |
1186 | r#" | 1186 | r#" |
1187 | fn main() { | 1187 | fn main() { |
1188 | let v = 1 + 2;<|> | 1188 | let v = 1 + 2;$0 |
1189 | let v2 = 3 + 3; | 1189 | let v2 = 3 + 3; |
1190 | let v3 = 4 + 5;<|> | 1190 | let v3 = 4 + 5;$0 |
1191 | let v4 = 6 + 7; | 1191 | let v4 = 6 + 7; |
1192 | }"#, | 1192 | }"#, |
1193 | expect![[r#" | 1193 | expect![[r#" |
@@ -1212,7 +1212,7 @@ fn replace_self() { | |||
1212 | fn bar(_: &S1) {} | 1212 | fn bar(_: &S1) {} |
1213 | impl S1 { | 1213 | impl S1 { |
1214 | fn f1(&self) { | 1214 | fn f1(&self) { |
1215 | foo(self)<|> | 1215 | foo(self)$0 |
1216 | } | 1216 | } |
1217 | fn f2(&self) { | 1217 | fn f2(&self) { |
1218 | foo(self) | 1218 | foo(self) |
diff --git a/crates/syntax/src/algo.rs b/crates/syntax/src/algo.rs index 5696c014f..22ab36cd2 100644 --- a/crates/syntax/src/algo.rs +++ b/crates/syntax/src/algo.rs | |||
@@ -19,7 +19,7 @@ use crate::{ | |||
19 | 19 | ||
20 | /// Returns ancestors of the node at the offset, sorted by length. This should | 20 | /// Returns ancestors of the node at the offset, sorted by length. This should |
21 | /// do the right thing at an edge, e.g. when searching for expressions at `{ | 21 | /// do the right thing at an edge, e.g. when searching for expressions at `{ |
22 | /// <|>foo }` we will get the name reference instead of the whole block, which | 22 | /// $0foo }` we will get the name reference instead of the whole block, which |
23 | /// we would get if we just did `find_token_at_offset(...).flat_map(|t| | 23 | /// we would get if we just did `find_token_at_offset(...).flat_map(|t| |
24 | /// t.parent().ancestors())`. | 24 | /// t.parent().ancestors())`. |
25 | pub fn ancestors_at_offset( | 25 | pub fn ancestors_at_offset( |
diff --git a/crates/syntax/src/parsing/reparsing.rs b/crates/syntax/src/parsing/reparsing.rs index 190f5f67a..78eaf3410 100644 --- a/crates/syntax/src/parsing/reparsing.rs +++ b/crates/syntax/src/parsing/reparsing.rs | |||
@@ -223,7 +223,7 @@ mod tests { | |||
223 | do_check( | 223 | do_check( |
224 | r" | 224 | r" |
225 | fn foo() { | 225 | fn foo() { |
226 | let x = foo + <|>bar<|> | 226 | let x = foo + $0bar$0 |
227 | } | 227 | } |
228 | ", | 228 | ", |
229 | "baz", | 229 | "baz", |
@@ -232,7 +232,7 @@ fn foo() { | |||
232 | do_check( | 232 | do_check( |
233 | r" | 233 | r" |
234 | fn foo() { | 234 | fn foo() { |
235 | let x = foo<|> + bar<|> | 235 | let x = foo$0 + bar$0 |
236 | } | 236 | } |
237 | ", | 237 | ", |
238 | "baz", | 238 | "baz", |
@@ -241,7 +241,7 @@ fn foo() { | |||
241 | do_check( | 241 | do_check( |
242 | r" | 242 | r" |
243 | struct Foo { | 243 | struct Foo { |
244 | f: foo<|><|> | 244 | f: foo$0$0 |
245 | } | 245 | } |
246 | ", | 246 | ", |
247 | ",\n g: (),", | 247 | ",\n g: (),", |
@@ -252,7 +252,7 @@ struct Foo { | |||
252 | fn foo { | 252 | fn foo { |
253 | let; | 253 | let; |
254 | 1 + 1; | 254 | 1 + 1; |
255 | <|>92<|>; | 255 | $092$0; |
256 | } | 256 | } |
257 | ", | 257 | ", |
258 | "62", | 258 | "62", |
@@ -261,7 +261,7 @@ fn foo { | |||
261 | do_check( | 261 | do_check( |
262 | r" | 262 | r" |
263 | mod foo { | 263 | mod foo { |
264 | fn <|><|> | 264 | fn $0$0 |
265 | } | 265 | } |
266 | ", | 266 | ", |
267 | "bar", | 267 | "bar", |
@@ -271,7 +271,7 @@ mod foo { | |||
271 | do_check( | 271 | do_check( |
272 | r" | 272 | r" |
273 | trait Foo { | 273 | trait Foo { |
274 | type <|>Foo<|>; | 274 | type $0Foo$0; |
275 | } | 275 | } |
276 | ", | 276 | ", |
277 | "Output", | 277 | "Output", |
@@ -280,17 +280,17 @@ trait Foo { | |||
280 | do_check( | 280 | do_check( |
281 | r" | 281 | r" |
282 | impl IntoIterator<Item=i32> for Foo { | 282 | impl IntoIterator<Item=i32> for Foo { |
283 | f<|><|> | 283 | f$0$0 |
284 | } | 284 | } |
285 | ", | 285 | ", |
286 | "n next(", | 286 | "n next(", |
287 | 9, | 287 | 9, |
288 | ); | 288 | ); |
289 | do_check(r"use a::b::{foo,<|>,bar<|>};", "baz", 10); | 289 | do_check(r"use a::b::{foo,$0,bar$0};", "baz", 10); |
290 | do_check( | 290 | do_check( |
291 | r" | 291 | r" |
292 | pub enum A { | 292 | pub enum A { |
293 | Foo<|><|> | 293 | Foo$0$0 |
294 | } | 294 | } |
295 | ", | 295 | ", |
296 | "\nBar;\n", | 296 | "\nBar;\n", |
@@ -298,7 +298,7 @@ pub enum A { | |||
298 | ); | 298 | ); |
299 | do_check( | 299 | do_check( |
300 | r" | 300 | r" |
301 | foo!{a, b<|><|> d} | 301 | foo!{a, b$0$0 d} |
302 | ", | 302 | ", |
303 | ", c[3]", | 303 | ", c[3]", |
304 | 8, | 304 | 8, |
@@ -306,7 +306,7 @@ foo!{a, b<|><|> d} | |||
306 | do_check( | 306 | do_check( |
307 | r" | 307 | r" |
308 | fn foo() { | 308 | fn foo() { |
309 | vec![<|><|>] | 309 | vec![$0$0] |
310 | } | 310 | } |
311 | ", | 311 | ", |
312 | "123", | 312 | "123", |
@@ -315,7 +315,7 @@ fn foo() { | |||
315 | do_check( | 315 | do_check( |
316 | r" | 316 | r" |
317 | extern { | 317 | extern { |
318 | fn<|>;<|> | 318 | fn$0;$0 |
319 | } | 319 | } |
320 | ", | 320 | ", |
321 | " exit(code: c_int)", | 321 | " exit(code: c_int)", |
@@ -326,7 +326,7 @@ extern { | |||
326 | #[test] | 326 | #[test] |
327 | fn reparse_token_tests() { | 327 | fn reparse_token_tests() { |
328 | do_check( | 328 | do_check( |
329 | r"<|><|> | 329 | r"$0$0 |
330 | fn foo() -> i32 { 1 } | 330 | fn foo() -> i32 { 1 } |
331 | ", | 331 | ", |
332 | "\n\n\n \n", | 332 | "\n\n\n \n", |
@@ -334,49 +334,49 @@ fn foo() -> i32 { 1 } | |||
334 | ); | 334 | ); |
335 | do_check( | 335 | do_check( |
336 | r" | 336 | r" |
337 | fn foo() -> <|><|> {} | 337 | fn foo() -> $0$0 {} |
338 | ", | 338 | ", |
339 | " \n", | 339 | " \n", |
340 | 2, | 340 | 2, |
341 | ); | 341 | ); |
342 | do_check( | 342 | do_check( |
343 | r" | 343 | r" |
344 | fn <|>foo<|>() -> i32 { 1 } | 344 | fn $0foo$0() -> i32 { 1 } |
345 | ", | 345 | ", |
346 | "bar", | 346 | "bar", |
347 | 3, | 347 | 3, |
348 | ); | 348 | ); |
349 | do_check( | 349 | do_check( |
350 | r" | 350 | r" |
351 | fn foo<|><|>foo() { } | 351 | fn foo$0$0foo() { } |
352 | ", | 352 | ", |
353 | "bar", | 353 | "bar", |
354 | 6, | 354 | 6, |
355 | ); | 355 | ); |
356 | do_check( | 356 | do_check( |
357 | r" | 357 | r" |
358 | fn foo /* <|><|> */ () {} | 358 | fn foo /* $0$0 */ () {} |
359 | ", | 359 | ", |
360 | "some comment", | 360 | "some comment", |
361 | 6, | 361 | 6, |
362 | ); | 362 | ); |
363 | do_check( | 363 | do_check( |
364 | r" | 364 | r" |
365 | fn baz <|><|> () {} | 365 | fn baz $0$0 () {} |
366 | ", | 366 | ", |
367 | " \t\t\n\n", | 367 | " \t\t\n\n", |
368 | 2, | 368 | 2, |
369 | ); | 369 | ); |
370 | do_check( | 370 | do_check( |
371 | r" | 371 | r" |
372 | fn baz <|><|> () {} | 372 | fn baz $0$0 () {} |
373 | ", | 373 | ", |
374 | " \t\t\n\n", | 374 | " \t\t\n\n", |
375 | 2, | 375 | 2, |
376 | ); | 376 | ); |
377 | do_check( | 377 | do_check( |
378 | r" | 378 | r" |
379 | /// foo <|><|>omment | 379 | /// foo $0$0omment |
380 | mod { } | 380 | mod { } |
381 | ", | 381 | ", |
382 | "c", | 382 | "c", |
@@ -384,28 +384,28 @@ mod { } | |||
384 | ); | 384 | ); |
385 | do_check( | 385 | do_check( |
386 | r#" | 386 | r#" |
387 | fn -> &str { "Hello<|><|>" } | 387 | fn -> &str { "Hello$0$0" } |
388 | "#, | 388 | "#, |
389 | ", world", | 389 | ", world", |
390 | 7, | 390 | 7, |
391 | ); | 391 | ); |
392 | do_check( | 392 | do_check( |
393 | r#" | 393 | r#" |
394 | fn -> &str { // "Hello<|><|>" | 394 | fn -> &str { // "Hello$0$0" |
395 | "#, | 395 | "#, |
396 | ", world", | 396 | ", world", |
397 | 10, | 397 | 10, |
398 | ); | 398 | ); |
399 | do_check( | 399 | do_check( |
400 | r##" | 400 | r##" |
401 | fn -> &str { r#"Hello<|><|>"# | 401 | fn -> &str { r#"Hello$0$0"# |
402 | "##, | 402 | "##, |
403 | ", world", | 403 | ", world", |
404 | 10, | 404 | 10, |
405 | ); | 405 | ); |
406 | do_check( | 406 | do_check( |
407 | r" | 407 | r" |
408 | #[derive(<|>Copy<|>)] | 408 | #[derive($0Copy$0)] |
409 | enum Foo { | 409 | enum Foo { |
410 | 410 | ||
411 | } | 411 | } |
@@ -417,12 +417,12 @@ enum Foo { | |||
417 | 417 | ||
418 | #[test] | 418 | #[test] |
419 | fn reparse_str_token_with_error_unchanged() { | 419 | fn reparse_str_token_with_error_unchanged() { |
420 | do_check(r#""<|>Unclosed<|> string literal"#, "Still unclosed", 24); | 420 | do_check(r#""$0Unclosed$0 string literal"#, "Still unclosed", 24); |
421 | } | 421 | } |
422 | 422 | ||
423 | #[test] | 423 | #[test] |
424 | fn reparse_str_token_with_error_fixed() { | 424 | fn reparse_str_token_with_error_fixed() { |
425 | do_check(r#""unterinated<|><|>"#, "\"", 12); | 425 | do_check(r#""unterinated$0$0"#, "\"", 12); |
426 | } | 426 | } |
427 | 427 | ||
428 | #[test] | 428 | #[test] |
@@ -430,7 +430,7 @@ enum Foo { | |||
430 | do_check( | 430 | do_check( |
431 | r#"fn main() { | 431 | r#"fn main() { |
432 | if {} | 432 | if {} |
433 | 32 + 4<|><|> | 433 | 32 + 4$0$0 |
434 | return | 434 | return |
435 | if {} | 435 | if {} |
436 | }"#, | 436 | }"#, |
@@ -444,7 +444,7 @@ enum Foo { | |||
444 | do_check( | 444 | do_check( |
445 | r#"fn main() { | 445 | r#"fn main() { |
446 | if {} | 446 | if {} |
447 | 32 + 4<|><|> | 447 | 32 + 4$0$0 |
448 | return | 448 | return |
449 | if {} | 449 | if {} |
450 | }"#, | 450 | }"#, |
diff --git a/crates/test_utils/src/lib.rs b/crates/test_utils/src/lib.rs index 656dd2072..05d6e8c9e 100644 --- a/crates/test_utils/src/lib.rs +++ b/crates/test_utils/src/lib.rs | |||
@@ -3,7 +3,7 @@ | |||
3 | //! Most notable things are: | 3 | //! Most notable things are: |
4 | //! | 4 | //! |
5 | //! * Rich text comparison, which outputs a diff. | 5 | //! * Rich text comparison, which outputs a diff. |
6 | //! * Extracting markup (mainly, `<|>` markers) out of fixture strings. | 6 | //! * Extracting markup (mainly, `$0` markers) out of fixture strings. |
7 | //! * marks (see the eponymous module). | 7 | //! * marks (see the eponymous module). |
8 | 8 | ||
9 | #[macro_use] | 9 | #[macro_use] |
@@ -25,7 +25,7 @@ pub use rustc_hash::FxHashMap; | |||
25 | 25 | ||
26 | pub use crate::fixture::Fixture; | 26 | pub use crate::fixture::Fixture; |
27 | 27 | ||
28 | pub const CURSOR_MARKER: &str = "<|>"; | 28 | pub const CURSOR_MARKER: &str = "$0"; |
29 | 29 | ||
30 | /// Asserts that two strings are equal, otherwise displays a rich diff between them. | 30 | /// Asserts that two strings are equal, otherwise displays a rich diff between them. |
31 | /// | 31 | /// |
@@ -62,7 +62,7 @@ pub fn extract_offset(text: &str) -> (TextSize, String) { | |||
62 | } | 62 | } |
63 | } | 63 | } |
64 | 64 | ||
65 | /// Returns the offset of the first occurence of `<|>` marker and the copy of `text` | 65 | /// Returns the offset of the first occurence of `$0` marker and the copy of `text` |
66 | /// without the marker. | 66 | /// without the marker. |
67 | fn try_extract_offset(text: &str) -> Option<(TextSize, String)> { | 67 | fn try_extract_offset(text: &str) -> Option<(TextSize, String)> { |
68 | let cursor_pos = text.find(CURSOR_MARKER)?; | 68 | let cursor_pos = text.find(CURSOR_MARKER)?; |
@@ -81,7 +81,7 @@ pub fn extract_range(text: &str) -> (TextRange, String) { | |||
81 | } | 81 | } |
82 | } | 82 | } |
83 | 83 | ||
84 | /// Returns `TextRange` between the first two markers `<|>...<|>` and the copy | 84 | /// Returns `TextRange` between the first two markers `$0...$0` and the copy |
85 | /// of `text` without both of these markers. | 85 | /// of `text` without both of these markers. |
86 | fn try_extract_range(text: &str) -> Option<(TextRange, String)> { | 86 | fn try_extract_range(text: &str) -> Option<(TextRange, String)> { |
87 | let (start, text) = try_extract_offset(text)?; | 87 | let (start, text) = try_extract_offset(text)?; |
@@ -104,11 +104,11 @@ impl From<RangeOrOffset> for TextRange { | |||
104 | } | 104 | } |
105 | } | 105 | } |
106 | 106 | ||
107 | /// Extracts `TextRange` or `TextSize` depending on the amount of `<|>` markers | 107 | /// Extracts `TextRange` or `TextSize` depending on the amount of `$0` markers |
108 | /// found in `text`. | 108 | /// found in `text`. |
109 | /// | 109 | /// |
110 | /// # Panics | 110 | /// # Panics |
111 | /// Panics if no `<|>` marker is present in the `text`. | 111 | /// Panics if no `$0` marker is present in the `text`. |
112 | pub fn extract_range_or_offset(text: &str) -> (RangeOrOffset, String) { | 112 | pub fn extract_range_or_offset(text: &str) -> (RangeOrOffset, String) { |
113 | if let Some((range, text)) = try_extract_range(text) { | 113 | if let Some((range, text)) = try_extract_range(text) { |
114 | return (RangeOrOffset::Range(range), text); | 114 | return (RangeOrOffset::Range(range), text); |
@@ -164,12 +164,12 @@ fn test_extract_tags() { | |||
164 | assert_eq!(actual, vec![("fn main() {}", Some("fn".into())), ("main", None),]); | 164 | assert_eq!(actual, vec![("fn main() {}", Some("fn".into())), ("main", None),]); |
165 | } | 165 | } |
166 | 166 | ||
167 | /// Inserts `<|>` marker into the `text` at `offset`. | 167 | /// Inserts `$0` marker into the `text` at `offset`. |
168 | pub fn add_cursor(text: &str, offset: TextSize) -> String { | 168 | pub fn add_cursor(text: &str, offset: TextSize) -> String { |
169 | let offset: usize = offset.into(); | 169 | let offset: usize = offset.into(); |
170 | let mut res = String::new(); | 170 | let mut res = String::new(); |
171 | res.push_str(&text[..offset]); | 171 | res.push_str(&text[..offset]); |
172 | res.push_str("<|>"); | 172 | res.push_str("$0"); |
173 | res.push_str(&text[offset..]); | 173 | res.push_str(&text[offset..]); |
174 | res | 174 | res |
175 | } | 175 | } |