aboutsummaryrefslogtreecommitdiff
path: root/crates/completion/src
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-01-07 12:27:17 +0000
committerGitHub <[email protected]>2021-01-07 12:27:17 +0000
commit7967ce85cfc5fc2b1996425b44f2a45d0841c8ff (patch)
tree4495b9de7ea6c8e9dd9fd347d42517e9dee511fa /crates/completion/src
parentc3e9fb183bc287d83b97b776edc87c54d18d1a73 (diff)
parent72b9a4fbd3c12f3250b9157a1d44230e04ec8b22 (diff)
Merge #7184
7184: Changes Cursor Marker To $0 r=matklad a=kevaundray Co-authored-by: Kevaundray Wedderburn <[email protected]>
Diffstat (limited to 'crates/completion/src')
-rw-r--r--crates/completion/src/completions/attribute.rs12
-rw-r--r--crates/completion/src/completions/dot.rs42
-rw-r--r--crates/completion/src/completions/fn_param.rs8
-rw-r--r--crates/completion/src/completions/keyword.rs56
-rw-r--r--crates/completion/src/completions/macro_in_item_position.rs2
-rw-r--r--crates/completion/src/completions/mod_.rs18
-rw-r--r--crates/completion/src/completions/pattern.rs20
-rw-r--r--crates/completion/src/completions/postfix.rs48
-rw-r--r--crates/completion/src/completions/qualified_path.rs70
-rw-r--r--crates/completion/src/completions/record.rs28
-rw-r--r--crates/completion/src/completions/snippet.rs8
-rw-r--r--crates/completion/src/completions/trait_impl.rs70
-rw-r--r--crates/completion/src/completions/unqualified_path.rs82
-rw-r--r--crates/completion/src/context.rs8
-rw-r--r--crates/completion/src/item.rs2
-rw-r--r--crates/completion/src/lib.rs14
-rw-r--r--crates/completion/src/patterns.rs46
-rw-r--r--crates/completion/src/render.rs46
-rw-r--r--crates/completion/src/render/enum_variant.rs2
-rw-r--r--crates/completion/src/render/function.rs22
-rw-r--r--crates/completion/src/render/macro_.rs8
-rw-r--r--crates/completion/src/test_utils.rs4
22 files changed, 304 insertions, 312 deletions
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)]
417struct Test {} 417struct 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)]
438struct Test {} 438struct 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)]
449struct Test {} 449struct 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 }
79impl S { 79impl S {
80 fn bar(&self) {} 80 fn bar(&self) {}
81} 81}
82fn foo(s: S) { s.<|> } 82fn 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#"
95struct S { the_field: (u32,) } 95struct S { the_field: (u32,) }
96impl S { 96impl 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#"
111struct A { the_field: (u32, i32) } 111struct A { the_field: (u32, i32) }
112impl A { 112impl 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#"
128struct A { the_field: u32 } 128struct A { the_field: u32 }
129fn foo(a: A) { a.<|>() } 129fn 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}
147fn foo(a: inner::A) { a.<|> } 147fn 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}
165fn foo(a: A) { a.<|> } 165fn 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#"
177union U { field: u8, other: u16 } 177union U { field: u8, other: u16 }
178fn foo(u: U) { u.<|> } 178fn 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> {
195impl A<i32> { 195impl A<i32> {
196 fn the_other_method(&self) {} 196 fn the_other_method(&self) {}
197} 197}
198fn foo(a: A<u32>) { a.<|> } 198fn 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.<|> }
210struct A {} 210struct A {}
211trait Trait { fn the_method(&self); } 211trait Trait { fn the_method(&self); }
212impl Trait for A {} 212impl Trait for A {}
213fn foo(a: A) { a.<|> } 213fn 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.<|> }
225struct A {} 225struct A {}
226trait Trait { fn the_method(&self); } 226trait Trait { fn the_method(&self); }
227impl<T> Trait for T {} 227impl<T> Trait for T {}
228fn foo(a: &A) { a.<|> } 228fn 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}
244use m::Trait; 244use m::Trait;
245impl Trait for A {} 245impl Trait for A {}
246fn foo(a: A) { a.<|> } 246fn 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}
262fn foo(a: A) { 262fn 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#"
274fn foo() { 274fn 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);
295impl T { 295impl 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#"
312struct A { the_field: u32 } 312struct A { the_field: u32 }
313const X: u32 = { 313const 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 = {
327macro_rules! m { ($e:expr) => { $e } } 327macro_rules! m { ($e:expr) => { $e } }
328struct A { the_field: u32 } 328struct A { the_field: u32 }
329fn foo(a: A) { 329fn 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) {
344macro_rules! m { ($e:expr) => { $e } } 344macro_rules! m { ($e:expr) => { $e } }
345struct A { the_field: u32 } 345struct A { the_field: u32 }
346fn foo(a: A) { 346fn 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) {
360macro_rules! m { ($e:expr) => { $e } } 360macro_rules! m { ($e:expr) => { $e } }
361struct A { the_field: u32 } 361struct A { the_field: u32 }
362fn foo(a: A) { 362fn 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}
387struct A { the_field: u32 } 387struct A { the_field: u32 }
388fn foo(a: A) { 388fn 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}
406fn foo() { 406fn 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() {
421struct S; 421struct S;
422impl S { fn foo(&self) {} } 422impl S { fn foo(&self) {} }
423macro_rules! make_s { () => { S }; } 423macro_rules! make_s { () => { S }; }
424fn main() { make_s!().f<|>; } 424fn 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#"
82fn foo(file_id: FileId) {} 82fn foo(file_id: FileId) {}
83fn bar(file_id: FileId) {} 83fn bar(file_id: FileId) {}
84fn baz(file<|>) {} 84fn 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#"
96fn foo(file_id: FileId) {} 96fn foo(file_id: FileId) {}
97fn baz(file<|>, x: i32) {} 97fn 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#"
126fn outer(text: String) { 126fn 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#"
334fn quux() -> i32 { 334fn 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#"
473fn test() { 473fn 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/*
482Some multi-line comment<|> 482Some 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<|>
501use std::future::*; 501use std::future::*;
502struct A {} 502struct A {}
503impl Future for A {} 503impl Future for A {}
504fn foo(a: A) { a.<|> } 504fn foo(a: A) { a.$0 }
505 505
506//- /std/lib.rs crate:std 506//- /std/lib.rs crate:std
507pub mod future { 507pub mod future {
@@ -520,7 +520,7 @@ pub mod future {
520use std::future::*; 520use std::future::*;
521fn foo() { 521fn 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#"
559struct Foo { 559struct Foo {
560 <|> 560 $0
561 pub f: i32, 561 pub f: i32,
562} 562}
563"#, 563"#,
@@ -578,7 +578,7 @@ struct Foo {
578} 578}
579fn foo() { 579fn foo() {
580 Foo { 580 Foo {
581 <|> 581 $0
582 } 582 }
583} 583}
584"#, 584"#,
@@ -595,7 +595,7 @@ struct Foo {
595} 595}
596fn foo() { 596fn 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 {
31macro_rules! foo { () => {} } 31macro_rules! foo { () => {} }
32fn foo() {} 32fn 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
10use crate::{context::CompletionContext, item::CompletionKind, Completions}; 10use crate::{context::CompletionContext, item::CompletionKind, Completions};
11 11
12/// Complete mod declaration, i.e. `mod <|> ;` 12/// Complete mod declaration, i.e. `mod $0 ;`
13pub(crate) fn complete_mod(acc: &mut Completions, ctx: &CompletionContext) -> Option<()> { 13pub(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;
71struct Bar { f: u32 } 71struct Bar { f: u32 }
72 72
73fn foo() { 73fn 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 } }
92enum E { X } 92enum E { X }
93 93
94fn foo() { 94fn 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;
115struct Bar { f: u32 } 115struct Bar { f: u32 }
116 116
117fn foo() { 117fn foo() {
118 let <|> 118 let $0
119} 119}
120"#, 120"#,
121 expect![[r#" 121 expect![[r#"
@@ -133,7 +133,7 @@ enum E { X }
133static FOO: E = E::X; 133static FOO: E = E::X;
134struct Bar { f: u32 } 134struct Bar { f: u32 }
135 135
136fn foo(<|>) { 136fn foo($0) {
137} 137}
138"#, 138"#,
139 expect![[r#" 139 expect![[r#"
@@ -149,7 +149,7 @@ fn foo(<|>) {
149struct Bar { f: u32 } 149struct Bar { f: u32 }
150 150
151fn foo() { 151fn foo() {
152 let <|> 152 let $0
153} 153}
154"#, 154"#,
155 expect![[r#" 155 expect![[r#"
@@ -165,7 +165,7 @@ fn foo() {
165struct Foo { bar: String, baz: String } 165struct Foo { bar: String, baz: String }
166struct Bar(String, String); 166struct Bar(String, String);
167struct Baz; 167struct Baz;
168fn outer(<|>) {} 168fn 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 }
182struct Bar(String, String); 182struct Bar(String, String);
183struct Baz; 183struct Baz;
184fn outer() { 184fn outer() {
185 let <|> 185 let $0
186} 186}
187"#, 187"#,
188 expect![[r#" 188 expect![[r#"
@@ -201,7 +201,7 @@ struct Bar(String, String);
201struct Baz; 201struct Baz;
202fn outer() { 202fn outer() {
203 match () { 203 match () {
204 <|> 204 $0
205 } 205 }
206} 206}
207"#, 207"#,
@@ -225,7 +225,7 @@ use foo::*;
225 225
226fn outer() { 226fn outer() {
227 match () { 227 match () {
228 <|> 228 $0
229 } 229 }
230} 230}
231"#, 231"#,
@@ -244,7 +244,7 @@ fn outer() {
244struct Foo(i32); 244struct Foo(i32);
245fn main() { 245fn 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
3mod format_like; 3mod format_like;
4 4
@@ -310,7 +310,7 @@ mod tests {
310 r#" 310 r#"
311fn main() { 311fn 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
343fn main() { 343fn 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#"
369fn main() { 369fn 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#"
394fn main() { 394fn 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
425fn main() { 425fn 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
450fn main() { 450fn 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() {
479macro_rules! m { ($e:expr) => { $e } } 479macro_rules! m { ($e:expr) => { $e } }
480fn main() { 480fn 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
3use hir::{Adt, HasVisibility, PathResolution, ScopeDef}; 3use hir::{Adt, HasVisibility, PathResolution, ScopeDef};
4use rustc_hash::FxHashSet; 4use 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#"
183mod foo { pub struct S; } 183mod foo { pub struct S; }
184use self::{foo::*, bar<|>}; 184use 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#"
233use self::my::<|>; 233use self::my::$0;
234 234
235mod my { pub struct Bar; } 235mod my { pub struct Bar; }
236fn my() {} 236fn my() {}
@@ -245,7 +245,7 @@ fn my() {}
245 fn filters_visibility() { 245 fn filters_visibility() {
246 check( 246 check(
247 r#" 247 r#"
248use self::my::<|>; 248use self::my::$0;
249 249
250mod my { 250mod 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#"
267use self::m::<|>; 267use self::m::$0;
268 268
269mod m { pub struct Bar; } 269mod m { pub struct Bar; }
270"#, 270"#,
@@ -282,7 +282,7 @@ mod m { pub struct Bar; }
282mod foo; 282mod foo;
283struct Spam; 283struct Spam;
284//- /foo.rs 284//- /foo.rs
285use crate::Sp<|> 285use crate::Sp$0
286"#, 286"#,
287 expect![[r#" 287 expect![[r#"
288 md foo 288 md foo
@@ -299,7 +299,7 @@ use crate::Sp<|>
299mod foo; 299mod foo;
300struct Spam; 300struct Spam;
301//- /foo.rs 301//- /foo.rs
302use crate::{Sp<|>}; 302use 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
323use crate::{bar::{baz::Sp<|>}}; 323use 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#"
335enum E { Foo, Bar(i32) } 335enum E { Foo, Bar(i32) }
336fn foo() { let _ = E::<|> } 336fn 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
359fn foo() { let _ = S::<|> } 359fn 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
387fn foo() { let _ = S::<|> } 387fn 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::<|> }
401enum E {}; 401enum E {};
402impl E { fn m() { } } 402impl E { fn m() { } }
403 403
404fn foo() { let _ = E::<|> } 404fn 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::<|> }
416union U {}; 416union U {};
417impl U { fn m() { } } 417impl U { fn m() { } }
418 418
419fn foo() { let _ = U::<|> } 419fn 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
432use foo::<|>; 432use foo::$0;
433 433
434//- /foo/lib.rs crate:foo 434//- /foo/lib.rs crate:foo
435pub mod bar { pub struct S; } 435pub mod bar { pub struct S; }
@@ -446,7 +446,7 @@ pub mod bar { pub struct S; }
446 r#" 446 r#"
447trait Trait { fn m(); } 447trait Trait { fn m(); }
448 448
449fn foo() { let _ = Trait::<|> } 449fn 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(); }
463struct S; 463struct S;
464impl Trait for S {} 464impl Trait for S {}
465 465
466fn foo() { let _ = S::<|> } 466fn 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(); }
480struct S; 480struct S;
481impl Trait for S {} 481impl Trait for S {}
482 482
483fn foo() { let _ = <S as Trait>::<|> } 483fn 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
509fn foo<T: Sub>() { T::<|> } 509fn 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> {}
544impl<T> Sub for Wrap<T> { 544impl<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() {} }
570type T = S; 570type T = S;
571impl T { fn bar() {} } 571impl T { fn bar() {} }
572 572
573fn main() { T::<|>; } 573fn 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]
587macro_rules! foo { () => {} } 587macro_rules! foo { () => {} }
588 588
589fn main() { let _ = crate::<|> } 589fn 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#"
622fn foo() { self::m::<|> } 622fn foo() { self::m::$0 }
623 623
624mod m { 624mod 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#"
645fn foo() { self::m::<|> } 645fn foo() { self::m::$0 }
646 646
647mod m { 647mod 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#"
679macro_rules! m { ($e:expr) => { $e } } 679macro_rules! m { ($e:expr) => { $e } }
680fn main() { m!(self::f<|>); } 680fn main() { m!(self::f$0); }
681fn foo() {} 681fn 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#"
694fn foo() { self::m::<|> } 694fn foo() { self::m::$0 }
695 695
696mod m { 696mod 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}
718fn foo() { 718fn 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#"
732mod foo { pub struct Foo; } 732mod foo { pub struct Foo; }
733#[foo::<|>] 733#[foo::$0]
734fn f() {} 734fn f() {}
735"#, 735"#,
736 expect![[""]], 736 expect![[""]],
@@ -749,7 +749,7 @@ fn foo(
749} 749}
750 750
751fn main() { 751fn main() {
752 fo<|> 752 fo$0
753} 753}
754"#, 754"#,
755 expect![[r#" 755 expect![[r#"
@@ -770,7 +770,7 @@ enum Foo {
770 770
771impl Foo { 771impl 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 {
99fn process(f: S) { 99fn 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 {
139fn process(f: S) { 139fn 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 }
173fn process(f: S) { 173fn 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
202fn process(f: S) { 202fn 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
220fn process(e: E) { 220fn 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
240fn process(f: S) { 240fn 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#"
280struct A { the_field: u32 } 280struct A { the_field: u32 }
281fn foo() { 281fn 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#"
295enum E { A { a: u32 } } 295enum E { A { a: u32 } }
296fn foo() { 296fn 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 }
311struct B { b: u32 } 311struct B { b: u32 }
312 312
313fn foo() { 313fn 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() {
327struct A<T> { a: T } 327struct A<T> { a: T }
328 328
329fn foo() { 329fn 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() {
343macro_rules! m { ($e:expr) => { $e } } 343macro_rules! m { ($e:expr) => { $e } }
344struct A { the_field: u32 } 344struct A { the_field: u32 }
345fn foo() { 345fn 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
364fn main() { 364fn 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
382fn main() { 382fn 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)]
105mod tests { 105mod 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
83fn completion_match(ctx: &CompletionContext) -> Option<(ImplCompletionKind, SyntaxNode, Impl)> { 83fn 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 {
267struct T; 267struct T;
268 268
269impl Test for T { 269impl Test for T {
270 t<|> 270 t$0
271} 271}
272"#, 272"#,
273 expect![[" 273 expect![["
@@ -287,7 +287,7 @@ struct T;
287 287
288impl Test for T { 288impl 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
302impl Test for T { 302impl 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
316impl Test for T { 316impl 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
331impl Test for T { 331impl 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(); }
343struct T; 343struct T;
344 344
345impl Test for T { 345impl 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(); }
355struct T; 355struct T;
356 356
357impl Test for T { 357impl 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(); }
370struct T; 370struct T;
371 371
372impl Test for T { 372impl 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(); }
382struct T; 382struct T;
383 383
384impl Test for T { 384impl 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(); }
394struct T; 394struct T;
395 395
396impl Test for T { 396impl 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
408impl Test for T { 408impl 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
422impl Test for T { 422impl 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
436impl Test for T { 436impl 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(); }
451struct T; 451struct T;
452 452
453impl Test for T { 453impl 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(); }
463struct T; 463struct T;
464 464
465impl Test for T { 465impl 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 {
481struct T; 481struct T;
482 482
483impl Test for T { 483impl Test for T {
484 t<|> 484 t$0
485} 485}
486"#, 486"#,
487 r#" 487 r#"
@@ -510,7 +510,7 @@ trait Test {
510struct T; 510struct T;
511 511
512impl Test for T { 512impl 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
541impl Test for T { 541impl 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 {
560struct T; 560struct T;
561 561
562impl Test for T { 562impl Test for T {
563 fn f<|> 563 fn f$0
564} 564}
565"#, 565"#,
566 r#" 566 r#"
@@ -585,7 +585,7 @@ trait Test {
585struct T; 585struct T;
586 586
587impl Test for T { 587impl 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
616impl Test for () { 616impl 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
641impl Test for () { 641impl 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
663impl Test for () { 663impl 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#"
215use foo<|> 215use foo$0
216use std::collections; 216use std::collections;
217"#, 217"#,
218 expect![[r#" 218 expect![[r#"
@@ -229,7 +229,7 @@ enum Enum { A, B }
229fn quux(x: Option<Enum>) { 229fn 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 }
245fn quux(x: Option<Enum>) { 245fn 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 }
261fn quux(x: Option<Enum>) { 261fn 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#"
278fn quux(x: i32) { 278fn 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#"
318fn quux() { 318fn 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#"
335fn main() { 335fn 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#"
387struct S; 387struct S;
388enum E {} 388enum E {}
389fn quux() { <|> } 389fn 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#"
405fn main() { 405fn main() {
406 _<|> 406 _$0
407} 407}
408fn _alpha() {} 408fn _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
424use <|>; 424use $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 <|>;
439struct Foo; 439struct Foo;
440mod m { 440mod 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#"
456struct Foo; 456struct Foo;
457fn x() -> <|> 457fn 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
503fn foo() { let x: <|> } 503fn 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
524fn foo() { let x: <|> } 524fn 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
565fn main() { let v = <|> } 565fn 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#"
583macro_rules! foo { () => {} } 583macro_rules! foo { () => {} }
584fn foo() { <|> } 584fn 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#"
597macro_rules! foo { () => {} } 597macro_rules! foo { () => {} }
598fn main() { let x: <|> } 598fn 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#"
611macro_rules! foo { () => {} } 611macro_rules! foo { () => {} }
612fn main() { <|> } 612fn 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#"
625fn main() { 625fn main() {
626 return f<|>; 626 return f$0;
627 fn frobnicate() {} 627 fn frobnicate() {}
628} 628}
629"#, 629"#,
@@ -641,7 +641,7 @@ fn main() {
641macro_rules! m { ($e:expr) => { $e } } 641macro_rules! m { ($e:expr) => { $e } }
642fn quux(x: i32) { 642fn 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) {
660macro_rules! m { ($e:expr) => { $e } } 660macro_rules! m { ($e:expr) => { $e } }
661fn quux(x: i32) { 661fn 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) {
679macro_rules! m { ($e:expr) => { $e } } 679macro_rules! m { ($e:expr) => { $e } }
680fn quux(x: i32) { 680fn 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#"
698use spam::Quux; 698use spam::Quux;
699 699
700fn main() { <|> } 700fn 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
715fn main() { 715fn 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
735fn main() { 735fn 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
755fn main() { 755fn 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#"
773enum Foo { Bar, Baz, Quux } 773enum Foo { Bar, Baz, Quux }
774fn main() { let foo: Foo = Q<|> } 774fn 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#"
790mod m { pub enum E { V } } 790mod m { pub enum E { V } }
791fn f() -> m::E { V<|> } 791fn 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#"
805struct Foo; 805struct Foo;
806#[<|>] 806#[$0]
807fn f() {} 807fn f() {}
808"#, 808"#,
809 expect![[""]], 809 expect![[""]],
@@ -817,7 +817,7 @@ fn f() {}
817trait MyTrait {} 817trait MyTrait {}
818struct MyStruct {} 818struct MyStruct {}
819 819
820impl My<|> 820impl 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
842fn main() { 842fn 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
870fn main() { 870fn main() {
871 curli<|> 871 curli$0
872} 872}
873"#, 873"#,
874 r#" 874 r#"
@@ -898,7 +898,7 @@ pub mod some_module {
898use dep::{FirstStruct, some_module::SecondStruct}; 898use dep::{FirstStruct, some_module::SecondStruct};
899 899
900fn main() { 900fn main() {
901 this<|> 901 this$0
902} 902}
903"#, 903"#,
904 r#" 904 r#"
@@ -936,7 +936,7 @@ pub mod some_module {
936use dep::{FirstStruct, some_module::SecondStruct}; 936use dep::{FirstStruct, some_module::SecondStruct};
937 937
938fn main() { 938fn 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]
22fn test_has_trait_parent() { 22fn 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
26pub(crate) fn has_impl_parent(element: SyntaxElement) -> bool { 26pub(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]
34fn test_has_impl_parent() { 34fn 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
38pub(crate) fn inside_impl_trait_block(element: SyntaxElement) -> bool { 38pub(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]
49fn test_inside_impl_trait_block() { 49fn 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
56pub(crate) fn has_field_list_parent(element: SyntaxElement) -> bool { 56pub(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]
60fn test_has_field_list_parent() { 60fn 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
65pub(crate) fn has_block_expr_parent(element: SyntaxElement) -> bool { 65pub(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]
69fn test_has_block_expr_parent() { 69fn 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
73pub(crate) fn has_bind_pat_parent(element: SyntaxElement) -> bool { 73pub(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]
77fn test_has_bind_pat_parent() { 77fn 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
82pub(crate) fn has_ref_parent(element: SyntaxElement) -> bool { 82pub(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]
88fn test_has_ref_parent() { 88fn 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
93pub(crate) fn has_item_list_or_source_file_parent(element: SyntaxElement) -> bool { 93pub(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]
101fn test_has_item_list_or_source_file_parent() { 101fn 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
106pub(crate) fn is_match_arm(element: SyntaxElement) -> bool { 106pub(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]
114fn test_is_match_arm() { 114fn 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
118pub(crate) fn unsafe_is_prev(element: SyntaxElement) -> bool { 118pub(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]
126fn test_unsafe_is_prev() { 126fn 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
130pub(crate) fn if_is_prev(element: SyntaxElement) -> bool { 130pub(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]
146fn test_fn_is_prev() { 146fn 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.
152pub(crate) fn for_is_prev2(element: SyntaxElement) -> bool { 152pub(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]
161fn test_for_is_prev2() { 161fn 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]
166fn test_if_is_prev() { 166fn 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
170pub(crate) fn has_trait_as_prev_sibling(element: SyntaxElement) -> bool { 170pub(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]
174fn test_has_trait_as_prev_sibling() { 174fn 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
178pub(crate) fn has_impl_as_prev_sibling(element: SyntaxElement) -> bool { 178pub(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]
182fn test_has_impl_as_prev_sibling() { 182fn 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
186pub(crate) fn is_in_loop_body(element: SyntaxElement) -> bool { 186pub(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#"
359enum Foo { Foo { x: i32, y: i32 } } 359enum Foo { Foo { x: i32, y: i32 } }
360 360
361fn main() { Foo::Fo<|> } 361fn 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#"
382enum Foo { Foo (i32, i32) } 382enum Foo { Foo (i32, i32) }
383 383
384fn main() { Foo::Fo<|> } 384fn 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#"
407enum Foo { Foo } 407enum Foo { Foo }
408 408
409fn main() { Foo::Fo<|> } 409fn main() { Foo::Fo$0 }
410"#, 410"#,
411 expect![[r#" 411 expect![[r#"
412 [ 412 [
@@ -430,7 +430,7 @@ fn main() { Foo::Fo<|> }
430mod m { 430mod m {
431 pub enum Spam { Foo, Bar(i32) } 431 pub enum Spam { Foo, Bar(i32) }
432} 432}
433fn main() { let _: m::Spam = S<|> } 433fn 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")]
484fn something_else_deprecated() {} 484fn something_else_deprecated() {}
485 485
486fn main() { som<|> } 486fn 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#"
525struct A { #[deprecated] the_field: u32 } 525struct A { #[deprecated] the_field: u32 }
526fn foo() { A { the<|> } } 526fn foo() { A { the$0 } }
527"#, 527"#,
528 expect![[r#" 528 expect![[r#"
529 [ 529 [
@@ -551,7 +551,7 @@ struct S {
551} 551}
552impl S { 552impl 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#"
587use self::my<|>; 587use self::my$0;
588 588
589/// mod docs 589/// mod docs
590mod my { } 590mod my { }
@@ -643,7 +643,7 @@ impl S {
643 #[inline] 643 #[inline]
644 fn the_method(&self) { } 644 fn the_method(&self) { }
645} 645}
646fn foo(s: S) { s.<|> } 646fn 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) {}
671struct ManualVtable { f: fn(u8, u8) } 671struct ManualVtable { f: fn(u8, u8) }
672 672
673fn main() -> ManualVtable { 673fn 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#"
694mod m { pub fn foo() {} } 694mod m { pub fn foo() {} }
695use crate::m::f<|>; 695use crate::m::f$0;
696"#, 696"#,
697 r#" 697 r#"
698mod m { pub fn foo() {} } 698mod m { pub fn foo() {} }
@@ -707,7 +707,7 @@ use crate::m::foo;
707 "foo", 707 "foo",
708 r#" 708 r#"
709fn foo(x: i32) {} 709fn foo(x: i32) {}
710fn main() { f<|>(); } 710fn main() { f$0(); }
711"#, 711"#,
712 r#" 712 r#"
713fn foo(x: i32) {} 713fn foo(x: i32) {}
@@ -719,7 +719,7 @@ fn main() { foo(); }
719 r#" 719 r#"
720struct Foo; 720struct Foo;
721impl Foo { fn foo(&self){} } 721impl Foo { fn foo(&self){} }
722fn f(foo: &Foo) { foo.f<|>(); } 722fn f(foo: &Foo) { foo.f$0(); }
723"#, 723"#,
724 r#" 724 r#"
725struct Foo; 725struct Foo;
@@ -736,7 +736,7 @@ fn f(foo: &Foo) { foo.foo(); }
736 "Vec", 736 "Vec",
737 r#" 737 r#"
738struct Vec<T> {} 738struct Vec<T> {}
739fn foo(xs: Ve<|>) 739fn foo(xs: Ve$0)
740"#, 740"#,
741 r#" 741 r#"
742struct Vec<T> {} 742struct Vec<T> {}
@@ -747,7 +747,7 @@ fn foo(xs: Vec<$0>)
747 "Vec", 747 "Vec",
748 r#" 748 r#"
749type Vec<T> = (T,); 749type Vec<T> = (T,);
750fn foo(xs: Ve<|>) 750fn foo(xs: Ve$0)
751"#, 751"#,
752 r#" 752 r#"
753type Vec<T> = (T,); 753type Vec<T> = (T,);
@@ -758,7 +758,7 @@ fn foo(xs: Vec<$0>)
758 "Vec", 758 "Vec",
759 r#" 759 r#"
760struct Vec<T = i128> {} 760struct Vec<T = i128> {}
761fn foo(xs: Ve<|>) 761fn foo(xs: Ve$0)
762"#, 762"#,
763 r#" 763 r#"
764struct Vec<T = i128> {} 764struct Vec<T = i128> {}
@@ -769,7 +769,7 @@ fn foo(xs: Vec)
769 "Vec", 769 "Vec",
770 r#" 770 r#"
771struct Vec<T> {} 771struct Vec<T> {}
772fn foo(xs: Ve<|><i128>) 772fn foo(xs: Ve$0<i128>)
773"#, 773"#,
774 r#" 774 r#"
775struct Vec<T> {} 775struct Vec<T> {}
@@ -785,7 +785,7 @@ fn foo(xs: Vec<i128>)
785 r#" 785 r#"
786struct S { foo: i64, bar: u32, baz: u32 } 786struct S { foo: i64, bar: u32, baz: u32 }
787fn test(bar: u32) { } 787fn test(bar: u32) { }
788fn foo(s: S) { test(s.<|>) } 788fn 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#"
803struct A { foo: i64, bar: u32, baz: u32 } 803struct A { foo: i64, bar: u32, baz: u32 }
804struct B { x: (), y: f32, bar: u32 } 804struct B { x: (), y: f32, bar: u32 }
805fn foo(a: A) { B { bar: a.<|> }; } 805fn 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.<|> }; }
819struct A { foo: i64, bar: u32, baz: u32 } 819struct A { foo: i64, bar: u32, baz: u32 }
820struct B { x: (), y: f32, bar: u32 } 820struct B { x: (), y: f32, bar: u32 }
821fn f(foo: i64) { } 821fn f(foo: i64) { }
822fn foo(a: A) { B { bar: f(a.<|>) }; } 822fn 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.<|>) }; }
832struct A { foo: i64, bar: u32, baz: u32 } 832struct A { foo: i64, bar: u32, baz: u32 }
833struct B { x: (), y: f32, bar: u32 } 833struct B { x: (), y: f32, bar: u32 }
834fn f(foo: i64) { } 834fn f(foo: i64) { }
835fn foo(a: A) { f(B { bar: a.<|> }); } 835fn 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#"
849struct WorldSnapshot { _f: () }; 849struct WorldSnapshot { _f: () };
850fn go(world: &WorldSnapshot) { go(w<|>) } 850fn 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#"
864struct Foo; 864struct Foo;
865fn f(foo: &Foo) { f(foo, w<|>) } 865fn 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 {
115enum Option<T> { Some(T), None } 115enum Option<T> { Some(T), None }
116use Option::*; 116use Option::*;
117fn main() -> Option<i32> { 117fn 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#"
126fn no_args() {} 126fn no_args() {}
127fn main() { no_<|> } 127fn main() { no_$0 }
128"#, 128"#,
129 r#" 129 r#"
130fn no_args() {} 130fn no_args() {}
@@ -136,7 +136,7 @@ fn main() { no_args()$0 }
136 "with_args", 136 "with_args",
137 r#" 137 r#"
138fn with_args(x: i32, y: String) {} 138fn with_args(x: i32, y: String) {}
139fn main() { with_<|> } 139fn main() { with_$0 }
140"#, 140"#,
141 r#" 141 r#"
142fn with_args(x: i32, y: String) {} 142fn with_args(x: i32, y: String) {}
@@ -151,7 +151,7 @@ struct S;
151impl S { 151impl S {
152 fn foo(&self) {} 152 fn foo(&self) {}
153} 153}
154fn bar(s: &S) { s.f<|> } 154fn bar(s: &S) { s.f$0 }
155"#, 155"#,
156 r#" 156 r#"
157struct S; 157struct S;
@@ -170,7 +170,7 @@ impl S {
170 fn foo(&self, x: i32) {} 170 fn foo(&self, x: i32) {}
171} 171}
172fn bar(s: &S) { 172fn bar(s: &S) {
173 s.f<|> 173 s.f$0
174} 174}
175"#, 175"#,
176 r#" 176 r#"
@@ -195,7 +195,7 @@ struct S;
195impl S { 195impl S {
196 fn foo(&self) {} 196 fn foo(&self) {}
197} 197}
198fn main() { S::f<|> } 198fn main() { S::f$0 }
199"#, 199"#,
200 r#" 200 r#"
201struct S; 201struct S;
@@ -215,7 +215,7 @@ fn main() { S::foo(${1:&self})$0 }
215 "with_args", 215 "with_args",
216 r#" 216 r#"
217fn with_args(x: i32, y: String) {} 217fn with_args(x: i32, y: String) {}
218fn main() { with_<|> } 218fn main() { with_$0 }
219"#, 219"#,
220 r#" 220 r#"
221fn with_args(x: i32, y: String) {} 221fn with_args(x: i32, y: String) {}
@@ -230,7 +230,7 @@ fn main() { with_args($0) }
230 "foo", 230 "foo",
231 r#" 231 r#"
232fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {} 232fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {}
233fn main() { f<|> } 233fn main() { f$0 }
234"#, 234"#,
235 r#" 235 r#"
236fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {} 236fn foo(_foo: i32, ___bar: bool, ho_ge_: String) {}
@@ -248,7 +248,7 @@ struct Foo {}
248fn ref_arg(x: &Foo) {} 248fn ref_arg(x: &Foo) {}
249fn main() { 249fn 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 {}
271fn ref_arg(x: &mut Foo) {} 271fn ref_arg(x: &mut Foo) {}
272fn main() { 272fn 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 {
299fn main() { 299fn 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() {
326fn take_mutably(mut x: &i32) {} 326fn take_mutably(mut x: &i32) {}
327 327
328fn main() { 328fn 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
138use foo::<|>; 138use foo::$0;
139//- /foo/lib.rs crate:foo 139//- /foo/lib.rs crate:foo
140#[macro_export] 140#[macro_export]
141macro_rules! frobnicate { () => () } 141macro_rules! frobnicate { () => () }
@@ -149,7 +149,7 @@ use foo::frobnicate;
149 "frobnicate!", 149 "frobnicate!",
150 r#" 150 r#"
151macro_rules! frobnicate { () => () } 151macro_rules! frobnicate { () => () }
152fn main() { frob<|>!(); } 152fn main() { frob$0!(); }
153"#, 153"#,
154 r#" 154 r#"
155macro_rules! frobnicate { () => () } 155macro_rules! frobnicate { () => () }
@@ -173,7 +173,7 @@ fn main() { frobnicate!(); }
173/// ``` 173/// ```
174macro_rules! vec { () => {} } 174macro_rules! vec { () => {} }
175 175
176fn fn main() { v<|> } 176fn 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 };`
200macro_rules! foo { () => {} } 200macro_rules! foo { () => {} }
201fn main() { <|> } 201fn 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.
26pub(crate) fn position(ra_fixture: &str) -> (RootDatabase, FilePosition) { 26pub(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,