aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/completion/src/completions/attribute.rs16
-rw-r--r--crates/completion/src/completions/dot.rs8
-rw-r--r--crates/completion/src/completions/keyword.rs142
-rw-r--r--crates/completion/src/completions/mod_.rs4
-rw-r--r--crates/completion/src/completions/pattern.rs4
-rw-r--r--crates/completion/src/completions/postfix.rs62
-rw-r--r--crates/completion/src/completions/qualified_path.rs56
-rw-r--r--crates/completion/src/completions/record.rs4
-rw-r--r--crates/completion/src/completions/snippet.rs4
-rw-r--r--crates/completion/src/completions/trait_impl.rs10
-rw-r--r--crates/completion/src/completions/unqualified_path.rs74
-rw-r--r--crates/completion/src/test_utils.rs3
12 files changed, 193 insertions, 194 deletions
diff --git a/crates/completion/src/completions/attribute.rs b/crates/completion/src/completions/attribute.rs
index acce2e7e7..19ce2482f 100644
--- a/crates/completion/src/completions/attribute.rs
+++ b/crates/completion/src/completions/attribute.rs
@@ -428,8 +428,8 @@ struct Test {}
428 at Hash 428 at Hash
429 at PartialEq 429 at PartialEq
430 at PartialEq, Eq 430 at PartialEq, Eq
431 at PartialEq, Eq, PartialOrd, Ord
432 at PartialEq, PartialOrd 431 at PartialEq, PartialOrd
432 at PartialEq, Eq, PartialOrd, Ord
433 "#]], 433 "#]],
434 ); 434 );
435 } 435 }
@@ -457,10 +457,10 @@ struct Test {}
457 at Clone, Copy 457 at Clone, Copy
458 at Debug 458 at Debug
459 at Default 459 at Default
460 at Eq
461 at Eq, PartialOrd, Ord
462 at Hash 460 at Hash
461 at Eq
463 at PartialOrd 462 at PartialOrd
463 at Eq, PartialOrd, Ord
464 "#]], 464 "#]],
465 ) 465 )
466 } 466 }
@@ -472,14 +472,14 @@ struct Test {}
472 expect![[r#" 472 expect![[r#"
473 at allow(…) 473 at allow(…)
474 at automatically_derived 474 at automatically_derived
475 at cfg(…)
476 at cfg_attr(…) 475 at cfg_attr(…)
476 at cfg(…)
477 at cold 477 at cold
478 at deny(…) 478 at deny(…)
479 at deprecated = "…" 479 at deprecated = "…"
480 at derive(…) 480 at derive(…)
481 at doc = "…"
482 at export_name = "…" 481 at export_name = "…"
482 at doc = "…"
483 at forbid(…) 483 at forbid(…)
484 at ignore = "…" 484 at ignore = "…"
485 at inline(…) 485 at inline(…)
@@ -518,15 +518,15 @@ struct Test {}
518 expect![[r#" 518 expect![[r#"
519 at allow(…) 519 at allow(…)
520 at automatically_derived 520 at automatically_derived
521 at cfg(…)
522 at cfg_attr(…) 521 at cfg_attr(…)
522 at cfg(…)
523 at cold 523 at cold
524 at crate_name = "" 524 at crate_name = ""
525 at deny(…) 525 at deny(…)
526 at deprecated = "…" 526 at deprecated = "…"
527 at derive(…) 527 at derive(…)
528 at doc = "…"
529 at export_name = "…" 528 at export_name = "…"
529 at doc = "…"
530 at feature(…) 530 at feature(…)
531 at forbid(…) 531 at forbid(…)
532 at global_allocator 532 at global_allocator
@@ -538,8 +538,8 @@ struct Test {}
538 at macro_export 538 at macro_export
539 at macro_use 539 at macro_use
540 at must_use = "…" 540 at must_use = "…"
541 at no_implicit_prelude
542 at no_link 541 at no_link
542 at no_implicit_prelude
543 at no_main 543 at no_main
544 at no_mangle 544 at no_mangle
545 at no_std 545 at no_std
diff --git a/crates/completion/src/completions/dot.rs b/crates/completion/src/completions/dot.rs
index c9875045a..551ef1771 100644
--- a/crates/completion/src/completions/dot.rs
+++ b/crates/completion/src/completions/dot.rs
@@ -82,8 +82,8 @@ impl S {
82fn foo(s: S) { s.<|> } 82fn foo(s: S) { s.<|> }
83"#, 83"#,
84 expect![[r#" 84 expect![[r#"
85 me bar() fn bar(&self)
86 fd foo u32 85 fd foo u32
86 me bar() fn bar(&self)
87 "#]], 87 "#]],
88 ); 88 );
89 } 89 }
@@ -98,8 +98,8 @@ impl S {
98} 98}
99"#, 99"#,
100 expect![[r#" 100 expect![[r#"
101 me foo() fn foo(self)
102 fd the_field (u32,) 101 fd the_field (u32,)
102 me foo() fn foo(self)
103 "#]], 103 "#]],
104 ) 104 )
105 } 105 }
@@ -114,8 +114,8 @@ impl A {
114} 114}
115"#, 115"#,
116 expect![[r#" 116 expect![[r#"
117 me foo() fn foo(&self)
118 fd the_field (u32, i32) 117 fd the_field (u32, i32)
118 me foo() fn foo(&self)
119 "#]], 119 "#]],
120 ) 120 )
121 } 121 }
@@ -147,8 +147,8 @@ mod inner {
147fn foo(a: inner::A) { a.<|> } 147fn foo(a: inner::A) { a.<|> }
148"#, 148"#,
149 expect![[r#" 149 expect![[r#"
150 fd crate_field u32
151 fd pub_field u32 150 fd pub_field u32
151 fd crate_field u32
152 fd super_field u32 152 fd super_field u32
153 "#]], 153 "#]],
154 ); 154 );
diff --git a/crates/completion/src/completions/keyword.rs b/crates/completion/src/completions/keyword.rs
index 720349b9d..1859dec70 100644
--- a/crates/completion/src/completions/keyword.rs
+++ b/crates/completion/src/completions/keyword.rs
@@ -223,21 +223,21 @@ mod tests {
223 check( 223 check(
224 r"m<|>", 224 r"m<|>",
225 expect![[r#" 225 expect![[r#"
226 kw const
227 kw enum
228 kw extern
229 kw fn 226 kw fn
227 kw use
230 kw impl 228 kw impl
231 kw mod
232 kw pub
233 kw pub(crate)
234 kw static
235 kw struct
236 kw trait 229 kw trait
237 kw type 230 kw enum
231 kw struct
238 kw union 232 kw union
233 kw mod
234 kw const
235 kw type
236 kw static
237 kw extern
239 kw unsafe 238 kw unsafe
240 kw use 239 kw pub(crate)
240 kw pub
241 "#]], 241 "#]],
242 ); 242 );
243 } 243 }
@@ -247,23 +247,23 @@ mod tests {
247 check( 247 check(
248 r"fn quux() { <|> }", 248 r"fn quux() { <|> }",
249 expect![[r#" 249 expect![[r#"
250 kw const
251 kw extern
252 kw fn 250 kw fn
251 kw use
252 kw impl
253 kw trait
254 kw match
255 kw while
256 kw loop
253 kw if 257 kw if
254 kw if let 258 kw if let
255 kw impl
256 kw let 259 kw let
257 kw loop
258 kw match
259 kw mod 260 kw mod
260 kw return 261 kw const
261 kw static
262 kw trait
263 kw type 262 kw type
263 kw static
264 kw extern
264 kw unsafe 265 kw unsafe
265 kw use 266 kw return
266 kw while
267 "#]], 267 "#]],
268 ); 268 );
269 } 269 }
@@ -273,23 +273,23 @@ mod tests {
273 check( 273 check(
274 r"fn quux() { if true { <|> } }", 274 r"fn quux() { if true { <|> } }",
275 expect![[r#" 275 expect![[r#"
276 kw const
277 kw extern
278 kw fn 276 kw fn
277 kw use
278 kw impl
279 kw trait
280 kw match
281 kw while
282 kw loop
279 kw if 283 kw if
280 kw if let 284 kw if let
281 kw impl
282 kw let 285 kw let
283 kw loop
284 kw match
285 kw mod 286 kw mod
286 kw return 287 kw const
287 kw static
288 kw trait
289 kw type 288 kw type
289 kw static
290 kw extern
290 kw unsafe 291 kw unsafe
291 kw use 292 kw return
292 kw while
293 "#]], 293 "#]],
294 ); 294 );
295 } 295 }
@@ -299,25 +299,25 @@ mod tests {
299 check( 299 check(
300 r#"fn quux() { if true { () } <|> }"#, 300 r#"fn quux() { if true { () } <|> }"#,
301 expect![[r#" 301 expect![[r#"
302 kw const
303 kw else
304 kw else if
305 kw extern
306 kw fn 302 kw fn
303 kw use
304 kw impl
305 kw trait
306 kw match
307 kw while
308 kw loop
307 kw if 309 kw if
308 kw if let 310 kw if let
309 kw impl
310 kw let 311 kw let
311 kw loop 312 kw else
312 kw match 313 kw else if
313 kw mod 314 kw mod
314 kw return 315 kw const
315 kw static
316 kw trait
317 kw type 316 kw type
317 kw static
318 kw extern
318 kw unsafe 319 kw unsafe
319 kw use 320 kw return
320 kw while
321 "#]], 321 "#]],
322 ); 322 );
323 check_edit( 323 check_edit(
@@ -336,13 +336,13 @@ fn quux() -> i32 {
336} 336}
337"#, 337"#,
338 expect![[r#" 338 expect![[r#"
339 kw match
340 kw while
341 kw loop
339 kw if 342 kw if
340 kw if let 343 kw if let
341 kw loop
342 kw match
343 kw return
344 kw unsafe 344 kw unsafe
345 kw while 345 kw return
346 "#]], 346 "#]],
347 ); 347 );
348 } 348 }
@@ -352,8 +352,8 @@ fn quux() -> i32 {
352 check( 352 check(
353 r"trait My { <|> }", 353 r"trait My { <|> }",
354 expect![[r#" 354 expect![[r#"
355 kw const
356 kw fn 355 kw fn
356 kw const
357 kw type 357 kw type
358 kw unsafe 358 kw unsafe
359 "#]], 359 "#]],
@@ -365,12 +365,12 @@ fn quux() -> i32 {
365 check( 365 check(
366 r"impl My { <|> }", 366 r"impl My { <|> }",
367 expect![[r#" 367 expect![[r#"
368 kw const
369 kw fn 368 kw fn
370 kw pub 369 kw const
371 kw pub(crate)
372 kw type 370 kw type
373 kw unsafe 371 kw unsafe
372 kw pub(crate)
373 kw pub
374 "#]], 374 "#]],
375 ); 375 );
376 } 376 }
@@ -380,25 +380,25 @@ fn quux() -> i32 {
380 check( 380 check(
381 r"fn my() { loop { <|> } }", 381 r"fn my() { loop { <|> } }",
382 expect![[r#" 382 expect![[r#"
383 kw break
384 kw const
385 kw continue
386 kw extern
387 kw fn 383 kw fn
384 kw use
385 kw impl
386 kw trait
387 kw match
388 kw while
389 kw loop
388 kw if 390 kw if
389 kw if let 391 kw if let
390 kw impl
391 kw let 392 kw let
392 kw loop
393 kw match
394 kw mod 393 kw mod
395 kw return 394 kw const
396 kw static
397 kw trait
398 kw type 395 kw type
396 kw static
397 kw extern
399 kw unsafe 398 kw unsafe
400 kw use 399 kw continue
401 kw while 400 kw break
401 kw return
402 "#]], 402 "#]],
403 ); 403 );
404 } 404 }
@@ -409,8 +409,8 @@ fn quux() -> i32 {
409 r"unsafe <|>", 409 r"unsafe <|>",
410 expect![[r#" 410 expect![[r#"
411 kw fn 411 kw fn
412 kw impl
413 kw trait 412 kw trait
413 kw impl
414 "#]], 414 "#]],
415 ); 415 );
416 } 416 }
@@ -421,8 +421,8 @@ fn quux() -> i32 {
421 r"fn my_fn() { unsafe <|> }", 421 r"fn my_fn() { unsafe <|> }",
422 expect![[r#" 422 expect![[r#"
423 kw fn 423 kw fn
424 kw impl
425 kw trait 424 kw trait
425 kw impl
426 "#]], 426 "#]],
427 ); 427 );
428 } 428 }
@@ -542,12 +542,12 @@ pub mod future {
542 check( 542 check(
543 r#"fn main() { let _ = <|> }"#, 543 r#"fn main() { let _ = <|> }"#,
544 expect![[r#" 544 expect![[r#"
545 kw match
546 kw while
547 kw loop
545 kw if 548 kw if
546 kw if let 549 kw if let
547 kw loop
548 kw match
549 kw return 550 kw return
550 kw while
551 "#]], 551 "#]],
552 ) 552 )
553 } 553 }
@@ -562,8 +562,8 @@ struct Foo {
562} 562}
563"#, 563"#,
564 expect![[r#" 564 expect![[r#"
565 kw pub
566 kw pub(crate) 565 kw pub(crate)
566 kw pub
567 "#]], 567 "#]],
568 ) 568 )
569 } 569 }
@@ -600,12 +600,12 @@ fn foo() {
600} 600}
601"#, 601"#,
602 expect![[r#" 602 expect![[r#"
603 kw match
604 kw while
605 kw loop
603 kw if 606 kw if
604 kw if let 607 kw if let
605 kw loop
606 kw match
607 kw return 608 kw return
608 kw while
609 "#]], 609 "#]],
610 ); 610 );
611 } 611 }
diff --git a/crates/completion/src/completions/mod_.rs b/crates/completion/src/completions/mod_.rs
index c96f84171..f77864b77 100644
--- a/crates/completion/src/completions/mod_.rs
+++ b/crates/completion/src/completions/mod_.rs
@@ -170,8 +170,8 @@ mod tests {
170 fn ignored_bar() {} 170 fn ignored_bar() {}
171 "#, 171 "#,
172 expect![[r#" 172 expect![[r#"
173 md bar;
174 md foo; 173 md foo;
174 md bar;
175 "#]], 175 "#]],
176 ); 176 );
177 } 177 }
@@ -207,8 +207,8 @@ mod tests {
207 fn ignored_bar() {} 207 fn ignored_bar() {}
208 "#, 208 "#,
209 expect![[r#" 209 expect![[r#"
210 md bar;
211 md foo; 210 md foo;
211 md bar;
212 "#]], 212 "#]],
213 ); 213 );
214 } 214 }
diff --git a/crates/completion/src/completions/pattern.rs b/crates/completion/src/completions/pattern.rs
index 4f63ff0ef..0c98e4412 100644
--- a/crates/completion/src/completions/pattern.rs
+++ b/crates/completion/src/completions/pattern.rs
@@ -66,10 +66,10 @@ fn foo() {
66} 66}
67"#, 67"#,
68 expect![[r#" 68 expect![[r#"
69 st Bar
70 en E 69 en E
71 ev X ()
72 ct Z 70 ct Z
71 st Bar
72 ev X ()
73 md m 73 md m
74 "#]], 74 "#]],
75 ); 75 );
diff --git a/crates/completion/src/completions/postfix.rs b/crates/completion/src/completions/postfix.rs
index c8ba63cd3..d6db82a93 100644
--- a/crates/completion/src/completions/postfix.rs
+++ b/crates/completion/src/completions/postfix.rs
@@ -315,20 +315,20 @@ fn main() {
315} 315}
316"#, 316"#,
317 expect![[r#" 317 expect![[r#"
318 sn box Box::new(expr)
319 sn call function(expr)
320 sn dbg dbg!(expr)
321 sn dbgr dbg!(&expr)
322 sn if if expr {} 318 sn if if expr {}
323 sn let let 319 sn while while expr {}
324 sn letm let mut
325 sn match match expr {}
326 sn not !expr 320 sn not !expr
327 sn ok Ok(expr)
328 sn ref &expr 321 sn ref &expr
329 sn refm &mut expr 322 sn refm &mut expr
323 sn match match expr {}
324 sn box Box::new(expr)
325 sn ok Ok(expr)
330 sn some Some(expr) 326 sn some Some(expr)
331 sn while while expr {} 327 sn dbg dbg!(expr)
328 sn dbgr dbg!(&expr)
329 sn call function(expr)
330 sn let let
331 sn letm let mut
332 "#]], 332 "#]],
333 ); 333 );
334 } 334 }
@@ -347,18 +347,18 @@ fn main() {
347} 347}
348"#, 348"#,
349 expect![[r#" 349 expect![[r#"
350 sn box Box::new(expr)
351 sn call function(expr)
352 sn dbg dbg!(expr)
353 sn dbgr dbg!(&expr)
354 sn if if expr {} 350 sn if if expr {}
355 sn match match expr {} 351 sn while while expr {}
356 sn not !expr 352 sn not !expr
357 sn ok Ok(expr)
358 sn ref &expr 353 sn ref &expr
359 sn refm &mut expr 354 sn refm &mut expr
355 sn match match expr {}
356 sn box Box::new(expr)
357 sn ok Ok(expr)
360 sn some Some(expr) 358 sn some Some(expr)
361 sn while while expr {} 359 sn dbg dbg!(expr)
360 sn dbgr dbg!(&expr)
361 sn call function(expr)
362 "#]], 362 "#]],
363 ); 363 );
364 } 364 }
@@ -373,17 +373,17 @@ fn main() {
373} 373}
374"#, 374"#,
375 expect![[r#" 375 expect![[r#"
376 sn ref &expr
377 sn refm &mut expr
378 sn match match expr {}
376 sn box Box::new(expr) 379 sn box Box::new(expr)
377 sn call function(expr) 380 sn ok Ok(expr)
381 sn some Some(expr)
378 sn dbg dbg!(expr) 382 sn dbg dbg!(expr)
379 sn dbgr dbg!(&expr) 383 sn dbgr dbg!(&expr)
384 sn call function(expr)
380 sn let let 385 sn let let
381 sn letm let mut 386 sn letm let mut
382 sn match match expr {}
383 sn ok Ok(expr)
384 sn ref &expr
385 sn refm &mut expr
386 sn some Some(expr)
387 "#]], 387 "#]],
388 ) 388 )
389 } 389 }
@@ -398,20 +398,20 @@ fn main() {
398} 398}
399"#, 399"#,
400 expect![[r#" 400 expect![[r#"
401 sn box Box::new(expr)
402 sn call function(expr)
403 sn dbg dbg!(expr)
404 sn dbgr dbg!(&expr)
405 sn if if expr {} 401 sn if if expr {}
406 sn let let 402 sn while while expr {}
407 sn letm let mut
408 sn match match expr {}
409 sn not !expr 403 sn not !expr
410 sn ok Ok(expr)
411 sn ref &expr 404 sn ref &expr
412 sn refm &mut expr 405 sn refm &mut expr
406 sn match match expr {}
407 sn box Box::new(expr)
408 sn ok Ok(expr)
413 sn some Some(expr) 409 sn some Some(expr)
414 sn while while expr {} 410 sn dbg dbg!(expr)
411 sn dbgr dbg!(&expr)
412 sn call function(expr)
413 sn let let
414 sn letm let mut
415 "#]], 415 "#]],
416 ); 416 );
417 } 417 }
diff --git a/crates/completion/src/completions/qualified_path.rs b/crates/completion/src/completions/qualified_path.rs
index bc23bea3f..1300f00b2 100644
--- a/crates/completion/src/completions/qualified_path.rs
+++ b/crates/completion/src/completions/qualified_path.rs
@@ -199,22 +199,22 @@ use self::{foo::*, bar<|>};
199 check_builtin( 199 check_builtin(
200 r#"fn main() { let _: <|> = 92; }"#, 200 r#"fn main() { let _: <|> = 92; }"#,
201 expect![[r#" 201 expect![[r#"
202 bt u32
202 bt bool 203 bt bool
203 bt char 204 bt u8
205 bt isize
206 bt u16
207 bt u64
208 bt u128
204 bt f32 209 bt f32
205 bt f64
206 bt i128 210 bt i128
207 bt i16 211 bt i16
208 bt i32 212 bt str
209 bt i64 213 bt i64
214 bt char
215 bt f64
216 bt i32
210 bt i8 217 bt i8
211 bt isize
212 bt str
213 bt u128
214 bt u16
215 bt u32
216 bt u64
217 bt u8
218 bt usize 218 bt usize
219 "#]], 219 "#]],
220 ); 220 );
@@ -279,8 +279,8 @@ struct Spam;
279use crate::Sp<|> 279use crate::Sp<|>
280"#, 280"#,
281 expect![[r#" 281 expect![[r#"
282 st Spam
283 md foo 282 md foo
283 st Spam
284 "#]], 284 "#]],
285 ); 285 );
286 } 286 }
@@ -296,8 +296,8 @@ struct Spam;
296use crate::{Sp<|>}; 296use crate::{Sp<|>};
297"#, 297"#,
298 expect![[r#" 298 expect![[r#"
299 st Spam
300 md foo 299 md foo
300 st Spam
301 "#]], 301 "#]],
302 ); 302 );
303 } 303 }
@@ -330,8 +330,8 @@ enum E { Foo, Bar(i32) }
330fn foo() { let _ = E::<|> } 330fn foo() { let _ = E::<|> }
331"#, 331"#,
332 expect![[r#" 332 expect![[r#"
333 ev Bar(…) (i32)
334 ev Foo () 333 ev Foo ()
334 ev Bar(…) (i32)
335 "#]], 335 "#]],
336 ); 336 );
337 } 337 }
@@ -353,10 +353,10 @@ impl S {
353fn foo() { let _ = S::<|> } 353fn foo() { let _ = S::<|> }
354"#, 354"#,
355 expect![[r#" 355 expect![[r#"
356 ct C const C: i32 = 42;
357 ta T type T = i32;
358 fn a() fn a() 356 fn a() fn a()
359 me b(…) fn b(&self) 357 me b(…) fn b(&self)
358 ct C const C: i32 = 42;
359 ta T type T = i32;
360 "#]], 360 "#]],
361 ); 361 );
362 } 362 }
@@ -381,9 +381,9 @@ mod m {
381fn foo() { let _ = S::<|> } 381fn foo() { let _ = S::<|> }
382"#, 382"#,
383 expect![[r#" 383 expect![[r#"
384 fn public_method() pub(crate) fn public_method()
384 ct PUBLIC_CONST pub(crate) const PUBLIC_CONST: u32 = 1; 385 ct PUBLIC_CONST pub(crate) const PUBLIC_CONST: u32 = 1;
385 ta PublicType pub(crate) type PublicType = u32; 386 ta PublicType pub(crate) type PublicType = u32;
386 fn public_method() pub(crate) fn public_method()
387 "#]], 387 "#]],
388 ); 388 );
389 } 389 }
@@ -503,14 +503,14 @@ trait Sub: Super {
503fn foo<T: Sub>() { T::<|> } 503fn foo<T: Sub>() { T::<|> }
504"#, 504"#,
505 expect![[r#" 505 expect![[r#"
506 ct C2 const C2: ();
507 ct CONST const CONST: u8;
508 ta SubTy type SubTy; 506 ta SubTy type SubTy;
509 ta Ty type Ty; 507 ta Ty type Ty;
510 fn func() fn func() 508 ct C2 const C2: ();
511 me method(…) fn method(&self)
512 fn subfunc() fn subfunc() 509 fn subfunc() fn subfunc()
513 me submethod(…) fn submethod(&self) 510 me submethod(…) fn submethod(&self)
511 ct CONST const CONST: u8;
512 fn func() fn func()
513 me method(…) fn method(&self)
514 "#]], 514 "#]],
515 ); 515 );
516 } 516 }
@@ -543,12 +543,12 @@ impl<T> Sub for Wrap<T> {
543} 543}
544"#, 544"#,
545 expect![[r#" 545 expect![[r#"
546 ct C2 const C2: () = ();
547 ct CONST const CONST: u8 = 0;
548 ta SubTy type SubTy; 546 ta SubTy type SubTy;
549 ta Ty type Ty; 547 ta Ty type Ty;
548 ct CONST const CONST: u8 = 0;
550 fn func() fn func() 549 fn func() fn func()
551 me method(…) fn method(&self) 550 me method(…) fn method(&self)
551 ct C2 const C2: () = ();
552 fn subfunc() fn subfunc() 552 fn subfunc() fn subfunc()
553 me submethod(…) fn submethod(&self) 553 me submethod(…) fn submethod(&self)
554 "#]], 554 "#]],
@@ -567,8 +567,8 @@ impl T { fn bar() {} }
567fn main() { T::<|>; } 567fn main() { T::<|>; }
568"#, 568"#,
569 expect![[r#" 569 expect![[r#"
570 fn bar() fn bar()
571 fn foo() fn foo() 570 fn foo() fn foo()
571 fn bar() fn bar()
572 "#]], 572 "#]],
573 ); 573 );
574 } 574 }
@@ -583,9 +583,9 @@ macro_rules! foo { () => {} }
583fn main() { let _ = crate::<|> } 583fn main() { let _ = crate::<|> }
584 "#, 584 "#,
585 expect![[r##" 585 expect![[r##"
586 fn main() fn main()
586 ma foo!(…) #[macro_export] 587 ma foo!(…) #[macro_export]
587 macro_rules! foo 588 macro_rules! foo
588 fn main() fn main()
589 "##]], 589 "##]],
590 ); 590 );
591 } 591 }
@@ -603,8 +603,8 @@ mod a {
603} 603}
604"#, 604"#,
605 expect![[r#" 605 expect![[r#"
606 ct A
607 md b 606 md b
607 ct A
608 "#]], 608 "#]],
609 ); 609 );
610 } 610 }
@@ -628,8 +628,8 @@ mod p {
628"#, 628"#,
629 expect![[r#" 629 expect![[r#"
630 ct RIGHT_CONST 630 ct RIGHT_CONST
631 st RightType
632 fn right_fn() fn wrong_fn() 631 fn right_fn() fn wrong_fn()
632 st RightType
633 "#]], 633 "#]],
634 ); 634 );
635 635
@@ -675,8 +675,8 @@ fn main() { m!(self::f<|>); }
675fn foo() {} 675fn foo() {}
676"#, 676"#,
677 expect![[r#" 677 expect![[r#"
678 fn foo() fn foo()
679 fn main() fn main() 678 fn main() fn main()
679 fn foo() fn foo()
680 "#]], 680 "#]],
681 ); 681 );
682 } 682 }
@@ -747,8 +747,8 @@ fn main() {
747} 747}
748"#, 748"#,
749 expect![[r#" 749 expect![[r#"
750 fn foo(…) fn foo(a: i32, b: i32)
751 fn main() fn main() 750 fn main() fn main()
751 fn foo(…) fn foo(a: i32, b: i32)
752 "#]], 752 "#]],
753 ); 753 );
754 } 754 }
diff --git a/crates/completion/src/completions/record.rs b/crates/completion/src/completions/record.rs
index eaa44c97d..91bf4a8ad 100644
--- a/crates/completion/src/completions/record.rs
+++ b/crates/completion/src/completions/record.rs
@@ -94,9 +94,9 @@ fn process(f: S) {
94 check_snippet( 94 check_snippet(
95 test_code, 95 test_code,
96 expect![[r#" 96 expect![[r#"
97 fd ..Default::default()
98 sn pd 97 sn pd
99 sn ppd 98 sn ppd
99 fd ..Default::default()
100 "#]], 100 "#]],
101 ); 101 );
102 } 102 }
@@ -160,8 +160,8 @@ fn process(e: E) {
160} 160}
161"#, 161"#,
162 expect![[r#" 162 expect![[r#"
163 fd bar ()
164 fd foo u32 163 fd foo u32
164 fd bar ()
165 "#]], 165 "#]],
166 ); 166 );
167 } 167 }
diff --git a/crates/completion/src/completions/snippet.rs b/crates/completion/src/completions/snippet.rs
index 6f0c00078..842590130 100644
--- a/crates/completion/src/completions/snippet.rs
+++ b/crates/completion/src/completions/snippet.rs
@@ -105,9 +105,9 @@ mod tests {
105} 105}
106"#, 106"#,
107 expect![[r#" 107 expect![[r#"
108 sn macro_rules
109 sn tfn (Test function)
110 sn tmod (Test module) 108 sn tmod (Test module)
109 sn tfn (Test function)
110 sn macro_rules
111 "#]], 111 "#]],
112 ) 112 )
113 } 113 }
diff --git a/crates/completion/src/completions/trait_impl.rs b/crates/completion/src/completions/trait_impl.rs
index e2fe44aff..ca2b1bc3b 100644
--- a/crates/completion/src/completions/trait_impl.rs
+++ b/crates/completion/src/completions/trait_impl.rs
@@ -265,11 +265,11 @@ impl Test for T {
265 t<|> 265 t<|>
266} 266}
267"#, 267"#,
268 expect![[" 268 expect![[r#"
269ct const TEST_CONST: u16 = \n\ 269 ta type TestType =
270fn fn test() 270 ct const TEST_CONST: u16 =
271ta type TestType = \n\ 271 fn fn test()
272 "]], 272 "#]],
273 ); 273 );
274 } 274 }
275 275
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs
index 5a7a6e83d..54d5c989b 100644
--- a/crates/completion/src/completions/unqualified_path.rs
+++ b/crates/completion/src/completions/unqualified_path.rs
@@ -268,9 +268,9 @@ fn quux(x: i32) {
268} 268}
269"#, 269"#,
270 expect![[r#" 270 expect![[r#"
271 fn quux(…) fn quux(x: i32)
272 bn x i32
273 bn y i32 271 bn y i32
272 bn x i32
273 fn quux(…) fn quux(x: i32)
274 "#]], 274 "#]],
275 ); 275 );
276 } 276 }
@@ -290,8 +290,8 @@ fn quux() {
290} 290}
291"#, 291"#,
292 expect![[r#" 292 expect![[r#"
293 bn a
294 bn b i32 293 bn b i32
294 bn a
295 fn quux() fn quux() 295 fn quux() fn quux()
296 "#]], 296 "#]],
297 ); 297 );
@@ -306,8 +306,8 @@ fn quux() {
306} 306}
307"#, 307"#,
308 expect![[r#" 308 expect![[r#"
309 fn quux() fn quux()
310 bn x 309 bn x
310 fn quux() fn quux()
311 "#]], 311 "#]],
312 ); 312 );
313 } 313 }
@@ -348,9 +348,9 @@ fn main() {
348 check( 348 check(
349 r#"struct S<T> { x: <|>}"#, 349 r#"struct S<T> { x: <|>}"#,
350 expect![[r#" 350 expect![[r#"
351 st S<…>
352 tp Self 351 tp Self
353 tp T 352 tp T
353 st S<…>
354 "#]], 354 "#]],
355 ); 355 );
356 } 356 }
@@ -375,9 +375,9 @@ enum E {}
375fn quux() { <|> } 375fn quux() { <|> }
376"#, 376"#,
377 expect![[r#" 377 expect![[r#"
378 en E
379 st S 378 st S
380 fn quux() fn quux() 379 fn quux() fn quux()
380 en E
381 "#]], 381 "#]],
382 ); 382 );
383 } 383 }
@@ -429,8 +429,8 @@ mod m {
429} 429}
430"#, 430"#,
431 expect![[r#" 431 expect![[r#"
432 st Bar
433 fn quux() fn quux() 432 fn quux() fn quux()
433 st Bar
434 "#]], 434 "#]],
435 ); 435 );
436 } 436 }
@@ -475,8 +475,8 @@ fn foo() {
475 check( 475 check(
476 r#"impl S { fn foo(&self) { <|> } }"#, 476 r#"impl S { fn foo(&self) { <|> } }"#,
477 expect![[r#" 477 expect![[r#"
478 tp Self
479 bn self &{unknown} 478 bn self &{unknown}
479 tp Self
480 "#]], 480 "#]],
481 ); 481 );
482 } 482 }
@@ -495,9 +495,9 @@ use prelude::*;
495mod prelude { struct Option; } 495mod prelude { struct Option; }
496"#, 496"#,
497 expect![[r#" 497 expect![[r#"
498 st Option
499 fn foo() fn foo() 498 fn foo() fn foo()
500 md std 499 md std
500 st Option
501 "#]], 501 "#]],
502 ); 502 );
503 } 503 }
@@ -522,10 +522,10 @@ use prelude::*;
522mod prelude { struct String; } 522mod prelude { struct String; }
523"#, 523"#,
524 expect![[r#" 524 expect![[r#"
525 st String
526 md core
527 fn foo() fn foo() 525 fn foo() fn foo()
528 md std 526 md std
527 md core
528 st String
529 "#]], 529 "#]],
530 ); 530 );
531 } 531 }
@@ -551,13 +551,13 @@ mod m2 {
551fn main() { let v = <|> } 551fn main() { let v = <|> }
552"#, 552"#,
553 expect![[r##" 553 expect![[r##"
554 ma bar!(…) macro_rules! bar 554 md m1
555 ma baz!(…) #[macro_export] 555 ma baz!(…) #[macro_export]
556 macro_rules! baz 556 macro_rules! baz
557 ma foo!(…) macro_rules! foo
558 md m1
559 md m2
560 fn main() fn main() 557 fn main() fn main()
558 md m2
559 ma bar!(…) macro_rules! bar
560 ma foo!(…) macro_rules! foo
561 "##]], 561 "##]],
562 ); 562 );
563 } 563 }
@@ -570,8 +570,8 @@ macro_rules! foo { () => {} }
570fn foo() { <|> } 570fn foo() { <|> }
571"#, 571"#,
572 expect![[r#" 572 expect![[r#"
573 ma foo!(…) macro_rules! foo
574 fn foo() fn foo() 573 fn foo() fn foo()
574 ma foo!(…) macro_rules! foo
575 "#]], 575 "#]],
576 ); 576 );
577 } 577 }
@@ -584,8 +584,8 @@ macro_rules! foo { () => {} }
584fn main() { let x: <|> } 584fn main() { let x: <|> }
585"#, 585"#,
586 expect![[r#" 586 expect![[r#"
587 ma foo!(…) macro_rules! foo
588 fn main() fn main() 587 fn main() fn main()
588 ma foo!(…) macro_rules! foo
589 "#]], 589 "#]],
590 ); 590 );
591 } 591 }
@@ -598,8 +598,8 @@ macro_rules! foo { () => {} }
598fn main() { <|> } 598fn main() { <|> }
599"#, 599"#,
600 expect![[r#" 600 expect![[r#"
601 ma foo!(…) macro_rules! foo
602 fn main() fn main() 601 fn main() fn main()
602 ma foo!(…) macro_rules! foo
603 "#]], 603 "#]],
604 ); 604 );
605 } 605 }
@@ -631,10 +631,10 @@ fn quux(x: i32) {
631} 631}
632"#, 632"#,
633 expect![[r#" 633 expect![[r#"
634 ma m!(…) macro_rules! m
635 fn quux(…) fn quux(x: i32)
636 bn x i32
637 bn y i32 634 bn y i32
635 bn x i32
636 fn quux(…) fn quux(x: i32)
637 ma m!(…) macro_rules! m
638 "#]], 638 "#]],
639 ); 639 );
640 } 640 }
@@ -650,10 +650,10 @@ fn quux(x: i32) {
650} 650}
651", 651",
652 expect![[r#" 652 expect![[r#"
653 ma m!(…) macro_rules! m
654 fn quux(…) fn quux(x: i32)
655 bn x i32
656 bn y i32 653 bn y i32
654 bn x i32
655 fn quux(…) fn quux(x: i32)
656 ma m!(…) macro_rules! m
657 "#]], 657 "#]],
658 ); 658 );
659 } 659 }
@@ -669,10 +669,10 @@ fn quux(x: i32) {
669} 669}
670"#, 670"#,
671 expect![[r#" 671 expect![[r#"
672 ma m!(…) macro_rules! m
673 fn quux(…) fn quux(x: i32)
674 bn x i32
675 bn y i32 672 bn y i32
673 bn x i32
674 fn quux(…) fn quux(x: i32)
675 ma m!(…) macro_rules! m
676 "#]], 676 "#]],
677 ); 677 );
678 } 678 }
@@ -686,8 +686,8 @@ use spam::Quux;
686fn main() { <|> } 686fn main() { <|> }
687"#, 687"#,
688 expect![[r#" 688 expect![[r#"
689 ?? Quux
690 fn main() fn main() 689 fn main() fn main()
690 ?? Quux
691 "#]], 691 "#]],
692 ); 692 );
693 } 693 }
@@ -703,10 +703,10 @@ fn main() {
703} 703}
704"#, 704"#,
705 expect![[r#" 705 expect![[r#"
706 en Foo
707 ev Foo::Bar () 706 ev Foo::Bar ()
708 ev Foo::Baz () 707 ev Foo::Baz ()
709 ev Foo::Quux () 708 ev Foo::Quux ()
709 en Foo
710 "#]], 710 "#]],
711 ) 711 )
712 } 712 }
@@ -723,10 +723,10 @@ fn main() {
723} 723}
724"#, 724"#,
725 expect![[r#" 725 expect![[r#"
726 en Foo
727 ev Foo::Bar () 726 ev Foo::Bar ()
728 ev Foo::Baz () 727 ev Foo::Baz ()
729 ev Foo::Quux () 728 ev Foo::Quux ()
729 en Foo
730 "#]], 730 "#]],
731 ) 731 )
732 } 732 }
@@ -739,10 +739,10 @@ enum Foo { Bar, Baz, Quux }
739fn main() { let foo: Foo = Q<|> } 739fn main() { let foo: Foo = Q<|> }
740"#, 740"#,
741 expect![[r#" 741 expect![[r#"
742 en Foo
743 ev Foo::Bar () 742 ev Foo::Bar ()
744 ev Foo::Baz () 743 ev Foo::Baz ()
745 ev Foo::Quux () 744 ev Foo::Quux ()
745 en Foo
746 fn main() fn main() 746 fn main() fn main()
747 "#]], 747 "#]],
748 ) 748 )
@@ -756,9 +756,9 @@ mod m { pub enum E { V } }
756fn f() -> m::E { V<|> } 756fn f() -> m::E { V<|> }
757"#, 757"#,
758 expect![[r#" 758 expect![[r#"
759 fn f() fn f() -> m::E
760 md m
761 ev m::E::V () 759 ev m::E::V ()
760 md m
761 fn f() fn f() -> m::E
762 "#]], 762 "#]],
763 ) 763 )
764 } 764 }
@@ -785,9 +785,9 @@ struct MyStruct {}
785impl My<|> 785impl My<|>
786"#, 786"#,
787 expect![[r#" 787 expect![[r#"
788 st MyStruct
789 tt MyTrait
790 tp Self 788 tp Self
789 tt MyTrait
790 st MyStruct
791 "#]], 791 "#]],
792 ) 792 )
793 } 793 }
@@ -919,13 +919,13 @@ fn main() {
919} 919}
920"#, 920"#,
921 expect![[r#" 921 expect![[r#"
922 st FirstStruct 922 fn main() fn main()
923 st SecondStruct 923 st SecondStruct
924 st FirstStruct
924 md dep 925 md dep
925 st dep::some_module::ThirdStruct 926 st dep::some_module::ThirdStruct
926 st dep::some_module::AfterThirdStruct 927 st dep::some_module::AfterThirdStruct
927 st dep::some_module::ThiiiiiirdStruct 928 st dep::some_module::ThiiiiiirdStruct
928 fn main() fn main()
929 "#]], 929 "#]],
930 ); 930 );
931 } 931 }
diff --git a/crates/completion/src/test_utils.rs b/crates/completion/src/test_utils.rs
index db896b2df..eb0c16f52 100644
--- a/crates/completion/src/test_utils.rs
+++ b/crates/completion/src/test_utils.rs
@@ -47,9 +47,8 @@ pub(crate) fn completion_list_with_config(
47 code: &str, 47 code: &str,
48 kind: CompletionKind, 48 kind: CompletionKind,
49) -> String { 49) -> String {
50 let mut kind_completions: Vec<CompletionItem> = 50 let kind_completions: Vec<CompletionItem> =
51 get_all_items(config, code).into_iter().filter(|c| c.completion_kind == kind).collect(); 51 get_all_items(config, code).into_iter().filter(|c| c.completion_kind == kind).collect();
52 kind_completions.sort_by_key(|c| c.label().to_owned());
53 let label_width = kind_completions 52 let label_width = kind_completions
54 .iter() 53 .iter()
55 .map(|it| monospace_width(it.label())) 54 .map(|it| monospace_width(it.label()))