diff options
Diffstat (limited to 'crates/ra_ide/src/completion')
-rw-r--r-- | crates/ra_ide/src/completion/complete_attribute.rs | 312 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_dot.rs | 116 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_fn_param.rs | 12 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_pattern.rs | 28 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_postfix.rs | 220 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_qualified_path.rs | 68 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_record.rs | 314 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_snippet.rs | 16 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_trait_impl.rs | 44 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/complete_unqualified_path.rs | 262 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/presentation.rs | 217 | ||||
-rw-r--r-- | crates/ra_ide/src/completion/test_utils.rs | 6 |
12 files changed, 809 insertions, 806 deletions
diff --git a/crates/ra_ide/src/completion/complete_attribute.rs b/crates/ra_ide/src/completion/complete_attribute.rs index ade17a1ff..6beeca457 100644 --- a/crates/ra_ide/src/completion/complete_attribute.rs +++ b/crates/ra_ide/src/completion/complete_attribute.rs | |||
@@ -333,69 +333,69 @@ mod tests { | |||
333 | [ | 333 | [ |
334 | CompletionItem { | 334 | CompletionItem { |
335 | label: "Clone", | 335 | label: "Clone", |
336 | source_range: 30..30, | 336 | source_range: 9..9, |
337 | delete: 30..30, | 337 | delete: 9..9, |
338 | insert: "Clone", | 338 | insert: "Clone", |
339 | kind: Attribute, | 339 | kind: Attribute, |
340 | }, | 340 | }, |
341 | CompletionItem { | 341 | CompletionItem { |
342 | label: "Copy, Clone", | 342 | label: "Copy, Clone", |
343 | source_range: 30..30, | 343 | source_range: 9..9, |
344 | delete: 30..30, | 344 | delete: 9..9, |
345 | insert: "Copy, Clone", | 345 | insert: "Copy, Clone", |
346 | kind: Attribute, | 346 | kind: Attribute, |
347 | }, | 347 | }, |
348 | CompletionItem { | 348 | CompletionItem { |
349 | label: "Debug", | 349 | label: "Debug", |
350 | source_range: 30..30, | 350 | source_range: 9..9, |
351 | delete: 30..30, | 351 | delete: 9..9, |
352 | insert: "Debug", | 352 | insert: "Debug", |
353 | kind: Attribute, | 353 | kind: Attribute, |
354 | }, | 354 | }, |
355 | CompletionItem { | 355 | CompletionItem { |
356 | label: "Default", | 356 | label: "Default", |
357 | source_range: 30..30, | 357 | source_range: 9..9, |
358 | delete: 30..30, | 358 | delete: 9..9, |
359 | insert: "Default", | 359 | insert: "Default", |
360 | kind: Attribute, | 360 | kind: Attribute, |
361 | }, | 361 | }, |
362 | CompletionItem { | 362 | CompletionItem { |
363 | label: "Eq, PartialEq", | 363 | label: "Eq, PartialEq", |
364 | source_range: 30..30, | 364 | source_range: 9..9, |
365 | delete: 30..30, | 365 | delete: 9..9, |
366 | insert: "Eq, PartialEq", | 366 | insert: "Eq, PartialEq", |
367 | kind: Attribute, | 367 | kind: Attribute, |
368 | }, | 368 | }, |
369 | CompletionItem { | 369 | CompletionItem { |
370 | label: "Hash", | 370 | label: "Hash", |
371 | source_range: 30..30, | 371 | source_range: 9..9, |
372 | delete: 30..30, | 372 | delete: 9..9, |
373 | insert: "Hash", | 373 | insert: "Hash", |
374 | kind: Attribute, | 374 | kind: Attribute, |
375 | }, | 375 | }, |
376 | CompletionItem { | 376 | CompletionItem { |
377 | label: "Ord, PartialOrd, Eq, PartialEq", | 377 | label: "Ord, PartialOrd, Eq, PartialEq", |
378 | source_range: 30..30, | 378 | source_range: 9..9, |
379 | delete: 30..30, | 379 | delete: 9..9, |
380 | insert: "Ord, PartialOrd, Eq, PartialEq", | 380 | insert: "Ord, PartialOrd, Eq, PartialEq", |
381 | kind: Attribute, | 381 | kind: Attribute, |
382 | }, | 382 | }, |
383 | CompletionItem { | 383 | CompletionItem { |
384 | label: "PartialEq", | 384 | label: "PartialEq", |
385 | source_range: 30..30, | 385 | source_range: 9..9, |
386 | delete: 30..30, | 386 | delete: 9..9, |
387 | insert: "PartialEq", | 387 | insert: "PartialEq", |
388 | kind: Attribute, | 388 | kind: Attribute, |
389 | }, | 389 | }, |
390 | CompletionItem { | 390 | CompletionItem { |
391 | label: "PartialOrd, PartialEq", | 391 | label: "PartialOrd, PartialEq", |
392 | source_range: 30..30, | 392 | source_range: 9..9, |
393 | delete: 30..30, | 393 | delete: 9..9, |
394 | insert: "PartialOrd, PartialEq", | 394 | insert: "PartialOrd, PartialEq", |
395 | kind: Attribute, | 395 | kind: Attribute, |
396 | }, | 396 | }, |
397 | ] | 397 | ] |
398 | "### | 398 | "### |
399 | ); | 399 | ); |
400 | } | 400 | } |
401 | 401 | ||
@@ -425,62 +425,62 @@ mod tests { | |||
425 | [ | 425 | [ |
426 | CompletionItem { | 426 | CompletionItem { |
427 | label: "Clone", | 427 | label: "Clone", |
428 | source_range: 59..59, | 428 | source_range: 38..38, |
429 | delete: 59..59, | 429 | delete: 38..38, |
430 | insert: "Clone", | 430 | insert: "Clone", |
431 | kind: Attribute, | 431 | kind: Attribute, |
432 | }, | 432 | }, |
433 | CompletionItem { | 433 | CompletionItem { |
434 | label: "Copy, Clone", | 434 | label: "Copy, Clone", |
435 | source_range: 59..59, | 435 | source_range: 38..38, |
436 | delete: 59..59, | 436 | delete: 38..38, |
437 | insert: "Copy, Clone", | 437 | insert: "Copy, Clone", |
438 | kind: Attribute, | 438 | kind: Attribute, |
439 | }, | 439 | }, |
440 | CompletionItem { | 440 | CompletionItem { |
441 | label: "Debug", | 441 | label: "Debug", |
442 | source_range: 59..59, | 442 | source_range: 38..38, |
443 | delete: 59..59, | 443 | delete: 38..38, |
444 | insert: "Debug", | 444 | insert: "Debug", |
445 | kind: Attribute, | 445 | kind: Attribute, |
446 | }, | 446 | }, |
447 | CompletionItem { | 447 | CompletionItem { |
448 | label: "Default", | 448 | label: "Default", |
449 | source_range: 59..59, | 449 | source_range: 38..38, |
450 | delete: 59..59, | 450 | delete: 38..38, |
451 | insert: "Default", | 451 | insert: "Default", |
452 | kind: Attribute, | 452 | kind: Attribute, |
453 | }, | 453 | }, |
454 | CompletionItem { | 454 | CompletionItem { |
455 | label: "Eq", | 455 | label: "Eq", |
456 | source_range: 59..59, | 456 | source_range: 38..38, |
457 | delete: 59..59, | 457 | delete: 38..38, |
458 | insert: "Eq", | 458 | insert: "Eq", |
459 | kind: Attribute, | 459 | kind: Attribute, |
460 | }, | 460 | }, |
461 | CompletionItem { | 461 | CompletionItem { |
462 | label: "Hash", | 462 | label: "Hash", |
463 | source_range: 59..59, | 463 | source_range: 38..38, |
464 | delete: 59..59, | 464 | delete: 38..38, |
465 | insert: "Hash", | 465 | insert: "Hash", |
466 | kind: Attribute, | 466 | kind: Attribute, |
467 | }, | 467 | }, |
468 | CompletionItem { | 468 | CompletionItem { |
469 | label: "Ord, PartialOrd, Eq", | 469 | label: "Ord, PartialOrd, Eq", |
470 | source_range: 59..59, | 470 | source_range: 38..38, |
471 | delete: 59..59, | 471 | delete: 38..38, |
472 | insert: "Ord, PartialOrd, Eq", | 472 | insert: "Ord, PartialOrd, Eq", |
473 | kind: Attribute, | 473 | kind: Attribute, |
474 | }, | 474 | }, |
475 | CompletionItem { | 475 | CompletionItem { |
476 | label: "PartialOrd", | 476 | label: "PartialOrd", |
477 | source_range: 59..59, | 477 | source_range: 38..38, |
478 | delete: 59..59, | 478 | delete: 38..38, |
479 | insert: "PartialOrd", | 479 | insert: "PartialOrd", |
480 | kind: Attribute, | 480 | kind: Attribute, |
481 | }, | 481 | }, |
482 | ] | 482 | ] |
483 | "### | 483 | "### |
484 | ); | 484 | ); |
485 | } | 485 | } |
486 | 486 | ||
@@ -496,207 +496,207 @@ mod tests { | |||
496 | [ | 496 | [ |
497 | CompletionItem { | 497 | CompletionItem { |
498 | label: "allow(…)", | 498 | label: "allow(…)", |
499 | source_range: 19..19, | 499 | source_range: 2..2, |
500 | delete: 19..19, | 500 | delete: 2..2, |
501 | insert: "allow(${0:lint})", | 501 | insert: "allow(${0:lint})", |
502 | kind: Attribute, | 502 | kind: Attribute, |
503 | lookup: "allow", | 503 | lookup: "allow", |
504 | }, | 504 | }, |
505 | CompletionItem { | 505 | CompletionItem { |
506 | label: "cfg(…)", | 506 | label: "cfg(…)", |
507 | source_range: 19..19, | 507 | source_range: 2..2, |
508 | delete: 19..19, | 508 | delete: 2..2, |
509 | insert: "cfg(${0:predicate})", | 509 | insert: "cfg(${0:predicate})", |
510 | kind: Attribute, | 510 | kind: Attribute, |
511 | lookup: "cfg", | 511 | lookup: "cfg", |
512 | }, | 512 | }, |
513 | CompletionItem { | 513 | CompletionItem { |
514 | label: "cfg_attr(…)", | 514 | label: "cfg_attr(…)", |
515 | source_range: 19..19, | 515 | source_range: 2..2, |
516 | delete: 19..19, | 516 | delete: 2..2, |
517 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 517 | insert: "cfg_attr(${1:predicate}, ${0:attr})", |
518 | kind: Attribute, | 518 | kind: Attribute, |
519 | lookup: "cfg_attr", | 519 | lookup: "cfg_attr", |
520 | }, | 520 | }, |
521 | CompletionItem { | 521 | CompletionItem { |
522 | label: "deny(…)", | 522 | label: "deny(…)", |
523 | source_range: 19..19, | 523 | source_range: 2..2, |
524 | delete: 19..19, | 524 | delete: 2..2, |
525 | insert: "deny(${0:lint})", | 525 | insert: "deny(${0:lint})", |
526 | kind: Attribute, | 526 | kind: Attribute, |
527 | lookup: "deny", | 527 | lookup: "deny", |
528 | }, | 528 | }, |
529 | CompletionItem { | 529 | CompletionItem { |
530 | label: "deprecated = \"…\"", | 530 | label: "deprecated = \"…\"", |
531 | source_range: 19..19, | 531 | source_range: 2..2, |
532 | delete: 19..19, | 532 | delete: 2..2, |
533 | insert: "deprecated = \"${0:reason}\"", | 533 | insert: "deprecated = \"${0:reason}\"", |
534 | kind: Attribute, | 534 | kind: Attribute, |
535 | lookup: "deprecated", | 535 | lookup: "deprecated", |
536 | }, | 536 | }, |
537 | CompletionItem { | 537 | CompletionItem { |
538 | label: "derive(…)", | 538 | label: "derive(…)", |
539 | source_range: 19..19, | 539 | source_range: 2..2, |
540 | delete: 19..19, | 540 | delete: 2..2, |
541 | insert: "derive(${0:Debug})", | 541 | insert: "derive(${0:Debug})", |
542 | kind: Attribute, | 542 | kind: Attribute, |
543 | lookup: "derive", | 543 | lookup: "derive", |
544 | }, | 544 | }, |
545 | CompletionItem { | 545 | CompletionItem { |
546 | label: "doc = \"…\"", | 546 | label: "doc = \"…\"", |
547 | source_range: 19..19, | 547 | source_range: 2..2, |
548 | delete: 19..19, | 548 | delete: 2..2, |
549 | insert: "doc = \"${0:docs}\"", | 549 | insert: "doc = \"${0:docs}\"", |
550 | kind: Attribute, | 550 | kind: Attribute, |
551 | lookup: "doc", | 551 | lookup: "doc", |
552 | }, | 552 | }, |
553 | CompletionItem { | 553 | CompletionItem { |
554 | label: "forbid(…)", | 554 | label: "forbid(…)", |
555 | source_range: 19..19, | 555 | source_range: 2..2, |
556 | delete: 19..19, | 556 | delete: 2..2, |
557 | insert: "forbid(${0:lint})", | 557 | insert: "forbid(${0:lint})", |
558 | kind: Attribute, | 558 | kind: Attribute, |
559 | lookup: "forbid", | 559 | lookup: "forbid", |
560 | }, | 560 | }, |
561 | CompletionItem { | 561 | CompletionItem { |
562 | label: "ignore(…)", | 562 | label: "ignore(…)", |
563 | source_range: 19..19, | 563 | source_range: 2..2, |
564 | delete: 19..19, | 564 | delete: 2..2, |
565 | insert: "ignore(${0:lint})", | 565 | insert: "ignore(${0:lint})", |
566 | kind: Attribute, | 566 | kind: Attribute, |
567 | lookup: "ignore", | 567 | lookup: "ignore", |
568 | }, | 568 | }, |
569 | CompletionItem { | 569 | CompletionItem { |
570 | label: "inline(…)", | 570 | label: "inline(…)", |
571 | source_range: 19..19, | 571 | source_range: 2..2, |
572 | delete: 19..19, | 572 | delete: 2..2, |
573 | insert: "inline(${0:lint})", | 573 | insert: "inline(${0:lint})", |
574 | kind: Attribute, | 574 | kind: Attribute, |
575 | lookup: "inline", | 575 | lookup: "inline", |
576 | }, | 576 | }, |
577 | CompletionItem { | 577 | CompletionItem { |
578 | label: "link", | 578 | label: "link", |
579 | source_range: 19..19, | 579 | source_range: 2..2, |
580 | delete: 19..19, | 580 | delete: 2..2, |
581 | insert: "link", | 581 | insert: "link", |
582 | kind: Attribute, | 582 | kind: Attribute, |
583 | }, | 583 | }, |
584 | CompletionItem { | 584 | CompletionItem { |
585 | label: "link_name = \"…\"", | 585 | label: "link_name = \"…\"", |
586 | source_range: 19..19, | 586 | source_range: 2..2, |
587 | delete: 19..19, | 587 | delete: 2..2, |
588 | insert: "link_name = \"${0:symbol_name}\"", | 588 | insert: "link_name = \"${0:symbol_name}\"", |
589 | kind: Attribute, | 589 | kind: Attribute, |
590 | lookup: "link_name", | 590 | lookup: "link_name", |
591 | }, | 591 | }, |
592 | CompletionItem { | 592 | CompletionItem { |
593 | label: "macro_export", | 593 | label: "macro_export", |
594 | source_range: 19..19, | 594 | source_range: 2..2, |
595 | delete: 19..19, | 595 | delete: 2..2, |
596 | insert: "macro_export", | 596 | insert: "macro_export", |
597 | kind: Attribute, | 597 | kind: Attribute, |
598 | }, | 598 | }, |
599 | CompletionItem { | 599 | CompletionItem { |
600 | label: "macro_use", | 600 | label: "macro_use", |
601 | source_range: 19..19, | 601 | source_range: 2..2, |
602 | delete: 19..19, | 602 | delete: 2..2, |
603 | insert: "macro_use", | 603 | insert: "macro_use", |
604 | kind: Attribute, | 604 | kind: Attribute, |
605 | }, | 605 | }, |
606 | CompletionItem { | 606 | CompletionItem { |
607 | label: "must_use = \"…\"", | 607 | label: "must_use = \"…\"", |
608 | source_range: 19..19, | 608 | source_range: 2..2, |
609 | delete: 19..19, | 609 | delete: 2..2, |
610 | insert: "must_use = \"${0:reason}\"", | 610 | insert: "must_use = \"${0:reason}\"", |
611 | kind: Attribute, | 611 | kind: Attribute, |
612 | lookup: "must_use", | 612 | lookup: "must_use", |
613 | }, | 613 | }, |
614 | CompletionItem { | 614 | CompletionItem { |
615 | label: "no_mangle", | 615 | label: "no_mangle", |
616 | source_range: 19..19, | 616 | source_range: 2..2, |
617 | delete: 19..19, | 617 | delete: 2..2, |
618 | insert: "no_mangle", | 618 | insert: "no_mangle", |
619 | kind: Attribute, | 619 | kind: Attribute, |
620 | }, | 620 | }, |
621 | CompletionItem { | 621 | CompletionItem { |
622 | label: "non_exhaustive", | 622 | label: "non_exhaustive", |
623 | source_range: 19..19, | 623 | source_range: 2..2, |
624 | delete: 19..19, | 624 | delete: 2..2, |
625 | insert: "non_exhaustive", | 625 | insert: "non_exhaustive", |
626 | kind: Attribute, | 626 | kind: Attribute, |
627 | }, | 627 | }, |
628 | CompletionItem { | 628 | CompletionItem { |
629 | label: "path = \"…\"", | 629 | label: "path = \"…\"", |
630 | source_range: 19..19, | 630 | source_range: 2..2, |
631 | delete: 19..19, | 631 | delete: 2..2, |
632 | insert: "path =\"${0:path}\"", | 632 | insert: "path =\"${0:path}\"", |
633 | kind: Attribute, | 633 | kind: Attribute, |
634 | lookup: "path", | 634 | lookup: "path", |
635 | }, | 635 | }, |
636 | CompletionItem { | 636 | CompletionItem { |
637 | label: "proc_macro", | 637 | label: "proc_macro", |
638 | source_range: 19..19, | 638 | source_range: 2..2, |
639 | delete: 19..19, | 639 | delete: 2..2, |
640 | insert: "proc_macro", | 640 | insert: "proc_macro", |
641 | kind: Attribute, | 641 | kind: Attribute, |
642 | }, | 642 | }, |
643 | CompletionItem { | 643 | CompletionItem { |
644 | label: "proc_macro_attribute", | 644 | label: "proc_macro_attribute", |
645 | source_range: 19..19, | 645 | source_range: 2..2, |
646 | delete: 19..19, | 646 | delete: 2..2, |
647 | insert: "proc_macro_attribute", | 647 | insert: "proc_macro_attribute", |
648 | kind: Attribute, | 648 | kind: Attribute, |
649 | }, | 649 | }, |
650 | CompletionItem { | 650 | CompletionItem { |
651 | label: "proc_macro_derive(…)", | 651 | label: "proc_macro_derive(…)", |
652 | source_range: 19..19, | 652 | source_range: 2..2, |
653 | delete: 19..19, | 653 | delete: 2..2, |
654 | insert: "proc_macro_derive(${0:Trait})", | 654 | insert: "proc_macro_derive(${0:Trait})", |
655 | kind: Attribute, | 655 | kind: Attribute, |
656 | lookup: "proc_macro_derive", | 656 | lookup: "proc_macro_derive", |
657 | }, | 657 | }, |
658 | CompletionItem { | 658 | CompletionItem { |
659 | label: "repr(…)", | 659 | label: "repr(…)", |
660 | source_range: 19..19, | 660 | source_range: 2..2, |
661 | delete: 19..19, | 661 | delete: 2..2, |
662 | insert: "repr(${0:C})", | 662 | insert: "repr(${0:C})", |
663 | kind: Attribute, | 663 | kind: Attribute, |
664 | lookup: "repr", | 664 | lookup: "repr", |
665 | }, | 665 | }, |
666 | CompletionItem { | 666 | CompletionItem { |
667 | label: "should_panic(…)", | 667 | label: "should_panic(…)", |
668 | source_range: 19..19, | 668 | source_range: 2..2, |
669 | delete: 19..19, | 669 | delete: 2..2, |
670 | insert: "should_panic(expected = \"${0:reason}\")", | 670 | insert: "should_panic(expected = \"${0:reason}\")", |
671 | kind: Attribute, | 671 | kind: Attribute, |
672 | lookup: "should_panic", | 672 | lookup: "should_panic", |
673 | }, | 673 | }, |
674 | CompletionItem { | 674 | CompletionItem { |
675 | label: "target_feature = \"…\"", | 675 | label: "target_feature = \"…\"", |
676 | source_range: 19..19, | 676 | source_range: 2..2, |
677 | delete: 19..19, | 677 | delete: 2..2, |
678 | insert: "target_feature = \"${0:feature}\"", | 678 | insert: "target_feature = \"${0:feature}\"", |
679 | kind: Attribute, | 679 | kind: Attribute, |
680 | lookup: "target_feature", | 680 | lookup: "target_feature", |
681 | }, | 681 | }, |
682 | CompletionItem { | 682 | CompletionItem { |
683 | label: "test", | 683 | label: "test", |
684 | source_range: 19..19, | 684 | source_range: 2..2, |
685 | delete: 19..19, | 685 | delete: 2..2, |
686 | insert: "test", | 686 | insert: "test", |
687 | kind: Attribute, | 687 | kind: Attribute, |
688 | }, | 688 | }, |
689 | CompletionItem { | 689 | CompletionItem { |
690 | label: "used", | 690 | label: "used", |
691 | source_range: 19..19, | 691 | source_range: 2..2, |
692 | delete: 19..19, | 692 | delete: 2..2, |
693 | insert: "used", | 693 | insert: "used", |
694 | kind: Attribute, | 694 | kind: Attribute, |
695 | }, | 695 | }, |
696 | CompletionItem { | 696 | CompletionItem { |
697 | label: "warn(…)", | 697 | label: "warn(…)", |
698 | source_range: 19..19, | 698 | source_range: 2..2, |
699 | delete: 19..19, | 699 | delete: 2..2, |
700 | insert: "warn(${0:lint})", | 700 | insert: "warn(${0:lint})", |
701 | kind: Attribute, | 701 | kind: Attribute, |
702 | lookup: "warn", | 702 | lookup: "warn", |
@@ -732,252 +732,252 @@ mod tests { | |||
732 | [ | 732 | [ |
733 | CompletionItem { | 733 | CompletionItem { |
734 | label: "allow(…)", | 734 | label: "allow(…)", |
735 | source_range: 20..20, | 735 | source_range: 3..3, |
736 | delete: 20..20, | 736 | delete: 3..3, |
737 | insert: "allow(${0:lint})", | 737 | insert: "allow(${0:lint})", |
738 | kind: Attribute, | 738 | kind: Attribute, |
739 | lookup: "allow", | 739 | lookup: "allow", |
740 | }, | 740 | }, |
741 | CompletionItem { | 741 | CompletionItem { |
742 | label: "cfg(…)", | 742 | label: "cfg(…)", |
743 | source_range: 20..20, | 743 | source_range: 3..3, |
744 | delete: 20..20, | 744 | delete: 3..3, |
745 | insert: "cfg(${0:predicate})", | 745 | insert: "cfg(${0:predicate})", |
746 | kind: Attribute, | 746 | kind: Attribute, |
747 | lookup: "cfg", | 747 | lookup: "cfg", |
748 | }, | 748 | }, |
749 | CompletionItem { | 749 | CompletionItem { |
750 | label: "cfg_attr(…)", | 750 | label: "cfg_attr(…)", |
751 | source_range: 20..20, | 751 | source_range: 3..3, |
752 | delete: 20..20, | 752 | delete: 3..3, |
753 | insert: "cfg_attr(${1:predicate}, ${0:attr})", | 753 | insert: "cfg_attr(${1:predicate}, ${0:attr})", |
754 | kind: Attribute, | 754 | kind: Attribute, |
755 | lookup: "cfg_attr", | 755 | lookup: "cfg_attr", |
756 | }, | 756 | }, |
757 | CompletionItem { | 757 | CompletionItem { |
758 | label: "deny(…)", | 758 | label: "deny(…)", |
759 | source_range: 20..20, | 759 | source_range: 3..3, |
760 | delete: 20..20, | 760 | delete: 3..3, |
761 | insert: "deny(${0:lint})", | 761 | insert: "deny(${0:lint})", |
762 | kind: Attribute, | 762 | kind: Attribute, |
763 | lookup: "deny", | 763 | lookup: "deny", |
764 | }, | 764 | }, |
765 | CompletionItem { | 765 | CompletionItem { |
766 | label: "deprecated = \"…\"", | 766 | label: "deprecated = \"…\"", |
767 | source_range: 20..20, | 767 | source_range: 3..3, |
768 | delete: 20..20, | 768 | delete: 3..3, |
769 | insert: "deprecated = \"${0:reason}\"", | 769 | insert: "deprecated = \"${0:reason}\"", |
770 | kind: Attribute, | 770 | kind: Attribute, |
771 | lookup: "deprecated", | 771 | lookup: "deprecated", |
772 | }, | 772 | }, |
773 | CompletionItem { | 773 | CompletionItem { |
774 | label: "derive(…)", | 774 | label: "derive(…)", |
775 | source_range: 20..20, | 775 | source_range: 3..3, |
776 | delete: 20..20, | 776 | delete: 3..3, |
777 | insert: "derive(${0:Debug})", | 777 | insert: "derive(${0:Debug})", |
778 | kind: Attribute, | 778 | kind: Attribute, |
779 | lookup: "derive", | 779 | lookup: "derive", |
780 | }, | 780 | }, |
781 | CompletionItem { | 781 | CompletionItem { |
782 | label: "doc = \"…\"", | 782 | label: "doc = \"…\"", |
783 | source_range: 20..20, | 783 | source_range: 3..3, |
784 | delete: 20..20, | 784 | delete: 3..3, |
785 | insert: "doc = \"${0:docs}\"", | 785 | insert: "doc = \"${0:docs}\"", |
786 | kind: Attribute, | 786 | kind: Attribute, |
787 | lookup: "doc", | 787 | lookup: "doc", |
788 | }, | 788 | }, |
789 | CompletionItem { | 789 | CompletionItem { |
790 | label: "feature(…)", | 790 | label: "feature(…)", |
791 | source_range: 20..20, | 791 | source_range: 3..3, |
792 | delete: 20..20, | 792 | delete: 3..3, |
793 | insert: "feature(${0:flag})", | 793 | insert: "feature(${0:flag})", |
794 | kind: Attribute, | 794 | kind: Attribute, |
795 | lookup: "feature", | 795 | lookup: "feature", |
796 | }, | 796 | }, |
797 | CompletionItem { | 797 | CompletionItem { |
798 | label: "forbid(…)", | 798 | label: "forbid(…)", |
799 | source_range: 20..20, | 799 | source_range: 3..3, |
800 | delete: 20..20, | 800 | delete: 3..3, |
801 | insert: "forbid(${0:lint})", | 801 | insert: "forbid(${0:lint})", |
802 | kind: Attribute, | 802 | kind: Attribute, |
803 | lookup: "forbid", | 803 | lookup: "forbid", |
804 | }, | 804 | }, |
805 | CompletionItem { | 805 | CompletionItem { |
806 | label: "global_allocator", | 806 | label: "global_allocator", |
807 | source_range: 20..20, | 807 | source_range: 3..3, |
808 | delete: 20..20, | 808 | delete: 3..3, |
809 | insert: "global_allocator", | 809 | insert: "global_allocator", |
810 | kind: Attribute, | 810 | kind: Attribute, |
811 | }, | 811 | }, |
812 | CompletionItem { | 812 | CompletionItem { |
813 | label: "ignore(…)", | 813 | label: "ignore(…)", |
814 | source_range: 20..20, | 814 | source_range: 3..3, |
815 | delete: 20..20, | 815 | delete: 3..3, |
816 | insert: "ignore(${0:lint})", | 816 | insert: "ignore(${0:lint})", |
817 | kind: Attribute, | 817 | kind: Attribute, |
818 | lookup: "ignore", | 818 | lookup: "ignore", |
819 | }, | 819 | }, |
820 | CompletionItem { | 820 | CompletionItem { |
821 | label: "inline(…)", | 821 | label: "inline(…)", |
822 | source_range: 20..20, | 822 | source_range: 3..3, |
823 | delete: 20..20, | 823 | delete: 3..3, |
824 | insert: "inline(${0:lint})", | 824 | insert: "inline(${0:lint})", |
825 | kind: Attribute, | 825 | kind: Attribute, |
826 | lookup: "inline", | 826 | lookup: "inline", |
827 | }, | 827 | }, |
828 | CompletionItem { | 828 | CompletionItem { |
829 | label: "link", | 829 | label: "link", |
830 | source_range: 20..20, | 830 | source_range: 3..3, |
831 | delete: 20..20, | 831 | delete: 3..3, |
832 | insert: "link", | 832 | insert: "link", |
833 | kind: Attribute, | 833 | kind: Attribute, |
834 | }, | 834 | }, |
835 | CompletionItem { | 835 | CompletionItem { |
836 | label: "link_name = \"…\"", | 836 | label: "link_name = \"…\"", |
837 | source_range: 20..20, | 837 | source_range: 3..3, |
838 | delete: 20..20, | 838 | delete: 3..3, |
839 | insert: "link_name = \"${0:symbol_name}\"", | 839 | insert: "link_name = \"${0:symbol_name}\"", |
840 | kind: Attribute, | 840 | kind: Attribute, |
841 | lookup: "link_name", | 841 | lookup: "link_name", |
842 | }, | 842 | }, |
843 | CompletionItem { | 843 | CompletionItem { |
844 | label: "macro_export", | 844 | label: "macro_export", |
845 | source_range: 20..20, | 845 | source_range: 3..3, |
846 | delete: 20..20, | 846 | delete: 3..3, |
847 | insert: "macro_export", | 847 | insert: "macro_export", |
848 | kind: Attribute, | 848 | kind: Attribute, |
849 | }, | 849 | }, |
850 | CompletionItem { | 850 | CompletionItem { |
851 | label: "macro_use", | 851 | label: "macro_use", |
852 | source_range: 20..20, | 852 | source_range: 3..3, |
853 | delete: 20..20, | 853 | delete: 3..3, |
854 | insert: "macro_use", | 854 | insert: "macro_use", |
855 | kind: Attribute, | 855 | kind: Attribute, |
856 | }, | 856 | }, |
857 | CompletionItem { | 857 | CompletionItem { |
858 | label: "must_use = \"…\"", | 858 | label: "must_use = \"…\"", |
859 | source_range: 20..20, | 859 | source_range: 3..3, |
860 | delete: 20..20, | 860 | delete: 3..3, |
861 | insert: "must_use = \"${0:reason}\"", | 861 | insert: "must_use = \"${0:reason}\"", |
862 | kind: Attribute, | 862 | kind: Attribute, |
863 | lookup: "must_use", | 863 | lookup: "must_use", |
864 | }, | 864 | }, |
865 | CompletionItem { | 865 | CompletionItem { |
866 | label: "no_mangle", | 866 | label: "no_mangle", |
867 | source_range: 20..20, | 867 | source_range: 3..3, |
868 | delete: 20..20, | 868 | delete: 3..3, |
869 | insert: "no_mangle", | 869 | insert: "no_mangle", |
870 | kind: Attribute, | 870 | kind: Attribute, |
871 | }, | 871 | }, |
872 | CompletionItem { | 872 | CompletionItem { |
873 | label: "no_std", | 873 | label: "no_std", |
874 | source_range: 20..20, | 874 | source_range: 3..3, |
875 | delete: 20..20, | 875 | delete: 3..3, |
876 | insert: "no_std", | 876 | insert: "no_std", |
877 | kind: Attribute, | 877 | kind: Attribute, |
878 | }, | 878 | }, |
879 | CompletionItem { | 879 | CompletionItem { |
880 | label: "non_exhaustive", | 880 | label: "non_exhaustive", |
881 | source_range: 20..20, | 881 | source_range: 3..3, |
882 | delete: 20..20, | 882 | delete: 3..3, |
883 | insert: "non_exhaustive", | 883 | insert: "non_exhaustive", |
884 | kind: Attribute, | 884 | kind: Attribute, |
885 | }, | 885 | }, |
886 | CompletionItem { | 886 | CompletionItem { |
887 | label: "panic_handler", | 887 | label: "panic_handler", |
888 | source_range: 20..20, | 888 | source_range: 3..3, |
889 | delete: 20..20, | 889 | delete: 3..3, |
890 | insert: "panic_handler", | 890 | insert: "panic_handler", |
891 | kind: Attribute, | 891 | kind: Attribute, |
892 | }, | 892 | }, |
893 | CompletionItem { | 893 | CompletionItem { |
894 | label: "path = \"…\"", | 894 | label: "path = \"…\"", |
895 | source_range: 20..20, | 895 | source_range: 3..3, |
896 | delete: 20..20, | 896 | delete: 3..3, |
897 | insert: "path =\"${0:path}\"", | 897 | insert: "path =\"${0:path}\"", |
898 | kind: Attribute, | 898 | kind: Attribute, |
899 | lookup: "path", | 899 | lookup: "path", |
900 | }, | 900 | }, |
901 | CompletionItem { | 901 | CompletionItem { |
902 | label: "proc_macro", | 902 | label: "proc_macro", |
903 | source_range: 20..20, | 903 | source_range: 3..3, |
904 | delete: 20..20, | 904 | delete: 3..3, |
905 | insert: "proc_macro", | 905 | insert: "proc_macro", |
906 | kind: Attribute, | 906 | kind: Attribute, |
907 | }, | 907 | }, |
908 | CompletionItem { | 908 | CompletionItem { |
909 | label: "proc_macro_attribute", | 909 | label: "proc_macro_attribute", |
910 | source_range: 20..20, | 910 | source_range: 3..3, |
911 | delete: 20..20, | 911 | delete: 3..3, |
912 | insert: "proc_macro_attribute", | 912 | insert: "proc_macro_attribute", |
913 | kind: Attribute, | 913 | kind: Attribute, |
914 | }, | 914 | }, |
915 | CompletionItem { | 915 | CompletionItem { |
916 | label: "proc_macro_derive(…)", | 916 | label: "proc_macro_derive(…)", |
917 | source_range: 20..20, | 917 | source_range: 3..3, |
918 | delete: 20..20, | 918 | delete: 3..3, |
919 | insert: "proc_macro_derive(${0:Trait})", | 919 | insert: "proc_macro_derive(${0:Trait})", |
920 | kind: Attribute, | 920 | kind: Attribute, |
921 | lookup: "proc_macro_derive", | 921 | lookup: "proc_macro_derive", |
922 | }, | 922 | }, |
923 | CompletionItem { | 923 | CompletionItem { |
924 | label: "recursion_limit = …", | 924 | label: "recursion_limit = …", |
925 | source_range: 20..20, | 925 | source_range: 3..3, |
926 | delete: 20..20, | 926 | delete: 3..3, |
927 | insert: "recursion_limit = ${0:128}", | 927 | insert: "recursion_limit = ${0:128}", |
928 | kind: Attribute, | 928 | kind: Attribute, |
929 | lookup: "recursion_limit", | 929 | lookup: "recursion_limit", |
930 | }, | 930 | }, |
931 | CompletionItem { | 931 | CompletionItem { |
932 | label: "repr(…)", | 932 | label: "repr(…)", |
933 | source_range: 20..20, | 933 | source_range: 3..3, |
934 | delete: 20..20, | 934 | delete: 3..3, |
935 | insert: "repr(${0:C})", | 935 | insert: "repr(${0:C})", |
936 | kind: Attribute, | 936 | kind: Attribute, |
937 | lookup: "repr", | 937 | lookup: "repr", |
938 | }, | 938 | }, |
939 | CompletionItem { | 939 | CompletionItem { |
940 | label: "should_panic(…)", | 940 | label: "should_panic(…)", |
941 | source_range: 20..20, | 941 | source_range: 3..3, |
942 | delete: 20..20, | 942 | delete: 3..3, |
943 | insert: "should_panic(expected = \"${0:reason}\")", | 943 | insert: "should_panic(expected = \"${0:reason}\")", |
944 | kind: Attribute, | 944 | kind: Attribute, |
945 | lookup: "should_panic", | 945 | lookup: "should_panic", |
946 | }, | 946 | }, |
947 | CompletionItem { | 947 | CompletionItem { |
948 | label: "target_feature = \"…\"", | 948 | label: "target_feature = \"…\"", |
949 | source_range: 20..20, | 949 | source_range: 3..3, |
950 | delete: 20..20, | 950 | delete: 3..3, |
951 | insert: "target_feature = \"${0:feature}\"", | 951 | insert: "target_feature = \"${0:feature}\"", |
952 | kind: Attribute, | 952 | kind: Attribute, |
953 | lookup: "target_feature", | 953 | lookup: "target_feature", |
954 | }, | 954 | }, |
955 | CompletionItem { | 955 | CompletionItem { |
956 | label: "test", | 956 | label: "test", |
957 | source_range: 20..20, | 957 | source_range: 3..3, |
958 | delete: 20..20, | 958 | delete: 3..3, |
959 | insert: "test", | 959 | insert: "test", |
960 | kind: Attribute, | 960 | kind: Attribute, |
961 | }, | 961 | }, |
962 | CompletionItem { | 962 | CompletionItem { |
963 | label: "used", | 963 | label: "used", |
964 | source_range: 20..20, | 964 | source_range: 3..3, |
965 | delete: 20..20, | 965 | delete: 3..3, |
966 | insert: "used", | 966 | insert: "used", |
967 | kind: Attribute, | 967 | kind: Attribute, |
968 | }, | 968 | }, |
969 | CompletionItem { | 969 | CompletionItem { |
970 | label: "warn(…)", | 970 | label: "warn(…)", |
971 | source_range: 20..20, | 971 | source_range: 3..3, |
972 | delete: 20..20, | 972 | delete: 3..3, |
973 | insert: "warn(${0:lint})", | 973 | insert: "warn(${0:lint})", |
974 | kind: Attribute, | 974 | kind: Attribute, |
975 | lookup: "warn", | 975 | lookup: "warn", |
976 | }, | 976 | }, |
977 | CompletionItem { | 977 | CompletionItem { |
978 | label: "windows_subsystem = \"…\"", | 978 | label: "windows_subsystem = \"…\"", |
979 | source_range: 20..20, | 979 | source_range: 3..3, |
980 | delete: 20..20, | 980 | delete: 3..3, |
981 | insert: "windows_subsystem = \"${0:subsystem}\"", | 981 | insert: "windows_subsystem = \"${0:subsystem}\"", |
982 | kind: Attribute, | 982 | kind: Attribute, |
983 | lookup: "windows_subsystem", | 983 | lookup: "windows_subsystem", |
diff --git a/crates/ra_ide/src/completion/complete_dot.rs b/crates/ra_ide/src/completion/complete_dot.rs index 05f825c6f..ee4e24fca 100644 --- a/crates/ra_ide/src/completion/complete_dot.rs +++ b/crates/ra_ide/src/completion/complete_dot.rs | |||
@@ -94,8 +94,8 @@ mod tests { | |||
94 | [ | 94 | [ |
95 | CompletionItem { | 95 | CompletionItem { |
96 | label: "the_field", | 96 | label: "the_field", |
97 | source_range: 94..94, | 97 | source_range: 45..45, |
98 | delete: 94..94, | 98 | delete: 45..45, |
99 | insert: "the_field", | 99 | insert: "the_field", |
100 | kind: Field, | 100 | kind: Field, |
101 | detail: "u32", | 101 | detail: "u32", |
@@ -125,8 +125,8 @@ mod tests { | |||
125 | [ | 125 | [ |
126 | CompletionItem { | 126 | CompletionItem { |
127 | label: "foo()", | 127 | label: "foo()", |
128 | source_range: 187..187, | 128 | source_range: 102..102, |
129 | delete: 187..187, | 129 | delete: 102..102, |
130 | insert: "foo()$0", | 130 | insert: "foo()$0", |
131 | kind: Method, | 131 | kind: Method, |
132 | lookup: "foo", | 132 | lookup: "foo", |
@@ -134,8 +134,8 @@ mod tests { | |||
134 | }, | 134 | }, |
135 | CompletionItem { | 135 | CompletionItem { |
136 | label: "the_field", | 136 | label: "the_field", |
137 | source_range: 187..187, | 137 | source_range: 102..102, |
138 | delete: 187..187, | 138 | delete: 102..102, |
139 | insert: "the_field", | 139 | insert: "the_field", |
140 | kind: Field, | 140 | kind: Field, |
141 | detail: "(u32,)", | 141 | detail: "(u32,)", |
@@ -165,8 +165,8 @@ mod tests { | |||
165 | [ | 165 | [ |
166 | CompletionItem { | 166 | CompletionItem { |
167 | label: "foo()", | 167 | label: "foo()", |
168 | source_range: 126..126, | 168 | source_range: 77..77, |
169 | delete: 126..126, | 169 | delete: 77..77, |
170 | insert: "foo()$0", | 170 | insert: "foo()$0", |
171 | kind: Method, | 171 | kind: Method, |
172 | lookup: "foo", | 172 | lookup: "foo", |
@@ -174,8 +174,8 @@ mod tests { | |||
174 | }, | 174 | }, |
175 | CompletionItem { | 175 | CompletionItem { |
176 | label: "the_field", | 176 | label: "the_field", |
177 | source_range: 126..126, | 177 | source_range: 77..77, |
178 | delete: 126..126, | 178 | delete: 77..77, |
179 | insert: "the_field", | 179 | insert: "the_field", |
180 | kind: Field, | 180 | kind: Field, |
181 | detail: "(u32, i32)", | 181 | detail: "(u32, i32)", |
@@ -222,24 +222,24 @@ mod tests { | |||
222 | [ | 222 | [ |
223 | CompletionItem { | 223 | CompletionItem { |
224 | label: "crate_field", | 224 | label: "crate_field", |
225 | source_range: 313..313, | 225 | source_range: 192..192, |
226 | delete: 313..313, | 226 | delete: 192..192, |
227 | insert: "crate_field", | 227 | insert: "crate_field", |
228 | kind: Field, | 228 | kind: Field, |
229 | detail: "u32", | 229 | detail: "u32", |
230 | }, | 230 | }, |
231 | CompletionItem { | 231 | CompletionItem { |
232 | label: "pub_field", | 232 | label: "pub_field", |
233 | source_range: 313..313, | 233 | source_range: 192..192, |
234 | delete: 313..313, | 234 | delete: 192..192, |
235 | insert: "pub_field", | 235 | insert: "pub_field", |
236 | kind: Field, | 236 | kind: Field, |
237 | detail: "u32", | 237 | detail: "u32", |
238 | }, | 238 | }, |
239 | CompletionItem { | 239 | CompletionItem { |
240 | label: "super_field", | 240 | label: "super_field", |
241 | source_range: 313..313, | 241 | source_range: 192..192, |
242 | delete: 313..313, | 242 | delete: 192..192, |
243 | insert: "super_field", | 243 | insert: "super_field", |
244 | kind: Field, | 244 | kind: Field, |
245 | detail: "u32", | 245 | detail: "u32", |
@@ -268,16 +268,16 @@ mod tests { | |||
268 | [ | 268 | [ |
269 | CompletionItem { | 269 | CompletionItem { |
270 | label: "field", | 270 | label: "field", |
271 | source_range: 140..140, | 271 | source_range: 67..67, |
272 | delete: 140..140, | 272 | delete: 67..67, |
273 | insert: "field", | 273 | insert: "field", |
274 | kind: Field, | 274 | kind: Field, |
275 | detail: "u8", | 275 | detail: "u8", |
276 | }, | 276 | }, |
277 | CompletionItem { | 277 | CompletionItem { |
278 | label: "other", | 278 | label: "other", |
279 | source_range: 140..140, | 279 | source_range: 67..67, |
280 | delete: 140..140, | 280 | delete: 67..67, |
281 | insert: "other", | 281 | insert: "other", |
282 | kind: Field, | 282 | kind: Field, |
283 | detail: "u16", | 283 | detail: "u16", |
@@ -305,8 +305,8 @@ mod tests { | |||
305 | [ | 305 | [ |
306 | CompletionItem { | 306 | CompletionItem { |
307 | label: "the_method()", | 307 | label: "the_method()", |
308 | source_range: 144..144, | 308 | source_range: 71..71, |
309 | delete: 144..144, | 309 | delete: 71..71, |
310 | insert: "the_method()$0", | 310 | insert: "the_method()$0", |
311 | kind: Method, | 311 | kind: Method, |
312 | lookup: "the_method", | 312 | lookup: "the_method", |
@@ -338,8 +338,8 @@ mod tests { | |||
338 | [ | 338 | [ |
339 | CompletionItem { | 339 | CompletionItem { |
340 | label: "the_method()", | 340 | label: "the_method()", |
341 | source_range: 243..243, | 341 | source_range: 134..134, |
342 | delete: 243..243, | 342 | delete: 134..134, |
343 | insert: "the_method()$0", | 343 | insert: "the_method()$0", |
344 | kind: Method, | 344 | kind: Method, |
345 | lookup: "the_method", | 345 | lookup: "the_method", |
@@ -371,8 +371,8 @@ mod tests { | |||
371 | [ | 371 | [ |
372 | CompletionItem { | 372 | CompletionItem { |
373 | label: "the_method()", | 373 | label: "the_method()", |
374 | source_range: 256..256, | 374 | source_range: 147..147, |
375 | delete: 256..256, | 375 | delete: 147..147, |
376 | insert: "the_method()$0", | 376 | insert: "the_method()$0", |
377 | kind: Method, | 377 | kind: Method, |
378 | lookup: "the_method", | 378 | lookup: "the_method", |
@@ -400,8 +400,8 @@ mod tests { | |||
400 | [ | 400 | [ |
401 | CompletionItem { | 401 | CompletionItem { |
402 | label: "the_method()", | 402 | label: "the_method()", |
403 | source_range: 151..151, | 403 | source_range: 90..90, |
404 | delete: 151..151, | 404 | delete: 90..90, |
405 | insert: "the_method()$0", | 405 | insert: "the_method()$0", |
406 | kind: Method, | 406 | kind: Method, |
407 | lookup: "the_method", | 407 | lookup: "the_method", |
@@ -429,8 +429,8 @@ mod tests { | |||
429 | [ | 429 | [ |
430 | CompletionItem { | 430 | CompletionItem { |
431 | label: "the_method()", | 431 | label: "the_method()", |
432 | source_range: 155..155, | 432 | source_range: 94..94, |
433 | delete: 155..155, | 433 | delete: 94..94, |
434 | insert: "the_method()$0", | 434 | insert: "the_method()$0", |
435 | kind: Method, | 435 | kind: Method, |
436 | lookup: "the_method", | 436 | lookup: "the_method", |
@@ -461,8 +461,8 @@ mod tests { | |||
461 | [ | 461 | [ |
462 | CompletionItem { | 462 | CompletionItem { |
463 | label: "the_method()", | 463 | label: "the_method()", |
464 | source_range: 219..219, | 464 | source_range: 122..122, |
465 | delete: 219..219, | 465 | delete: 122..122, |
466 | insert: "the_method()$0", | 466 | insert: "the_method()$0", |
467 | kind: Method, | 467 | kind: Method, |
468 | lookup: "the_method", | 468 | lookup: "the_method", |
@@ -513,8 +513,8 @@ mod tests { | |||
513 | [ | 513 | [ |
514 | CompletionItem { | 514 | CompletionItem { |
515 | label: "the_method()", | 515 | label: "the_method()", |
516 | source_range: 249..249, | 516 | source_range: 128..128, |
517 | delete: 249..249, | 517 | delete: 128..128, |
518 | insert: "the_method()$0", | 518 | insert: "the_method()$0", |
519 | kind: Method, | 519 | kind: Method, |
520 | lookup: "the_method", | 520 | lookup: "the_method", |
@@ -540,16 +540,16 @@ mod tests { | |||
540 | [ | 540 | [ |
541 | CompletionItem { | 541 | CompletionItem { |
542 | label: "0", | 542 | label: "0", |
543 | source_range: 75..75, | 543 | source_range: 38..38, |
544 | delete: 75..75, | 544 | delete: 38..38, |
545 | insert: "0", | 545 | insert: "0", |
546 | kind: Field, | 546 | kind: Field, |
547 | detail: "i32", | 547 | detail: "i32", |
548 | }, | 548 | }, |
549 | CompletionItem { | 549 | CompletionItem { |
550 | label: "1", | 550 | label: "1", |
551 | source_range: 75..75, | 551 | source_range: 38..38, |
552 | delete: 75..75, | 552 | delete: 38..38, |
553 | insert: "1", | 553 | insert: "1", |
554 | kind: Field, | 554 | kind: Field, |
555 | detail: "f64", | 555 | detail: "f64", |
@@ -583,8 +583,8 @@ mod tests { | |||
583 | [ | 583 | [ |
584 | CompletionItem { | 584 | CompletionItem { |
585 | label: "blah()", | 585 | label: "blah()", |
586 | source_range: 299..300, | 586 | source_range: 190..191, |
587 | delete: 299..300, | 587 | delete: 190..191, |
588 | insert: "blah()$0", | 588 | insert: "blah()$0", |
589 | kind: Method, | 589 | kind: Method, |
590 | lookup: "blah", | 590 | lookup: "blah", |
@@ -610,8 +610,8 @@ mod tests { | |||
610 | [ | 610 | [ |
611 | CompletionItem { | 611 | CompletionItem { |
612 | label: "the_field", | 612 | label: "the_field", |
613 | source_range: 106..106, | 613 | source_range: 69..69, |
614 | delete: 106..106, | 614 | delete: 69..69, |
615 | insert: "the_field", | 615 | insert: "the_field", |
616 | kind: Field, | 616 | kind: Field, |
617 | detail: "u32", | 617 | detail: "u32", |
@@ -676,15 +676,15 @@ mod tests { | |||
676 | [ | 676 | [ |
677 | CompletionItem { | 677 | CompletionItem { |
678 | label: "A", | 678 | label: "A", |
679 | source_range: 217..217, | 679 | source_range: 120..120, |
680 | delete: 217..217, | 680 | delete: 120..120, |
681 | insert: "A", | 681 | insert: "A", |
682 | kind: Const, | 682 | kind: Const, |
683 | }, | 683 | }, |
684 | CompletionItem { | 684 | CompletionItem { |
685 | label: "b", | 685 | label: "b", |
686 | source_range: 217..217, | 686 | source_range: 120..120, |
687 | delete: 217..217, | 687 | delete: 120..120, |
688 | insert: "b", | 688 | insert: "b", |
689 | kind: Module, | 689 | kind: Module, |
690 | }, | 690 | }, |
@@ -709,8 +709,8 @@ mod tests { | |||
709 | [ | 709 | [ |
710 | CompletionItem { | 710 | CompletionItem { |
711 | label: "the_field", | 711 | label: "the_field", |
712 | source_range: 156..157, | 712 | source_range: 91..92, |
713 | delete: 156..157, | 713 | delete: 91..92, |
714 | insert: "the_field", | 714 | insert: "the_field", |
715 | kind: Field, | 715 | kind: Field, |
716 | detail: "u32", | 716 | detail: "u32", |
@@ -736,8 +736,8 @@ mod tests { | |||
736 | [ | 736 | [ |
737 | CompletionItem { | 737 | CompletionItem { |
738 | label: "the_field", | 738 | label: "the_field", |
739 | source_range: 156..157, | 739 | source_range: 91..92, |
740 | delete: 156..157, | 740 | delete: 91..92, |
741 | insert: "the_field", | 741 | insert: "the_field", |
742 | kind: Field, | 742 | kind: Field, |
743 | detail: "u32", | 743 | detail: "u32", |
@@ -764,8 +764,8 @@ mod tests { | |||
764 | [ | 764 | [ |
765 | CompletionItem { | 765 | CompletionItem { |
766 | label: "the_field", | 766 | label: "the_field", |
767 | source_range: 156..156, | 767 | source_range: 91..91, |
768 | delete: 156..156, | 768 | delete: 91..91, |
769 | insert: "the_field", | 769 | insert: "the_field", |
770 | kind: Field, | 770 | kind: Field, |
771 | detail: "u32", | 771 | detail: "u32", |
@@ -791,8 +791,8 @@ mod tests { | |||
791 | [ | 791 | [ |
792 | CompletionItem { | 792 | CompletionItem { |
793 | label: "the_field", | 793 | label: "the_field", |
794 | source_range: 162..163, | 794 | source_range: 97..98, |
795 | delete: 162..163, | 795 | delete: 97..98, |
796 | insert: "the_field", | 796 | insert: "the_field", |
797 | kind: Field, | 797 | kind: Field, |
798 | detail: "u32", | 798 | detail: "u32", |
@@ -828,8 +828,8 @@ mod tests { | |||
828 | [ | 828 | [ |
829 | CompletionItem { | 829 | CompletionItem { |
830 | label: "the_field", | 830 | label: "the_field", |
831 | source_range: 552..552, | 831 | source_range: 327..327, |
832 | delete: 552..552, | 832 | delete: 327..327, |
833 | insert: "the_field", | 833 | insert: "the_field", |
834 | kind: Field, | 834 | kind: Field, |
835 | detail: "u32", | 835 | detail: "u32", |
@@ -858,8 +858,8 @@ mod tests { | |||
858 | [ | 858 | [ |
859 | CompletionItem { | 859 | CompletionItem { |
860 | label: "the_method()", | 860 | label: "the_method()", |
861 | source_range: 201..201, | 861 | source_range: 116..116, |
862 | delete: 201..201, | 862 | delete: 116..116, |
863 | insert: "the_method()$0", | 863 | insert: "the_method()$0", |
864 | kind: Method, | 864 | kind: Method, |
865 | lookup: "the_method", | 865 | lookup: "the_method", |
diff --git a/crates/ra_ide/src/completion/complete_fn_param.rs b/crates/ra_ide/src/completion/complete_fn_param.rs index a661932a3..f5573ddf7 100644 --- a/crates/ra_ide/src/completion/complete_fn_param.rs +++ b/crates/ra_ide/src/completion/complete_fn_param.rs | |||
@@ -75,8 +75,8 @@ mod tests { | |||
75 | [ | 75 | [ |
76 | CompletionItem { | 76 | CompletionItem { |
77 | label: "file_id: FileId", | 77 | label: "file_id: FileId", |
78 | source_range: 110..114, | 78 | source_range: 61..65, |
79 | delete: 110..114, | 79 | delete: 61..65, |
80 | insert: "file_id: FileId", | 80 | insert: "file_id: FileId", |
81 | lookup: "file_id", | 81 | lookup: "file_id", |
82 | }, | 82 | }, |
@@ -99,8 +99,8 @@ mod tests { | |||
99 | [ | 99 | [ |
100 | CompletionItem { | 100 | CompletionItem { |
101 | label: "file_id: FileId", | 101 | label: "file_id: FileId", |
102 | source_range: 110..114, | 102 | source_range: 61..65, |
103 | delete: 110..114, | 103 | delete: 61..65, |
104 | insert: "file_id: FileId", | 104 | insert: "file_id: FileId", |
105 | lookup: "file_id", | 105 | lookup: "file_id", |
106 | }, | 106 | }, |
@@ -126,8 +126,8 @@ mod tests { | |||
126 | [ | 126 | [ |
127 | CompletionItem { | 127 | CompletionItem { |
128 | label: "file_id: FileId", | 128 | label: "file_id: FileId", |
129 | source_range: 289..293, | 129 | source_range: 208..212, |
130 | delete: 289..293, | 130 | delete: 208..212, |
131 | insert: "file_id: FileId", | 131 | insert: "file_id: FileId", |
132 | lookup: "file_id", | 132 | lookup: "file_id", |
133 | }, | 133 | }, |
diff --git a/crates/ra_ide/src/completion/complete_pattern.rs b/crates/ra_ide/src/completion/complete_pattern.rs index fdd9e928b..367e2bbce 100644 --- a/crates/ra_ide/src/completion/complete_pattern.rs +++ b/crates/ra_ide/src/completion/complete_pattern.rs | |||
@@ -63,37 +63,37 @@ mod tests { | |||
63 | [ | 63 | [ |
64 | CompletionItem { | 64 | CompletionItem { |
65 | label: "Bar", | 65 | label: "Bar", |
66 | source_range: 246..246, | 66 | source_range: 137..137, |
67 | delete: 246..246, | 67 | delete: 137..137, |
68 | insert: "Bar", | 68 | insert: "Bar", |
69 | kind: Struct, | 69 | kind: Struct, |
70 | }, | 70 | }, |
71 | CompletionItem { | 71 | CompletionItem { |
72 | label: "E", | 72 | label: "E", |
73 | source_range: 246..246, | 73 | source_range: 137..137, |
74 | delete: 246..246, | 74 | delete: 137..137, |
75 | insert: "E", | 75 | insert: "E", |
76 | kind: Enum, | 76 | kind: Enum, |
77 | }, | 77 | }, |
78 | CompletionItem { | 78 | CompletionItem { |
79 | label: "X", | 79 | label: "X", |
80 | source_range: 246..246, | 80 | source_range: 137..137, |
81 | delete: 246..246, | 81 | delete: 137..137, |
82 | insert: "X", | 82 | insert: "X", |
83 | kind: EnumVariant, | 83 | kind: EnumVariant, |
84 | detail: "()", | 84 | detail: "()", |
85 | }, | 85 | }, |
86 | CompletionItem { | 86 | CompletionItem { |
87 | label: "Z", | 87 | label: "Z", |
88 | source_range: 246..246, | 88 | source_range: 137..137, |
89 | delete: 246..246, | 89 | delete: 137..137, |
90 | insert: "Z", | 90 | insert: "Z", |
91 | kind: Const, | 91 | kind: Const, |
92 | }, | 92 | }, |
93 | CompletionItem { | 93 | CompletionItem { |
94 | label: "m", | 94 | label: "m", |
95 | source_range: 246..246, | 95 | source_range: 137..137, |
96 | delete: 246..246, | 96 | delete: 137..137, |
97 | insert: "m", | 97 | insert: "m", |
98 | kind: Module, | 98 | kind: Module, |
99 | }, | 99 | }, |
@@ -119,15 +119,15 @@ mod tests { | |||
119 | [ | 119 | [ |
120 | CompletionItem { | 120 | CompletionItem { |
121 | label: "E", | 121 | label: "E", |
122 | source_range: 151..151, | 122 | source_range: 90..90, |
123 | delete: 151..151, | 123 | delete: 90..90, |
124 | insert: "E", | 124 | insert: "E", |
125 | kind: Enum, | 125 | kind: Enum, |
126 | }, | 126 | }, |
127 | CompletionItem { | 127 | CompletionItem { |
128 | label: "m!(…)", | 128 | label: "m!(…)", |
129 | source_range: 151..151, | 129 | source_range: 90..90, |
130 | delete: 151..151, | 130 | delete: 90..90, |
131 | insert: "m!($0)", | 131 | insert: "m!($0)", |
132 | kind: Macro, | 132 | kind: Macro, |
133 | detail: "macro_rules! m", | 133 | detail: "macro_rules! m", |
diff --git a/crates/ra_ide/src/completion/complete_postfix.rs b/crates/ra_ide/src/completion/complete_postfix.rs index b878aeb0a..3bd64804f 100644 --- a/crates/ra_ide/src/completion/complete_postfix.rs +++ b/crates/ra_ide/src/completion/complete_postfix.rs | |||
@@ -260,64 +260,64 @@ mod tests { | |||
260 | [ | 260 | [ |
261 | CompletionItem { | 261 | CompletionItem { |
262 | label: "box", | 262 | label: "box", |
263 | source_range: 89..89, | 263 | source_range: 40..40, |
264 | delete: 85..89, | 264 | delete: 36..40, |
265 | insert: "Box::new(bar)", | 265 | insert: "Box::new(bar)", |
266 | detail: "Box::new(expr)", | 266 | detail: "Box::new(expr)", |
267 | }, | 267 | }, |
268 | CompletionItem { | 268 | CompletionItem { |
269 | label: "call", | 269 | label: "call", |
270 | source_range: 89..89, | 270 | source_range: 40..40, |
271 | delete: 85..89, | 271 | delete: 36..40, |
272 | insert: "${1}(bar)", | 272 | insert: "${1}(bar)", |
273 | detail: "function(expr)", | 273 | detail: "function(expr)", |
274 | }, | 274 | }, |
275 | CompletionItem { | 275 | CompletionItem { |
276 | label: "dbg", | 276 | label: "dbg", |
277 | source_range: 89..89, | 277 | source_range: 40..40, |
278 | delete: 85..89, | 278 | delete: 36..40, |
279 | insert: "dbg!(bar)", | 279 | insert: "dbg!(bar)", |
280 | detail: "dbg!(expr)", | 280 | detail: "dbg!(expr)", |
281 | }, | 281 | }, |
282 | CompletionItem { | 282 | CompletionItem { |
283 | label: "if", | 283 | label: "if", |
284 | source_range: 89..89, | 284 | source_range: 40..40, |
285 | delete: 85..89, | 285 | delete: 36..40, |
286 | insert: "if bar {\n $0\n}", | 286 | insert: "if bar {\n $0\n}", |
287 | detail: "if expr {}", | 287 | detail: "if expr {}", |
288 | }, | 288 | }, |
289 | CompletionItem { | 289 | CompletionItem { |
290 | label: "match", | 290 | label: "match", |
291 | source_range: 89..89, | 291 | source_range: 40..40, |
292 | delete: 85..89, | 292 | delete: 36..40, |
293 | insert: "match bar {\n ${1:_} => {$0\\},\n}", | 293 | insert: "match bar {\n ${1:_} => {$0\\},\n}", |
294 | detail: "match expr {}", | 294 | detail: "match expr {}", |
295 | }, | 295 | }, |
296 | CompletionItem { | 296 | CompletionItem { |
297 | label: "not", | 297 | label: "not", |
298 | source_range: 89..89, | 298 | source_range: 40..40, |
299 | delete: 85..89, | 299 | delete: 36..40, |
300 | insert: "!bar", | 300 | insert: "!bar", |
301 | detail: "!expr", | 301 | detail: "!expr", |
302 | }, | 302 | }, |
303 | CompletionItem { | 303 | CompletionItem { |
304 | label: "ref", | 304 | label: "ref", |
305 | source_range: 89..89, | 305 | source_range: 40..40, |
306 | delete: 85..89, | 306 | delete: 36..40, |
307 | insert: "&bar", | 307 | insert: "&bar", |
308 | detail: "&expr", | 308 | detail: "&expr", |
309 | }, | 309 | }, |
310 | CompletionItem { | 310 | CompletionItem { |
311 | label: "refm", | 311 | label: "refm", |
312 | source_range: 89..89, | 312 | source_range: 40..40, |
313 | delete: 85..89, | 313 | delete: 36..40, |
314 | insert: "&mut bar", | 314 | insert: "&mut bar", |
315 | detail: "&mut expr", | 315 | detail: "&mut expr", |
316 | }, | 316 | }, |
317 | CompletionItem { | 317 | CompletionItem { |
318 | label: "while", | 318 | label: "while", |
319 | source_range: 89..89, | 319 | source_range: 40..40, |
320 | delete: 85..89, | 320 | delete: 36..40, |
321 | insert: "while bar {\n $0\n}", | 321 | insert: "while bar {\n $0\n}", |
322 | detail: "while expr {}", | 322 | detail: "while expr {}", |
323 | }, | 323 | }, |
@@ -346,64 +346,64 @@ mod tests { | |||
346 | [ | 346 | [ |
347 | CompletionItem { | 347 | CompletionItem { |
348 | label: "box", | 348 | label: "box", |
349 | source_range: 210..210, | 349 | source_range: 97..97, |
350 | delete: 206..210, | 350 | delete: 93..97, |
351 | insert: "Box::new(bar)", | 351 | insert: "Box::new(bar)", |
352 | detail: "Box::new(expr)", | 352 | detail: "Box::new(expr)", |
353 | }, | 353 | }, |
354 | CompletionItem { | 354 | CompletionItem { |
355 | label: "call", | 355 | label: "call", |
356 | source_range: 210..210, | 356 | source_range: 97..97, |
357 | delete: 206..210, | 357 | delete: 93..97, |
358 | insert: "${1}(bar)", | 358 | insert: "${1}(bar)", |
359 | detail: "function(expr)", | 359 | detail: "function(expr)", |
360 | }, | 360 | }, |
361 | CompletionItem { | 361 | CompletionItem { |
362 | label: "dbg", | 362 | label: "dbg", |
363 | source_range: 210..210, | 363 | source_range: 97..97, |
364 | delete: 206..210, | 364 | delete: 93..97, |
365 | insert: "dbg!(bar)", | 365 | insert: "dbg!(bar)", |
366 | detail: "dbg!(expr)", | 366 | detail: "dbg!(expr)", |
367 | }, | 367 | }, |
368 | CompletionItem { | 368 | CompletionItem { |
369 | label: "ifl", | 369 | label: "ifl", |
370 | source_range: 210..210, | 370 | source_range: 97..97, |
371 | delete: 206..210, | 371 | delete: 93..97, |
372 | insert: "if let Some($1) = bar {\n $0\n}", | 372 | insert: "if let Some($1) = bar {\n $0\n}", |
373 | detail: "if let Some {}", | 373 | detail: "if let Some {}", |
374 | }, | 374 | }, |
375 | CompletionItem { | 375 | CompletionItem { |
376 | label: "match", | 376 | label: "match", |
377 | source_range: 210..210, | 377 | source_range: 97..97, |
378 | delete: 206..210, | 378 | delete: 93..97, |
379 | insert: "match bar {\n Some(${1:_}) => {$2\\},\n None => {$0\\},\n}", | 379 | insert: "match bar {\n Some(${1:_}) => {$2\\},\n None => {$0\\},\n}", |
380 | detail: "match expr {}", | 380 | detail: "match expr {}", |
381 | }, | 381 | }, |
382 | CompletionItem { | 382 | CompletionItem { |
383 | label: "not", | 383 | label: "not", |
384 | source_range: 210..210, | 384 | source_range: 97..97, |
385 | delete: 206..210, | 385 | delete: 93..97, |
386 | insert: "!bar", | 386 | insert: "!bar", |
387 | detail: "!expr", | 387 | detail: "!expr", |
388 | }, | 388 | }, |
389 | CompletionItem { | 389 | CompletionItem { |
390 | label: "ref", | 390 | label: "ref", |
391 | source_range: 210..210, | 391 | source_range: 97..97, |
392 | delete: 206..210, | 392 | delete: 93..97, |
393 | insert: "&bar", | 393 | insert: "&bar", |
394 | detail: "&expr", | 394 | detail: "&expr", |
395 | }, | 395 | }, |
396 | CompletionItem { | 396 | CompletionItem { |
397 | label: "refm", | 397 | label: "refm", |
398 | source_range: 210..210, | 398 | source_range: 97..97, |
399 | delete: 206..210, | 399 | delete: 93..97, |
400 | insert: "&mut bar", | 400 | insert: "&mut bar", |
401 | detail: "&mut expr", | 401 | detail: "&mut expr", |
402 | }, | 402 | }, |
403 | CompletionItem { | 403 | CompletionItem { |
404 | label: "while", | 404 | label: "while", |
405 | source_range: 210..210, | 405 | source_range: 97..97, |
406 | delete: 206..210, | 406 | delete: 93..97, |
407 | insert: "while let Some($1) = bar {\n $0\n}", | 407 | insert: "while let Some($1) = bar {\n $0\n}", |
408 | detail: "while let Some {}", | 408 | detail: "while let Some {}", |
409 | }, | 409 | }, |
@@ -432,64 +432,64 @@ mod tests { | |||
432 | [ | 432 | [ |
433 | CompletionItem { | 433 | CompletionItem { |
434 | label: "box", | 434 | label: "box", |
435 | source_range: 211..211, | 435 | source_range: 98..98, |
436 | delete: 207..211, | 436 | delete: 94..98, |
437 | insert: "Box::new(bar)", | 437 | insert: "Box::new(bar)", |
438 | detail: "Box::new(expr)", | 438 | detail: "Box::new(expr)", |
439 | }, | 439 | }, |
440 | CompletionItem { | 440 | CompletionItem { |
441 | label: "call", | 441 | label: "call", |
442 | source_range: 211..211, | 442 | source_range: 98..98, |
443 | delete: 207..211, | 443 | delete: 94..98, |
444 | insert: "${1}(bar)", | 444 | insert: "${1}(bar)", |
445 | detail: "function(expr)", | 445 | detail: "function(expr)", |
446 | }, | 446 | }, |
447 | CompletionItem { | 447 | CompletionItem { |
448 | label: "dbg", | 448 | label: "dbg", |
449 | source_range: 211..211, | 449 | source_range: 98..98, |
450 | delete: 207..211, | 450 | delete: 94..98, |
451 | insert: "dbg!(bar)", | 451 | insert: "dbg!(bar)", |
452 | detail: "dbg!(expr)", | 452 | detail: "dbg!(expr)", |
453 | }, | 453 | }, |
454 | CompletionItem { | 454 | CompletionItem { |
455 | label: "ifl", | 455 | label: "ifl", |
456 | source_range: 211..211, | 456 | source_range: 98..98, |
457 | delete: 207..211, | 457 | delete: 94..98, |
458 | insert: "if let Ok($1) = bar {\n $0\n}", | 458 | insert: "if let Ok($1) = bar {\n $0\n}", |
459 | detail: "if let Ok {}", | 459 | detail: "if let Ok {}", |
460 | }, | 460 | }, |
461 | CompletionItem { | 461 | CompletionItem { |
462 | label: "match", | 462 | label: "match", |
463 | source_range: 211..211, | 463 | source_range: 98..98, |
464 | delete: 207..211, | 464 | delete: 94..98, |
465 | insert: "match bar {\n Ok(${1:_}) => {$2\\},\n Err(${3:_}) => {$0\\},\n}", | 465 | insert: "match bar {\n Ok(${1:_}) => {$2\\},\n Err(${3:_}) => {$0\\},\n}", |
466 | detail: "match expr {}", | 466 | detail: "match expr {}", |
467 | }, | 467 | }, |
468 | CompletionItem { | 468 | CompletionItem { |
469 | label: "not", | 469 | label: "not", |
470 | source_range: 211..211, | 470 | source_range: 98..98, |
471 | delete: 207..211, | 471 | delete: 94..98, |
472 | insert: "!bar", | 472 | insert: "!bar", |
473 | detail: "!expr", | 473 | detail: "!expr", |
474 | }, | 474 | }, |
475 | CompletionItem { | 475 | CompletionItem { |
476 | label: "ref", | 476 | label: "ref", |
477 | source_range: 211..211, | 477 | source_range: 98..98, |
478 | delete: 207..211, | 478 | delete: 94..98, |
479 | insert: "&bar", | 479 | insert: "&bar", |
480 | detail: "&expr", | 480 | detail: "&expr", |
481 | }, | 481 | }, |
482 | CompletionItem { | 482 | CompletionItem { |
483 | label: "refm", | 483 | label: "refm", |
484 | source_range: 211..211, | 484 | source_range: 98..98, |
485 | delete: 207..211, | 485 | delete: 94..98, |
486 | insert: "&mut bar", | 486 | insert: "&mut bar", |
487 | detail: "&mut expr", | 487 | detail: "&mut expr", |
488 | }, | 488 | }, |
489 | CompletionItem { | 489 | CompletionItem { |
490 | label: "while", | 490 | label: "while", |
491 | source_range: 211..211, | 491 | source_range: 98..98, |
492 | delete: 207..211, | 492 | delete: 94..98, |
493 | insert: "while let Ok($1) = bar {\n $0\n}", | 493 | insert: "while let Ok($1) = bar {\n $0\n}", |
494 | detail: "while let Ok {}", | 494 | detail: "while let Ok {}", |
495 | }, | 495 | }, |
@@ -513,50 +513,50 @@ mod tests { | |||
513 | [ | 513 | [ |
514 | CompletionItem { | 514 | CompletionItem { |
515 | label: "box", | 515 | label: "box", |
516 | source_range: 91..91, | 516 | source_range: 42..42, |
517 | delete: 87..91, | 517 | delete: 38..42, |
518 | insert: "Box::new(bar)", | 518 | insert: "Box::new(bar)", |
519 | detail: "Box::new(expr)", | 519 | detail: "Box::new(expr)", |
520 | }, | 520 | }, |
521 | CompletionItem { | 521 | CompletionItem { |
522 | label: "call", | 522 | label: "call", |
523 | source_range: 91..91, | 523 | source_range: 42..42, |
524 | delete: 87..91, | 524 | delete: 38..42, |
525 | insert: "${1}(bar)", | 525 | insert: "${1}(bar)", |
526 | detail: "function(expr)", | 526 | detail: "function(expr)", |
527 | }, | 527 | }, |
528 | CompletionItem { | 528 | CompletionItem { |
529 | label: "dbg", | 529 | label: "dbg", |
530 | source_range: 91..91, | 530 | source_range: 42..42, |
531 | delete: 87..91, | 531 | delete: 38..42, |
532 | insert: "dbg!(bar)", | 532 | insert: "dbg!(bar)", |
533 | detail: "dbg!(expr)", | 533 | detail: "dbg!(expr)", |
534 | }, | 534 | }, |
535 | CompletionItem { | 535 | CompletionItem { |
536 | label: "match", | 536 | label: "match", |
537 | source_range: 91..91, | 537 | source_range: 42..42, |
538 | delete: 87..91, | 538 | delete: 38..42, |
539 | insert: "match bar {\n ${1:_} => {$0\\},\n}", | 539 | insert: "match bar {\n ${1:_} => {$0\\},\n}", |
540 | detail: "match expr {}", | 540 | detail: "match expr {}", |
541 | }, | 541 | }, |
542 | CompletionItem { | 542 | CompletionItem { |
543 | label: "not", | 543 | label: "not", |
544 | source_range: 91..91, | 544 | source_range: 42..42, |
545 | delete: 87..91, | 545 | delete: 38..42, |
546 | insert: "!bar", | 546 | insert: "!bar", |
547 | detail: "!expr", | 547 | detail: "!expr", |
548 | }, | 548 | }, |
549 | CompletionItem { | 549 | CompletionItem { |
550 | label: "ref", | 550 | label: "ref", |
551 | source_range: 91..91, | 551 | source_range: 42..42, |
552 | delete: 87..91, | 552 | delete: 38..42, |
553 | insert: "&bar", | 553 | insert: "&bar", |
554 | detail: "&expr", | 554 | detail: "&expr", |
555 | }, | 555 | }, |
556 | CompletionItem { | 556 | CompletionItem { |
557 | label: "refm", | 557 | label: "refm", |
558 | source_range: 91..91, | 558 | source_range: 42..42, |
559 | delete: 87..91, | 559 | delete: 38..42, |
560 | insert: "&mut bar", | 560 | insert: "&mut bar", |
561 | detail: "&mut expr", | 561 | detail: "&mut expr", |
562 | }, | 562 | }, |
@@ -579,50 +579,50 @@ mod tests { | |||
579 | [ | 579 | [ |
580 | CompletionItem { | 580 | CompletionItem { |
581 | label: "box", | 581 | label: "box", |
582 | source_range: 52..52, | 582 | source_range: 19..19, |
583 | delete: 49..52, | 583 | delete: 16..19, |
584 | insert: "Box::new(42)", | 584 | insert: "Box::new(42)", |
585 | detail: "Box::new(expr)", | 585 | detail: "Box::new(expr)", |
586 | }, | 586 | }, |
587 | CompletionItem { | 587 | CompletionItem { |
588 | label: "call", | 588 | label: "call", |
589 | source_range: 52..52, | 589 | source_range: 19..19, |
590 | delete: 49..52, | 590 | delete: 16..19, |
591 | insert: "${1}(42)", | 591 | insert: "${1}(42)", |
592 | detail: "function(expr)", | 592 | detail: "function(expr)", |
593 | }, | 593 | }, |
594 | CompletionItem { | 594 | CompletionItem { |
595 | label: "dbg", | 595 | label: "dbg", |
596 | source_range: 52..52, | 596 | source_range: 19..19, |
597 | delete: 49..52, | 597 | delete: 16..19, |
598 | insert: "dbg!(42)", | 598 | insert: "dbg!(42)", |
599 | detail: "dbg!(expr)", | 599 | detail: "dbg!(expr)", |
600 | }, | 600 | }, |
601 | CompletionItem { | 601 | CompletionItem { |
602 | label: "match", | 602 | label: "match", |
603 | source_range: 52..52, | 603 | source_range: 19..19, |
604 | delete: 49..52, | 604 | delete: 16..19, |
605 | insert: "match 42 {\n ${1:_} => {$0\\},\n}", | 605 | insert: "match 42 {\n ${1:_} => {$0\\},\n}", |
606 | detail: "match expr {}", | 606 | detail: "match expr {}", |
607 | }, | 607 | }, |
608 | CompletionItem { | 608 | CompletionItem { |
609 | label: "not", | 609 | label: "not", |
610 | source_range: 52..52, | 610 | source_range: 19..19, |
611 | delete: 49..52, | 611 | delete: 16..19, |
612 | insert: "!42", | 612 | insert: "!42", |
613 | detail: "!expr", | 613 | detail: "!expr", |
614 | }, | 614 | }, |
615 | CompletionItem { | 615 | CompletionItem { |
616 | label: "ref", | 616 | label: "ref", |
617 | source_range: 52..52, | 617 | source_range: 19..19, |
618 | delete: 49..52, | 618 | delete: 16..19, |
619 | insert: "&42", | 619 | insert: "&42", |
620 | detail: "&expr", | 620 | detail: "&expr", |
621 | }, | 621 | }, |
622 | CompletionItem { | 622 | CompletionItem { |
623 | label: "refm", | 623 | label: "refm", |
624 | source_range: 52..52, | 624 | source_range: 19..19, |
625 | delete: 49..52, | 625 | delete: 16..19, |
626 | insert: "&mut 42", | 626 | insert: "&mut 42", |
627 | detail: "&mut expr", | 627 | detail: "&mut expr", |
628 | }, | 628 | }, |
@@ -647,50 +647,50 @@ mod tests { | |||
647 | [ | 647 | [ |
648 | CompletionItem { | 648 | CompletionItem { |
649 | label: "box", | 649 | label: "box", |
650 | source_range: 149..150, | 650 | source_range: 84..85, |
651 | delete: 145..150, | 651 | delete: 80..85, |
652 | insert: "Box::new(bar)", | 652 | insert: "Box::new(bar)", |
653 | detail: "Box::new(expr)", | 653 | detail: "Box::new(expr)", |
654 | }, | 654 | }, |
655 | CompletionItem { | 655 | CompletionItem { |
656 | label: "call", | 656 | label: "call", |
657 | source_range: 149..150, | 657 | source_range: 84..85, |
658 | delete: 145..150, | 658 | delete: 80..85, |
659 | insert: "${1}(bar)", | 659 | insert: "${1}(bar)", |
660 | detail: "function(expr)", | 660 | detail: "function(expr)", |
661 | }, | 661 | }, |
662 | CompletionItem { | 662 | CompletionItem { |
663 | label: "dbg", | 663 | label: "dbg", |
664 | source_range: 149..150, | 664 | source_range: 84..85, |
665 | delete: 145..150, | 665 | delete: 80..85, |
666 | insert: "dbg!(bar)", | 666 | insert: "dbg!(bar)", |
667 | detail: "dbg!(expr)", | 667 | detail: "dbg!(expr)", |
668 | }, | 668 | }, |
669 | CompletionItem { | 669 | CompletionItem { |
670 | label: "match", | 670 | label: "match", |
671 | source_range: 149..150, | 671 | source_range: 84..85, |
672 | delete: 145..150, | 672 | delete: 80..85, |
673 | insert: "match bar {\n ${1:_} => {$0\\},\n}", | 673 | insert: "match bar {\n ${1:_} => {$0\\},\n}", |
674 | detail: "match expr {}", | 674 | detail: "match expr {}", |
675 | }, | 675 | }, |
676 | CompletionItem { | 676 | CompletionItem { |
677 | label: "not", | 677 | label: "not", |
678 | source_range: 149..150, | 678 | source_range: 84..85, |
679 | delete: 145..150, | 679 | delete: 80..85, |
680 | insert: "!bar", | 680 | insert: "!bar", |
681 | detail: "!expr", | 681 | detail: "!expr", |
682 | }, | 682 | }, |
683 | CompletionItem { | 683 | CompletionItem { |
684 | label: "ref", | 684 | label: "ref", |
685 | source_range: 149..150, | 685 | source_range: 84..85, |
686 | delete: 145..150, | 686 | delete: 80..85, |
687 | insert: "&bar", | 687 | insert: "&bar", |
688 | detail: "&expr", | 688 | detail: "&expr", |
689 | }, | 689 | }, |
690 | CompletionItem { | 690 | CompletionItem { |
691 | label: "refm", | 691 | label: "refm", |
692 | source_range: 149..150, | 692 | source_range: 84..85, |
693 | delete: 145..150, | 693 | delete: 80..85, |
694 | insert: "&mut bar", | 694 | insert: "&mut bar", |
695 | detail: "&mut expr", | 695 | detail: "&mut expr", |
696 | }, | 696 | }, |
@@ -713,50 +713,50 @@ mod tests { | |||
713 | [ | 713 | [ |
714 | CompletionItem { | 714 | CompletionItem { |
715 | label: "box", | 715 | label: "box", |
716 | source_range: 56..56, | 716 | source_range: 23..23, |
717 | delete: 49..56, | 717 | delete: 16..23, |
718 | insert: "Box::new(&&&&42)", | 718 | insert: "Box::new(&&&&42)", |
719 | detail: "Box::new(expr)", | 719 | detail: "Box::new(expr)", |
720 | }, | 720 | }, |
721 | CompletionItem { | 721 | CompletionItem { |
722 | label: "call", | 722 | label: "call", |
723 | source_range: 56..56, | 723 | source_range: 23..23, |
724 | delete: 49..56, | 724 | delete: 16..23, |
725 | insert: "${1}(&&&&42)", | 725 | insert: "${1}(&&&&42)", |
726 | detail: "function(expr)", | 726 | detail: "function(expr)", |
727 | }, | 727 | }, |
728 | CompletionItem { | 728 | CompletionItem { |
729 | label: "dbg", | 729 | label: "dbg", |
730 | source_range: 56..56, | 730 | source_range: 23..23, |
731 | delete: 49..56, | 731 | delete: 16..23, |
732 | insert: "dbg!(&&&&42)", | 732 | insert: "dbg!(&&&&42)", |
733 | detail: "dbg!(expr)", | 733 | detail: "dbg!(expr)", |
734 | }, | 734 | }, |
735 | CompletionItem { | 735 | CompletionItem { |
736 | label: "match", | 736 | label: "match", |
737 | source_range: 56..56, | 737 | source_range: 23..23, |
738 | delete: 49..56, | 738 | delete: 16..23, |
739 | insert: "match &&&&42 {\n ${1:_} => {$0\\},\n}", | 739 | insert: "match &&&&42 {\n ${1:_} => {$0\\},\n}", |
740 | detail: "match expr {}", | 740 | detail: "match expr {}", |
741 | }, | 741 | }, |
742 | CompletionItem { | 742 | CompletionItem { |
743 | label: "not", | 743 | label: "not", |
744 | source_range: 56..56, | 744 | source_range: 23..23, |
745 | delete: 53..56, | 745 | delete: 20..23, |
746 | insert: "!42", | 746 | insert: "!42", |
747 | detail: "!expr", | 747 | detail: "!expr", |
748 | }, | 748 | }, |
749 | CompletionItem { | 749 | CompletionItem { |
750 | label: "ref", | 750 | label: "ref", |
751 | source_range: 56..56, | 751 | source_range: 23..23, |
752 | delete: 53..56, | 752 | delete: 20..23, |
753 | insert: "&42", | 753 | insert: "&42", |
754 | detail: "&expr", | 754 | detail: "&expr", |
755 | }, | 755 | }, |
756 | CompletionItem { | 756 | CompletionItem { |
757 | label: "refm", | 757 | label: "refm", |
758 | source_range: 56..56, | 758 | source_range: 23..23, |
759 | delete: 53..56, | 759 | delete: 20..23, |
760 | insert: "&mut 42", | 760 | insert: "&mut 42", |
761 | detail: "&mut expr", | 761 | detail: "&mut expr", |
762 | }, | 762 | }, |
diff --git a/crates/ra_ide/src/completion/complete_qualified_path.rs b/crates/ra_ide/src/completion/complete_qualified_path.rs index d3a1cbc1d..f133ce3ce 100644 --- a/crates/ra_ide/src/completion/complete_qualified_path.rs +++ b/crates/ra_ide/src/completion/complete_qualified_path.rs | |||
@@ -212,8 +212,8 @@ mod tests { | |||
212 | [ | 212 | [ |
213 | CompletionItem { | 213 | CompletionItem { |
214 | label: "my", | 214 | label: "my", |
215 | source_range: 27..29, | 215 | source_range: 10..12, |
216 | delete: 27..29, | 216 | delete: 10..12, |
217 | insert: "my", | 217 | insert: "my", |
218 | kind: Module, | 218 | kind: Module, |
219 | documentation: Documentation( | 219 | documentation: Documentation( |
@@ -243,8 +243,8 @@ mod tests { | |||
243 | [ | 243 | [ |
244 | CompletionItem { | 244 | CompletionItem { |
245 | label: "Bar", | 245 | label: "Bar", |
246 | source_range: 31..31, | 246 | source_range: 14..14, |
247 | delete: 31..31, | 247 | delete: 14..14, |
248 | insert: "Bar", | 248 | insert: "Bar", |
249 | kind: Struct, | 249 | kind: Struct, |
250 | }, | 250 | }, |
@@ -271,15 +271,15 @@ mod tests { | |||
271 | [ | 271 | [ |
272 | CompletionItem { | 272 | CompletionItem { |
273 | label: "Foo", | 273 | label: "Foo", |
274 | source_range: 31..31, | 274 | source_range: 14..14, |
275 | delete: 31..31, | 275 | delete: 14..14, |
276 | insert: "Foo", | 276 | insert: "Foo", |
277 | kind: Struct, | 277 | kind: Struct, |
278 | }, | 278 | }, |
279 | CompletionItem { | 279 | CompletionItem { |
280 | label: "PublicBar", | 280 | label: "PublicBar", |
281 | source_range: 31..31, | 281 | source_range: 14..14, |
282 | delete: 31..31, | 282 | delete: 14..14, |
283 | insert: "PublicBar", | 283 | insert: "PublicBar", |
284 | kind: Struct, | 284 | kind: Struct, |
285 | }, | 285 | }, |
@@ -304,8 +304,8 @@ mod tests { | |||
304 | [ | 304 | [ |
305 | CompletionItem { | 305 | CompletionItem { |
306 | label: "Bar", | 306 | label: "Bar", |
307 | source_range: 30..30, | 307 | source_range: 13..13, |
308 | delete: 30..30, | 308 | delete: 13..13, |
309 | insert: "Bar", | 309 | insert: "Bar", |
310 | kind: Struct, | 310 | kind: Struct, |
311 | }, | 311 | }, |
@@ -1145,8 +1145,8 @@ mod tests { | |||
1145 | [ | 1145 | [ |
1146 | CompletionItem { | 1146 | CompletionItem { |
1147 | label: "bar()", | 1147 | label: "bar()", |
1148 | source_range: 185..185, | 1148 | source_range: 88..88, |
1149 | delete: 185..185, | 1149 | delete: 88..88, |
1150 | insert: "bar()$0", | 1150 | insert: "bar()$0", |
1151 | kind: Function, | 1151 | kind: Function, |
1152 | lookup: "bar", | 1152 | lookup: "bar", |
@@ -1154,8 +1154,8 @@ mod tests { | |||
1154 | }, | 1154 | }, |
1155 | CompletionItem { | 1155 | CompletionItem { |
1156 | label: "foo()", | 1156 | label: "foo()", |
1157 | source_range: 185..185, | 1157 | source_range: 88..88, |
1158 | delete: 185..185, | 1158 | delete: 88..88, |
1159 | insert: "foo()$0", | 1159 | insert: "foo()$0", |
1160 | kind: Function, | 1160 | kind: Function, |
1161 | lookup: "foo", | 1161 | lookup: "foo", |
@@ -1185,16 +1185,16 @@ mod tests { | |||
1185 | [ | 1185 | [ |
1186 | CompletionItem { | 1186 | CompletionItem { |
1187 | label: "foo!(…)", | 1187 | label: "foo!(…)", |
1188 | source_range: 179..179, | 1188 | source_range: 82..82, |
1189 | delete: 179..179, | 1189 | delete: 82..82, |
1190 | insert: "foo!($0)", | 1190 | insert: "foo!($0)", |
1191 | kind: Macro, | 1191 | kind: Macro, |
1192 | detail: "#[macro_export]\nmacro_rules! foo", | 1192 | detail: "#[macro_export]\nmacro_rules! foo", |
1193 | }, | 1193 | }, |
1194 | CompletionItem { | 1194 | CompletionItem { |
1195 | label: "main()", | 1195 | label: "main()", |
1196 | source_range: 179..179, | 1196 | source_range: 82..82, |
1197 | delete: 179..179, | 1197 | delete: 82..82, |
1198 | insert: "main()$0", | 1198 | insert: "main()$0", |
1199 | kind: Function, | 1199 | kind: Function, |
1200 | lookup: "main", | 1200 | lookup: "main", |
@@ -1230,22 +1230,22 @@ mod tests { | |||
1230 | [ | 1230 | [ |
1231 | CompletionItem { | 1231 | CompletionItem { |
1232 | label: "RIGHT_CONST", | 1232 | label: "RIGHT_CONST", |
1233 | source_range: 57..57, | 1233 | source_range: 24..24, |
1234 | delete: 57..57, | 1234 | delete: 24..24, |
1235 | insert: "RIGHT_CONST", | 1235 | insert: "RIGHT_CONST", |
1236 | kind: Const, | 1236 | kind: Const, |
1237 | }, | 1237 | }, |
1238 | CompletionItem { | 1238 | CompletionItem { |
1239 | label: "RightType", | 1239 | label: "RightType", |
1240 | source_range: 57..57, | 1240 | source_range: 24..24, |
1241 | delete: 57..57, | 1241 | delete: 24..24, |
1242 | insert: "RightType", | 1242 | insert: "RightType", |
1243 | kind: Struct, | 1243 | kind: Struct, |
1244 | }, | 1244 | }, |
1245 | CompletionItem { | 1245 | CompletionItem { |
1246 | label: "right_fn()", | 1246 | label: "right_fn()", |
1247 | source_range: 57..57, | 1247 | source_range: 24..24, |
1248 | delete: 57..57, | 1248 | delete: 24..24, |
1249 | insert: "right_fn()$0", | 1249 | insert: "right_fn()$0", |
1250 | kind: Function, | 1250 | kind: Function, |
1251 | lookup: "right_fn", | 1251 | lookup: "right_fn", |
@@ -1269,8 +1269,8 @@ mod tests { | |||
1269 | [ | 1269 | [ |
1270 | CompletionItem { | 1270 | CompletionItem { |
1271 | label: "foo()", | 1271 | label: "foo()", |
1272 | source_range: 93..94, | 1272 | source_range: 60..61, |
1273 | delete: 93..94, | 1273 | delete: 60..61, |
1274 | insert: "foo()$0", | 1274 | insert: "foo()$0", |
1275 | kind: Function, | 1275 | kind: Function, |
1276 | lookup: "foo", | 1276 | lookup: "foo", |
@@ -1278,8 +1278,8 @@ mod tests { | |||
1278 | }, | 1278 | }, |
1279 | CompletionItem { | 1279 | CompletionItem { |
1280 | label: "main()", | 1280 | label: "main()", |
1281 | source_range: 93..94, | 1281 | source_range: 60..61, |
1282 | delete: 93..94, | 1282 | delete: 60..61, |
1283 | insert: "main()$0", | 1283 | insert: "main()$0", |
1284 | kind: Function, | 1284 | kind: Function, |
1285 | lookup: "main", | 1285 | lookup: "main", |
@@ -1308,15 +1308,15 @@ mod tests { | |||
1308 | [ | 1308 | [ |
1309 | CompletionItem { | 1309 | CompletionItem { |
1310 | label: "z", | 1310 | label: "z", |
1311 | source_range: 57..57, | 1311 | source_range: 24..24, |
1312 | delete: 57..57, | 1312 | delete: 24..24, |
1313 | insert: "z", | 1313 | insert: "z", |
1314 | kind: Module, | 1314 | kind: Module, |
1315 | }, | 1315 | }, |
1316 | CompletionItem { | 1316 | CompletionItem { |
1317 | label: "z()", | 1317 | label: "z()", |
1318 | source_range: 57..57, | 1318 | source_range: 24..24, |
1319 | delete: 57..57, | 1319 | delete: 24..24, |
1320 | insert: "z()$0", | 1320 | insert: "z()$0", |
1321 | kind: Function, | 1321 | kind: Function, |
1322 | lookup: "z", | 1322 | lookup: "z", |
@@ -1347,8 +1347,8 @@ mod tests { | |||
1347 | [ | 1347 | [ |
1348 | CompletionItem { | 1348 | CompletionItem { |
1349 | label: "new()", | 1349 | label: "new()", |
1350 | source_range: 292..292, | 1350 | source_range: 179..179, |
1351 | delete: 292..292, | 1351 | delete: 179..179, |
1352 | insert: "new()$0", | 1352 | insert: "new()$0", |
1353 | kind: Function, | 1353 | kind: Function, |
1354 | lookup: "new", | 1354 | lookup: "new", |
diff --git a/crates/ra_ide/src/completion/complete_record.rs b/crates/ra_ide/src/completion/complete_record.rs index b7ab654c5..13eb2f79f 100644 --- a/crates/ra_ide/src/completion/complete_record.rs +++ b/crates/ra_ide/src/completion/complete_record.rs | |||
@@ -41,17 +41,17 @@ mod tests { | |||
41 | ", | 41 | ", |
42 | ); | 42 | ); |
43 | assert_debug_snapshot!(completions, @r###" | 43 | assert_debug_snapshot!(completions, @r###" |
44 | [ | 44 | [ |
45 | CompletionItem { | 45 | CompletionItem { |
46 | label: "foo", | 46 | label: "foo", |
47 | source_range: 117..118, | 47 | source_range: 68..69, |
48 | delete: 117..118, | 48 | delete: 68..69, |
49 | insert: "foo", | 49 | insert: "foo", |
50 | kind: Field, | 50 | kind: Field, |
51 | detail: "u32", | 51 | detail: "u32", |
52 | }, | 52 | }, |
53 | ] | 53 | ] |
54 | "###); | 54 | "###); |
55 | } | 55 | } |
56 | 56 | ||
57 | #[test] | 57 | #[test] |
@@ -70,25 +70,25 @@ mod tests { | |||
70 | ", | 70 | ", |
71 | ); | 71 | ); |
72 | assert_debug_snapshot!(completions, @r###" | 72 | assert_debug_snapshot!(completions, @r###" |
73 | [ | 73 | [ |
74 | CompletionItem { | 74 | CompletionItem { |
75 | label: "bar", | 75 | label: "bar", |
76 | source_range: 161..161, | 76 | source_range: 88..88, |
77 | delete: 161..161, | 77 | delete: 88..88, |
78 | insert: "bar", | 78 | insert: "bar", |
79 | kind: Field, | 79 | kind: Field, |
80 | detail: "()", | 80 | detail: "()", |
81 | }, | 81 | }, |
82 | CompletionItem { | 82 | CompletionItem { |
83 | label: "foo", | 83 | label: "foo", |
84 | source_range: 161..161, | 84 | source_range: 88..88, |
85 | delete: 161..161, | 85 | delete: 88..88, |
86 | insert: "foo", | 86 | insert: "foo", |
87 | kind: Field, | 87 | kind: Field, |
88 | detail: "u32", | 88 | detail: "u32", |
89 | }, | 89 | }, |
90 | ] | 90 | ] |
91 | "###); | 91 | "###); |
92 | } | 92 | } |
93 | 93 | ||
94 | #[test] | 94 | #[test] |
@@ -106,17 +106,17 @@ mod tests { | |||
106 | ", | 106 | ", |
107 | ); | 107 | ); |
108 | assert_debug_snapshot!(completions, @r###" | 108 | assert_debug_snapshot!(completions, @r###" |
109 | [ | 109 | [ |
110 | CompletionItem { | 110 | CompletionItem { |
111 | label: "foo", | 111 | label: "foo", |
112 | source_range: 171..172, | 112 | source_range: 110..111, |
113 | delete: 171..172, | 113 | delete: 110..111, |
114 | insert: "foo", | 114 | insert: "foo", |
115 | kind: Field, | 115 | kind: Field, |
116 | detail: "u32", | 116 | detail: "u32", |
117 | }, | 117 | }, |
118 | ] | 118 | ] |
119 | "###); | 119 | "###); |
120 | } | 120 | } |
121 | 121 | ||
122 | #[test] | 122 | #[test] |
@@ -142,25 +142,25 @@ mod tests { | |||
142 | ", | 142 | ", |
143 | ); | 143 | ); |
144 | assert_debug_snapshot!(completions, @r###" | 144 | assert_debug_snapshot!(completions, @r###" |
145 | [ | 145 | [ |
146 | CompletionItem { | 146 | CompletionItem { |
147 | label: "bar", | 147 | label: "bar", |
148 | source_range: 372..372, | 148 | source_range: 203..203, |
149 | delete: 372..372, | 149 | delete: 203..203, |
150 | insert: "bar", | 150 | insert: "bar", |
151 | kind: Field, | 151 | kind: Field, |
152 | detail: "u32", | 152 | detail: "u32", |
153 | }, | 153 | }, |
154 | CompletionItem { | 154 | CompletionItem { |
155 | label: "baz", | 155 | label: "baz", |
156 | source_range: 372..372, | 156 | source_range: 203..203, |
157 | delete: 372..372, | 157 | delete: 203..203, |
158 | insert: "baz", | 158 | insert: "baz", |
159 | kind: Field, | 159 | kind: Field, |
160 | detail: "u32", | 160 | detail: "u32", |
161 | }, | 161 | }, |
162 | ] | 162 | ] |
163 | "###); | 163 | "###); |
164 | } | 164 | } |
165 | } | 165 | } |
166 | 166 | ||
@@ -187,18 +187,18 @@ mod tests { | |||
187 | ", | 187 | ", |
188 | ); | 188 | ); |
189 | assert_debug_snapshot!(completions, @r###" | 189 | assert_debug_snapshot!(completions, @r###" |
190 | [ | 190 | [ |
191 | CompletionItem { | 191 | CompletionItem { |
192 | label: "the_field", | 192 | label: "the_field", |
193 | source_range: 142..145, | 193 | source_range: 69..72, |
194 | delete: 142..145, | 194 | delete: 69..72, |
195 | insert: "the_field", | 195 | insert: "the_field", |
196 | kind: Field, | 196 | kind: Field, |
197 | detail: "u32", | 197 | detail: "u32", |
198 | deprecated: true, | 198 | deprecated: true, |
199 | }, | 199 | }, |
200 | ] | 200 | ] |
201 | "###); | 201 | "###); |
202 | } | 202 | } |
203 | 203 | ||
204 | #[test] | 204 | #[test] |
@@ -212,17 +212,17 @@ mod tests { | |||
212 | ", | 212 | ", |
213 | ); | 213 | ); |
214 | assert_debug_snapshot!(completions, @r###" | 214 | assert_debug_snapshot!(completions, @r###" |
215 | [ | 215 | [ |
216 | CompletionItem { | 216 | CompletionItem { |
217 | label: "the_field", | 217 | label: "the_field", |
218 | source_range: 83..86, | 218 | source_range: 46..49, |
219 | delete: 83..86, | 219 | delete: 46..49, |
220 | insert: "the_field", | 220 | insert: "the_field", |
221 | kind: Field, | 221 | kind: Field, |
222 | detail: "u32", | 222 | detail: "u32", |
223 | }, | 223 | }, |
224 | ] | 224 | ] |
225 | "###); | 225 | "###); |
226 | } | 226 | } |
227 | 227 | ||
228 | #[test] | 228 | #[test] |
@@ -238,17 +238,17 @@ mod tests { | |||
238 | ", | 238 | ", |
239 | ); | 239 | ); |
240 | assert_debug_snapshot!(completions, @r###" | 240 | assert_debug_snapshot!(completions, @r###" |
241 | [ | 241 | [ |
242 | CompletionItem { | 242 | CompletionItem { |
243 | label: "a", | 243 | label: "a", |
244 | source_range: 119..119, | 244 | source_range: 58..58, |
245 | delete: 119..119, | 245 | delete: 58..58, |
246 | insert: "a", | 246 | insert: "a", |
247 | kind: Field, | 247 | kind: Field, |
248 | detail: "u32", | 248 | detail: "u32", |
249 | }, | 249 | }, |
250 | ] | 250 | ] |
251 | "###); | 251 | "###); |
252 | } | 252 | } |
253 | 253 | ||
254 | #[test] | 254 | #[test] |
@@ -264,17 +264,17 @@ mod tests { | |||
264 | ", | 264 | ", |
265 | ); | 265 | ); |
266 | assert_debug_snapshot!(completions, @r###" | 266 | assert_debug_snapshot!(completions, @r###" |
267 | [ | 267 | [ |
268 | CompletionItem { | 268 | CompletionItem { |
269 | label: "b", | 269 | label: "b", |
270 | source_range: 119..119, | 270 | source_range: 70..70, |
271 | delete: 119..119, | 271 | delete: 70..70, |
272 | insert: "b", | 272 | insert: "b", |
273 | kind: Field, | 273 | kind: Field, |
274 | detail: "u32", | 274 | detail: "u32", |
275 | }, | 275 | }, |
276 | ] | 276 | ] |
277 | "###); | 277 | "###); |
278 | } | 278 | } |
279 | 279 | ||
280 | #[test] | 280 | #[test] |
@@ -289,17 +289,17 @@ mod tests { | |||
289 | ", | 289 | ", |
290 | ); | 290 | ); |
291 | assert_debug_snapshot!(completions, @r###" | 291 | assert_debug_snapshot!(completions, @r###" |
292 | [ | 292 | [ |
293 | CompletionItem { | 293 | CompletionItem { |
294 | label: "a", | 294 | label: "a", |
295 | source_range: 93..93, | 295 | source_range: 56..56, |
296 | delete: 93..93, | 296 | delete: 56..56, |
297 | insert: "a", | 297 | insert: "a", |
298 | kind: Field, | 298 | kind: Field, |
299 | detail: "u32", | 299 | detail: "u32", |
300 | }, | 300 | }, |
301 | ] | 301 | ] |
302 | "###); | 302 | "###); |
303 | } | 303 | } |
304 | 304 | ||
305 | #[test] | 305 | #[test] |
@@ -314,17 +314,17 @@ mod tests { | |||
314 | ", | 314 | ", |
315 | ); | 315 | ); |
316 | assert_debug_snapshot!(completions, @r###" | 316 | assert_debug_snapshot!(completions, @r###" |
317 | [ | 317 | [ |
318 | CompletionItem { | 318 | CompletionItem { |
319 | label: "the_field", | 319 | label: "the_field", |
320 | source_range: 137..140, | 320 | source_range: 88..91, |
321 | delete: 137..140, | 321 | delete: 88..91, |
322 | insert: "the_field", | 322 | insert: "the_field", |
323 | kind: Field, | 323 | kind: Field, |
324 | detail: "u32", | 324 | detail: "u32", |
325 | }, | 325 | }, |
326 | ] | 326 | ] |
327 | "###); | 327 | "###); |
328 | } | 328 | } |
329 | 329 | ||
330 | #[test] | 330 | #[test] |
@@ -349,25 +349,25 @@ mod tests { | |||
349 | ", | 349 | ", |
350 | ); | 350 | ); |
351 | assert_debug_snapshot!(completions, @r###" | 351 | assert_debug_snapshot!(completions, @r###" |
352 | [ | 352 | [ |
353 | CompletionItem { | 353 | CompletionItem { |
354 | label: "bar", | 354 | label: "bar", |
355 | source_range: 302..302, | 355 | source_range: 157..157, |
356 | delete: 302..302, | 356 | delete: 157..157, |
357 | insert: "bar", | 357 | insert: "bar", |
358 | kind: Field, | 358 | kind: Field, |
359 | detail: "u32", | 359 | detail: "u32", |
360 | }, | 360 | }, |
361 | CompletionItem { | 361 | CompletionItem { |
362 | label: "baz", | 362 | label: "baz", |
363 | source_range: 302..302, | 363 | source_range: 157..157, |
364 | delete: 302..302, | 364 | delete: 157..157, |
365 | insert: "baz", | 365 | insert: "baz", |
366 | kind: Field, | 366 | kind: Field, |
367 | detail: "u32", | 367 | detail: "u32", |
368 | }, | 368 | }, |
369 | ] | 369 | ] |
370 | "###); | 370 | "###); |
371 | } | 371 | } |
372 | 372 | ||
373 | #[test] | 373 | #[test] |
@@ -390,17 +390,17 @@ mod tests { | |||
390 | ", | 390 | ", |
391 | ); | 391 | ); |
392 | assert_debug_snapshot!(completions, @r###" | 392 | assert_debug_snapshot!(completions, @r###" |
393 | [ | 393 | [ |
394 | CompletionItem { | 394 | CompletionItem { |
395 | label: "foo2", | 395 | label: "foo2", |
396 | source_range: 221..221, | 396 | source_range: 112..112, |
397 | delete: 221..221, | 397 | delete: 112..112, |
398 | insert: "foo2", | 398 | insert: "foo2", |
399 | kind: Field, | 399 | kind: Field, |
400 | detail: "u32", | 400 | detail: "u32", |
401 | }, | 401 | }, |
402 | ] | 402 | ] |
403 | "###); | 403 | "###); |
404 | } | 404 | } |
405 | } | 405 | } |
406 | } | 406 | } |
diff --git a/crates/ra_ide/src/completion/complete_snippet.rs b/crates/ra_ide/src/completion/complete_snippet.rs index 0568d9ccf..52aaa70f0 100644 --- a/crates/ra_ide/src/completion/complete_snippet.rs +++ b/crates/ra_ide/src/completion/complete_snippet.rs | |||
@@ -129,31 +129,31 @@ mod tests { | |||
129 | [ | 129 | [ |
130 | CompletionItem { | 130 | CompletionItem { |
131 | label: "Test function", | 131 | label: "Test function", |
132 | source_range: 78..78, | 132 | source_range: 29..29, |
133 | delete: 78..78, | 133 | delete: 29..29, |
134 | insert: "#[test]\nfn ${1:feature}() {\n $0\n}", | 134 | insert: "#[test]\nfn ${1:feature}() {\n $0\n}", |
135 | kind: Snippet, | 135 | kind: Snippet, |
136 | lookup: "tfn", | 136 | lookup: "tfn", |
137 | }, | 137 | }, |
138 | CompletionItem { | 138 | CompletionItem { |
139 | label: "Test module", | 139 | label: "Test module", |
140 | source_range: 78..78, | 140 | source_range: 29..29, |
141 | delete: 78..78, | 141 | delete: 29..29, |
142 | insert: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn ${1:test_name}() {\n $0\n }\n}", | 142 | insert: "#[cfg(test)]\nmod tests {\n use super::*;\n\n #[test]\n fn ${1:test_name}() {\n $0\n }\n}", |
143 | kind: Snippet, | 143 | kind: Snippet, |
144 | lookup: "tmod", | 144 | lookup: "tmod", |
145 | }, | 145 | }, |
146 | CompletionItem { | 146 | CompletionItem { |
147 | label: "macro_rules", | 147 | label: "macro_rules", |
148 | source_range: 78..78, | 148 | source_range: 29..29, |
149 | delete: 78..78, | 149 | delete: 29..29, |
150 | insert: "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}", | 150 | insert: "macro_rules! $1 {\n\t($2) => {\n\t\t$0\n\t};\n}", |
151 | kind: Snippet, | 151 | kind: Snippet, |
152 | }, | 152 | }, |
153 | CompletionItem { | 153 | CompletionItem { |
154 | label: "pub(crate)", | 154 | label: "pub(crate)", |
155 | source_range: 78..78, | 155 | source_range: 29..29, |
156 | delete: 78..78, | 156 | delete: 29..29, |
157 | insert: "pub(crate) $0", | 157 | insert: "pub(crate) $0", |
158 | kind: Snippet, | 158 | kind: Snippet, |
159 | }, | 159 | }, |
diff --git a/crates/ra_ide/src/completion/complete_trait_impl.rs b/crates/ra_ide/src/completion/complete_trait_impl.rs index 21c9316e6..23e42928d 100644 --- a/crates/ra_ide/src/completion/complete_trait_impl.rs +++ b/crates/ra_ide/src/completion/complete_trait_impl.rs | |||
@@ -256,24 +256,24 @@ mod tests { | |||
256 | [ | 256 | [ |
257 | CompletionItem { | 257 | CompletionItem { |
258 | label: "const TEST_CONST: u16 = ", | 258 | label: "const TEST_CONST: u16 = ", |
259 | source_range: 209..210, | 259 | source_range: 112..113, |
260 | delete: 209..210, | 260 | delete: 112..113, |
261 | insert: "const TEST_CONST: u16 = ", | 261 | insert: "const TEST_CONST: u16 = ", |
262 | kind: Const, | 262 | kind: Const, |
263 | lookup: "TEST_CONST", | 263 | lookup: "TEST_CONST", |
264 | }, | 264 | }, |
265 | CompletionItem { | 265 | CompletionItem { |
266 | label: "fn test()", | 266 | label: "fn test()", |
267 | source_range: 209..210, | 267 | source_range: 112..113, |
268 | delete: 209..210, | 268 | delete: 112..113, |
269 | insert: "fn test() {\n $0\n}", | 269 | insert: "fn test() {\n $0\n}", |
270 | kind: Function, | 270 | kind: Function, |
271 | lookup: "test", | 271 | lookup: "test", |
272 | }, | 272 | }, |
273 | CompletionItem { | 273 | CompletionItem { |
274 | label: "type TestType = ", | 274 | label: "type TestType = ", |
275 | source_range: 209..210, | 275 | source_range: 112..113, |
276 | delete: 209..210, | 276 | delete: 112..113, |
277 | insert: "type TestType = ", | 277 | insert: "type TestType = ", |
278 | kind: TypeAlias, | 278 | kind: TypeAlias, |
279 | lookup: "TestType", | 279 | lookup: "TestType", |
@@ -322,8 +322,8 @@ mod tests { | |||
322 | [ | 322 | [ |
323 | CompletionItem { | 323 | CompletionItem { |
324 | label: "fn test()", | 324 | label: "fn test()", |
325 | source_range: 139..140, | 325 | source_range: 66..67, |
326 | delete: 139..140, | 326 | delete: 66..67, |
327 | insert: "fn test() {\n $0\n}", | 327 | insert: "fn test() {\n $0\n}", |
328 | kind: Function, | 328 | kind: Function, |
329 | lookup: "test", | 329 | lookup: "test", |
@@ -351,8 +351,8 @@ mod tests { | |||
351 | [ | 351 | [ |
352 | CompletionItem { | 352 | CompletionItem { |
353 | label: "fn foo()", | 353 | label: "fn foo()", |
354 | source_range: 141..142, | 354 | source_range: 68..69, |
355 | delete: 138..142, | 355 | delete: 65..69, |
356 | insert: "fn foo() {\n $0\n}", | 356 | insert: "fn foo() {\n $0\n}", |
357 | kind: Function, | 357 | kind: Function, |
358 | lookup: "foo", | 358 | lookup: "foo", |
@@ -383,8 +383,8 @@ mod tests { | |||
383 | [ | 383 | [ |
384 | CompletionItem { | 384 | CompletionItem { |
385 | label: "fn foo_bar()", | 385 | label: "fn foo_bar()", |
386 | source_range: 200..201, | 386 | source_range: 103..104, |
387 | delete: 197..201, | 387 | delete: 100..104, |
388 | insert: "fn foo_bar() {\n $0\n}", | 388 | insert: "fn foo_bar() {\n $0\n}", |
389 | kind: Function, | 389 | kind: Function, |
390 | lookup: "foo_bar", | 390 | lookup: "foo_bar", |
@@ -434,8 +434,8 @@ mod tests { | |||
434 | [ | 434 | [ |
435 | CompletionItem { | 435 | CompletionItem { |
436 | label: "fn foo()", | 436 | label: "fn foo()", |
437 | source_range: 144..145, | 437 | source_range: 71..72, |
438 | delete: 141..145, | 438 | delete: 68..72, |
439 | insert: "fn foo<T>() {\n $0\n}", | 439 | insert: "fn foo<T>() {\n $0\n}", |
440 | kind: Function, | 440 | kind: Function, |
441 | lookup: "foo", | 441 | lookup: "foo", |
@@ -463,8 +463,8 @@ mod tests { | |||
463 | [ | 463 | [ |
464 | CompletionItem { | 464 | CompletionItem { |
465 | label: "fn foo()", | 465 | label: "fn foo()", |
466 | source_range: 166..167, | 466 | source_range: 93..94, |
467 | delete: 163..167, | 467 | delete: 90..94, |
468 | insert: "fn foo<T>()\nwhere T: Into<String> {\n $0\n}", | 468 | insert: "fn foo<T>()\nwhere T: Into<String> {\n $0\n}", |
469 | kind: Function, | 469 | kind: Function, |
470 | lookup: "foo", | 470 | lookup: "foo", |
@@ -490,8 +490,8 @@ mod tests { | |||
490 | [ | 490 | [ |
491 | CompletionItem { | 491 | CompletionItem { |
492 | label: "type SomeType = ", | 492 | label: "type SomeType = ", |
493 | source_range: 124..125, | 493 | source_range: 63..64, |
494 | delete: 119..125, | 494 | delete: 58..64, |
495 | insert: "type SomeType = ", | 495 | insert: "type SomeType = ", |
496 | kind: TypeAlias, | 496 | kind: TypeAlias, |
497 | lookup: "SomeType", | 497 | lookup: "SomeType", |
@@ -517,8 +517,8 @@ mod tests { | |||
517 | [ | 517 | [ |
518 | CompletionItem { | 518 | CompletionItem { |
519 | label: "const SOME_CONST: u16 = ", | 519 | label: "const SOME_CONST: u16 = ", |
520 | source_range: 133..134, | 520 | source_range: 72..73, |
521 | delete: 127..134, | 521 | delete: 66..73, |
522 | insert: "const SOME_CONST: u16 = ", | 522 | insert: "const SOME_CONST: u16 = ", |
523 | kind: Const, | 523 | kind: Const, |
524 | lookup: "SOME_CONST", | 524 | lookup: "SOME_CONST", |
@@ -544,8 +544,8 @@ mod tests { | |||
544 | [ | 544 | [ |
545 | CompletionItem { | 545 | CompletionItem { |
546 | label: "const SOME_CONST: u16 = ", | 546 | label: "const SOME_CONST: u16 = ", |
547 | source_range: 138..139, | 547 | source_range: 77..78, |
548 | delete: 132..139, | 548 | delete: 71..78, |
549 | insert: "const SOME_CONST: u16 = ", | 549 | insert: "const SOME_CONST: u16 = ", |
550 | kind: Const, | 550 | kind: Const, |
551 | lookup: "SOME_CONST", | 551 | lookup: "SOME_CONST", |
diff --git a/crates/ra_ide/src/completion/complete_unqualified_path.rs b/crates/ra_ide/src/completion/complete_unqualified_path.rs index aa2b07a2f..a0a04bb58 100644 --- a/crates/ra_ide/src/completion/complete_unqualified_path.rs +++ b/crates/ra_ide/src/completion/complete_unqualified_path.rs | |||
@@ -85,15 +85,15 @@ mod tests { | |||
85 | "#, | 85 | "#, |
86 | ), | 86 | ), |
87 | @r###" | 87 | @r###" |
88 | [ | 88 | [ |
89 | CompletionItem { | 89 | CompletionItem { |
90 | label: "collections", | 90 | label: "collections", |
91 | source_range: 21..24, | 91 | source_range: 4..7, |
92 | delete: 21..24, | 92 | delete: 4..7, |
93 | insert: "collections", | 93 | insert: "collections", |
94 | }, | 94 | }, |
95 | ] | 95 | ] |
96 | "### | 96 | "### |
97 | ); | 97 | ); |
98 | } | 98 | } |
99 | 99 | ||
@@ -157,16 +157,16 @@ mod tests { | |||
157 | " | 157 | " |
158 | ), | 158 | ), |
159 | @r###" | 159 | @r###" |
160 | [ | 160 | [ |
161 | CompletionItem { | 161 | CompletionItem { |
162 | label: "Enum", | 162 | label: "Enum", |
163 | source_range: 231..233, | 163 | source_range: 102..104, |
164 | delete: 231..233, | 164 | delete: 102..104, |
165 | insert: "Enum", | 165 | insert: "Enum", |
166 | kind: Enum, | 166 | kind: Enum, |
167 | }, | 167 | }, |
168 | ] | 168 | ] |
169 | "### | 169 | "### |
170 | ); | 170 | ); |
171 | } | 171 | } |
172 | 172 | ||
@@ -186,8 +186,8 @@ mod tests { | |||
186 | [ | 186 | [ |
187 | CompletionItem { | 187 | CompletionItem { |
188 | label: "quux(…)", | 188 | label: "quux(…)", |
189 | source_range: 91..91, | 189 | source_range: 42..42, |
190 | delete: 91..91, | 190 | delete: 42..42, |
191 | insert: "quux(${1:x})$0", | 191 | insert: "quux(${1:x})$0", |
192 | kind: Function, | 192 | kind: Function, |
193 | lookup: "quux", | 193 | lookup: "quux", |
@@ -196,16 +196,16 @@ mod tests { | |||
196 | }, | 196 | }, |
197 | CompletionItem { | 197 | CompletionItem { |
198 | label: "x", | 198 | label: "x", |
199 | source_range: 91..91, | 199 | source_range: 42..42, |
200 | delete: 91..91, | 200 | delete: 42..42, |
201 | insert: "x", | 201 | insert: "x", |
202 | kind: Binding, | 202 | kind: Binding, |
203 | detail: "i32", | 203 | detail: "i32", |
204 | }, | 204 | }, |
205 | CompletionItem { | 205 | CompletionItem { |
206 | label: "y", | 206 | label: "y", |
207 | source_range: 91..91, | 207 | source_range: 42..42, |
208 | delete: 91..91, | 208 | delete: 42..42, |
209 | insert: "y", | 209 | insert: "y", |
210 | kind: Binding, | 210 | kind: Binding, |
211 | detail: "i32", | 211 | detail: "i32", |
@@ -235,23 +235,23 @@ mod tests { | |||
235 | [ | 235 | [ |
236 | CompletionItem { | 236 | CompletionItem { |
237 | label: "a", | 237 | label: "a", |
238 | source_range: 242..242, | 238 | source_range: 129..129, |
239 | delete: 242..242, | 239 | delete: 129..129, |
240 | insert: "a", | 240 | insert: "a", |
241 | kind: Binding, | 241 | kind: Binding, |
242 | }, | 242 | }, |
243 | CompletionItem { | 243 | CompletionItem { |
244 | label: "b", | 244 | label: "b", |
245 | source_range: 242..242, | 245 | source_range: 129..129, |
246 | delete: 242..242, | 246 | delete: 129..129, |
247 | insert: "b", | 247 | insert: "b", |
248 | kind: Binding, | 248 | kind: Binding, |
249 | detail: "i32", | 249 | detail: "i32", |
250 | }, | 250 | }, |
251 | CompletionItem { | 251 | CompletionItem { |
252 | label: "quux()", | 252 | label: "quux()", |
253 | source_range: 242..242, | 253 | source_range: 129..129, |
254 | delete: 242..242, | 254 | delete: 129..129, |
255 | insert: "quux()$0", | 255 | insert: "quux()$0", |
256 | kind: Function, | 256 | kind: Function, |
257 | lookup: "quux", | 257 | lookup: "quux", |
@@ -278,8 +278,8 @@ mod tests { | |||
278 | [ | 278 | [ |
279 | CompletionItem { | 279 | CompletionItem { |
280 | label: "quux()", | 280 | label: "quux()", |
281 | source_range: 95..95, | 281 | source_range: 46..46, |
282 | delete: 95..95, | 282 | delete: 46..46, |
283 | insert: "quux()$0", | 283 | insert: "quux()$0", |
284 | kind: Function, | 284 | kind: Function, |
285 | lookup: "quux", | 285 | lookup: "quux", |
@@ -287,8 +287,8 @@ mod tests { | |||
287 | }, | 287 | }, |
288 | CompletionItem { | 288 | CompletionItem { |
289 | label: "x", | 289 | label: "x", |
290 | source_range: 95..95, | 290 | source_range: 46..46, |
291 | delete: 95..95, | 291 | delete: 46..46, |
292 | insert: "x", | 292 | insert: "x", |
293 | kind: Binding, | 293 | kind: Binding, |
294 | }, | 294 | }, |
@@ -314,15 +314,15 @@ mod tests { | |||
314 | [ | 314 | [ |
315 | CompletionItem { | 315 | CompletionItem { |
316 | label: "index", | 316 | label: "index", |
317 | source_range: 107..107, | 317 | source_range: 58..58, |
318 | delete: 107..107, | 318 | delete: 58..58, |
319 | insert: "index", | 319 | insert: "index", |
320 | kind: Binding, | 320 | kind: Binding, |
321 | }, | 321 | }, |
322 | CompletionItem { | 322 | CompletionItem { |
323 | label: "test()", | 323 | label: "test()", |
324 | source_range: 107..107, | 324 | source_range: 58..58, |
325 | delete: 107..107, | 325 | delete: 58..58, |
326 | insert: "test()$0", | 326 | insert: "test()$0", |
327 | kind: Function, | 327 | kind: Function, |
328 | lookup: "test", | 328 | lookup: "test", |
@@ -347,15 +347,15 @@ mod tests { | |||
347 | [ | 347 | [ |
348 | CompletionItem { | 348 | CompletionItem { |
349 | label: "T", | 349 | label: "T", |
350 | source_range: 52..52, | 350 | source_range: 19..19, |
351 | delete: 52..52, | 351 | delete: 19..19, |
352 | insert: "T", | 352 | insert: "T", |
353 | kind: TypeParam, | 353 | kind: TypeParam, |
354 | }, | 354 | }, |
355 | CompletionItem { | 355 | CompletionItem { |
356 | label: "quux()", | 356 | label: "quux()", |
357 | source_range: 52..52, | 357 | source_range: 19..19, |
358 | delete: 52..52, | 358 | delete: 19..19, |
359 | insert: "quux()$0", | 359 | insert: "quux()$0", |
360 | kind: Function, | 360 | kind: Function, |
361 | lookup: "quux", | 361 | lookup: "quux", |
@@ -380,22 +380,22 @@ mod tests { | |||
380 | [ | 380 | [ |
381 | CompletionItem { | 381 | CompletionItem { |
382 | label: "Self", | 382 | label: "Self", |
383 | source_range: 54..54, | 383 | source_range: 21..21, |
384 | delete: 54..54, | 384 | delete: 21..21, |
385 | insert: "Self", | 385 | insert: "Self", |
386 | kind: TypeParam, | 386 | kind: TypeParam, |
387 | }, | 387 | }, |
388 | CompletionItem { | 388 | CompletionItem { |
389 | label: "T", | 389 | label: "T", |
390 | source_range: 54..54, | 390 | source_range: 21..21, |
391 | delete: 54..54, | 391 | delete: 21..21, |
392 | insert: "T", | 392 | insert: "T", |
393 | kind: TypeParam, | 393 | kind: TypeParam, |
394 | }, | 394 | }, |
395 | CompletionItem { | 395 | CompletionItem { |
396 | label: "X<…>", | 396 | label: "X<…>", |
397 | source_range: 54..54, | 397 | source_range: 21..21, |
398 | delete: 54..54, | 398 | delete: 21..21, |
399 | insert: "X<$0>", | 399 | insert: "X<$0>", |
400 | kind: Struct, | 400 | kind: Struct, |
401 | lookup: "X", | 401 | lookup: "X", |
@@ -419,15 +419,15 @@ mod tests { | |||
419 | [ | 419 | [ |
420 | CompletionItem { | 420 | CompletionItem { |
421 | label: "Self", | 421 | label: "Self", |
422 | source_range: 48..48, | 422 | source_range: 15..15, |
423 | delete: 48..48, | 423 | delete: 15..15, |
424 | insert: "Self", | 424 | insert: "Self", |
425 | kind: TypeParam, | 425 | kind: TypeParam, |
426 | }, | 426 | }, |
427 | CompletionItem { | 427 | CompletionItem { |
428 | label: "X", | 428 | label: "X", |
429 | source_range: 48..48, | 429 | source_range: 15..15, |
430 | delete: 48..48, | 430 | delete: 15..15, |
431 | insert: "X", | 431 | insert: "X", |
432 | kind: Enum, | 432 | kind: Enum, |
433 | }, | 433 | }, |
@@ -452,22 +452,22 @@ mod tests { | |||
452 | [ | 452 | [ |
453 | CompletionItem { | 453 | CompletionItem { |
454 | label: "Baz", | 454 | label: "Baz", |
455 | source_range: 105..105, | 455 | source_range: 40..40, |
456 | delete: 105..105, | 456 | delete: 40..40, |
457 | insert: "Baz", | 457 | insert: "Baz", |
458 | kind: Enum, | 458 | kind: Enum, |
459 | }, | 459 | }, |
460 | CompletionItem { | 460 | CompletionItem { |
461 | label: "Foo", | 461 | label: "Foo", |
462 | source_range: 105..105, | 462 | source_range: 40..40, |
463 | delete: 105..105, | 463 | delete: 40..40, |
464 | insert: "Foo", | 464 | insert: "Foo", |
465 | kind: Struct, | 465 | kind: Struct, |
466 | }, | 466 | }, |
467 | CompletionItem { | 467 | CompletionItem { |
468 | label: "quux()", | 468 | label: "quux()", |
469 | source_range: 105..105, | 469 | source_range: 40..40, |
470 | delete: 105..105, | 470 | delete: 40..40, |
471 | insert: "quux()$0", | 471 | insert: "quux()$0", |
472 | kind: Function, | 472 | kind: Function, |
473 | lookup: "quux", | 473 | lookup: "quux", |
@@ -520,15 +520,15 @@ mod tests { | |||
520 | [ | 520 | [ |
521 | CompletionItem { | 521 | CompletionItem { |
522 | label: "Bar", | 522 | label: "Bar", |
523 | source_range: 117..117, | 523 | source_range: 52..52, |
524 | delete: 117..117, | 524 | delete: 52..52, |
525 | insert: "Bar", | 525 | insert: "Bar", |
526 | kind: Struct, | 526 | kind: Struct, |
527 | }, | 527 | }, |
528 | CompletionItem { | 528 | CompletionItem { |
529 | label: "quux()", | 529 | label: "quux()", |
530 | source_range: 117..117, | 530 | source_range: 52..52, |
531 | delete: 117..117, | 531 | delete: 52..52, |
532 | insert: "quux()$0", | 532 | insert: "quux()$0", |
533 | kind: Function, | 533 | kind: Function, |
534 | lookup: "quux", | 534 | lookup: "quux", |
@@ -552,15 +552,15 @@ mod tests { | |||
552 | [ | 552 | [ |
553 | CompletionItem { | 553 | CompletionItem { |
554 | label: "Foo", | 554 | label: "Foo", |
555 | source_range: 55..55, | 555 | source_range: 22..22, |
556 | delete: 55..55, | 556 | delete: 22..22, |
557 | insert: "Foo", | 557 | insert: "Foo", |
558 | kind: Struct, | 558 | kind: Struct, |
559 | }, | 559 | }, |
560 | CompletionItem { | 560 | CompletionItem { |
561 | label: "x()", | 561 | label: "x()", |
562 | source_range: 55..55, | 562 | source_range: 22..22, |
563 | delete: 55..55, | 563 | delete: 22..22, |
564 | insert: "x()$0", | 564 | insert: "x()$0", |
565 | kind: Function, | 565 | kind: Function, |
566 | lookup: "x", | 566 | lookup: "x", |
@@ -589,16 +589,16 @@ mod tests { | |||
589 | [ | 589 | [ |
590 | CompletionItem { | 590 | CompletionItem { |
591 | label: "bar", | 591 | label: "bar", |
592 | source_range: 146..146, | 592 | source_range: 65..65, |
593 | delete: 146..146, | 593 | delete: 65..65, |
594 | insert: "bar", | 594 | insert: "bar", |
595 | kind: Binding, | 595 | kind: Binding, |
596 | detail: "i32", | 596 | detail: "i32", |
597 | }, | 597 | }, |
598 | CompletionItem { | 598 | CompletionItem { |
599 | label: "foo()", | 599 | label: "foo()", |
600 | source_range: 146..146, | 600 | source_range: 65..65, |
601 | delete: 146..146, | 601 | delete: 65..65, |
602 | insert: "foo()$0", | 602 | insert: "foo()$0", |
603 | kind: Function, | 603 | kind: Function, |
604 | lookup: "foo", | 604 | lookup: "foo", |
@@ -1001,16 +1001,16 @@ mod tests { | |||
1001 | [ | 1001 | [ |
1002 | CompletionItem { | 1002 | CompletionItem { |
1003 | label: "m!(…)", | 1003 | label: "m!(…)", |
1004 | source_range: 145..145, | 1004 | source_range: 80..80, |
1005 | delete: 145..145, | 1005 | delete: 80..80, |
1006 | insert: "m!($0)", | 1006 | insert: "m!($0)", |
1007 | kind: Macro, | 1007 | kind: Macro, |
1008 | detail: "macro_rules! m", | 1008 | detail: "macro_rules! m", |
1009 | }, | 1009 | }, |
1010 | CompletionItem { | 1010 | CompletionItem { |
1011 | label: "quux(…)", | 1011 | label: "quux(…)", |
1012 | source_range: 145..145, | 1012 | source_range: 80..80, |
1013 | delete: 145..145, | 1013 | delete: 80..80, |
1014 | insert: "quux(${1:x})$0", | 1014 | insert: "quux(${1:x})$0", |
1015 | kind: Function, | 1015 | kind: Function, |
1016 | lookup: "quux", | 1016 | lookup: "quux", |
@@ -1019,16 +1019,16 @@ mod tests { | |||
1019 | }, | 1019 | }, |
1020 | CompletionItem { | 1020 | CompletionItem { |
1021 | label: "x", | 1021 | label: "x", |
1022 | source_range: 145..145, | 1022 | source_range: 80..80, |
1023 | delete: 145..145, | 1023 | delete: 80..80, |
1024 | insert: "x", | 1024 | insert: "x", |
1025 | kind: Binding, | 1025 | kind: Binding, |
1026 | detail: "i32", | 1026 | detail: "i32", |
1027 | }, | 1027 | }, |
1028 | CompletionItem { | 1028 | CompletionItem { |
1029 | label: "y", | 1029 | label: "y", |
1030 | source_range: 145..145, | 1030 | source_range: 80..80, |
1031 | delete: 145..145, | 1031 | delete: 80..80, |
1032 | insert: "y", | 1032 | insert: "y", |
1033 | kind: Binding, | 1033 | kind: Binding, |
1034 | detail: "i32", | 1034 | detail: "i32", |
@@ -1054,16 +1054,16 @@ mod tests { | |||
1054 | [ | 1054 | [ |
1055 | CompletionItem { | 1055 | CompletionItem { |
1056 | label: "m!(…)", | 1056 | label: "m!(…)", |
1057 | source_range: 145..146, | 1057 | source_range: 80..81, |
1058 | delete: 145..146, | 1058 | delete: 80..81, |
1059 | insert: "m!($0)", | 1059 | insert: "m!($0)", |
1060 | kind: Macro, | 1060 | kind: Macro, |
1061 | detail: "macro_rules! m", | 1061 | detail: "macro_rules! m", |
1062 | }, | 1062 | }, |
1063 | CompletionItem { | 1063 | CompletionItem { |
1064 | label: "quux(…)", | 1064 | label: "quux(…)", |
1065 | source_range: 145..146, | 1065 | source_range: 80..81, |
1066 | delete: 145..146, | 1066 | delete: 80..81, |
1067 | insert: "quux(${1:x})$0", | 1067 | insert: "quux(${1:x})$0", |
1068 | kind: Function, | 1068 | kind: Function, |
1069 | lookup: "quux", | 1069 | lookup: "quux", |
@@ -1072,16 +1072,16 @@ mod tests { | |||
1072 | }, | 1072 | }, |
1073 | CompletionItem { | 1073 | CompletionItem { |
1074 | label: "x", | 1074 | label: "x", |
1075 | source_range: 145..146, | 1075 | source_range: 80..81, |
1076 | delete: 145..146, | 1076 | delete: 80..81, |
1077 | insert: "x", | 1077 | insert: "x", |
1078 | kind: Binding, | 1078 | kind: Binding, |
1079 | detail: "i32", | 1079 | detail: "i32", |
1080 | }, | 1080 | }, |
1081 | CompletionItem { | 1081 | CompletionItem { |
1082 | label: "y", | 1082 | label: "y", |
1083 | source_range: 145..146, | 1083 | source_range: 80..81, |
1084 | delete: 145..146, | 1084 | delete: 80..81, |
1085 | insert: "y", | 1085 | insert: "y", |
1086 | kind: Binding, | 1086 | kind: Binding, |
1087 | detail: "i32", | 1087 | detail: "i32", |
@@ -1107,16 +1107,16 @@ mod tests { | |||
1107 | [ | 1107 | [ |
1108 | CompletionItem { | 1108 | CompletionItem { |
1109 | label: "m!(…)", | 1109 | label: "m!(…)", |
1110 | source_range: 145..146, | 1110 | source_range: 80..81, |
1111 | delete: 145..146, | 1111 | delete: 80..81, |
1112 | insert: "m!($0)", | 1112 | insert: "m!($0)", |
1113 | kind: Macro, | 1113 | kind: Macro, |
1114 | detail: "macro_rules! m", | 1114 | detail: "macro_rules! m", |
1115 | }, | 1115 | }, |
1116 | CompletionItem { | 1116 | CompletionItem { |
1117 | label: "quux(…)", | 1117 | label: "quux(…)", |
1118 | source_range: 145..146, | 1118 | source_range: 80..81, |
1119 | delete: 145..146, | 1119 | delete: 80..81, |
1120 | insert: "quux(${1:x})$0", | 1120 | insert: "quux(${1:x})$0", |
1121 | kind: Function, | 1121 | kind: Function, |
1122 | lookup: "quux", | 1122 | lookup: "quux", |
@@ -1125,16 +1125,16 @@ mod tests { | |||
1125 | }, | 1125 | }, |
1126 | CompletionItem { | 1126 | CompletionItem { |
1127 | label: "x", | 1127 | label: "x", |
1128 | source_range: 145..146, | 1128 | source_range: 80..81, |
1129 | delete: 145..146, | 1129 | delete: 80..81, |
1130 | insert: "x", | 1130 | insert: "x", |
1131 | kind: Binding, | 1131 | kind: Binding, |
1132 | detail: "i32", | 1132 | detail: "i32", |
1133 | }, | 1133 | }, |
1134 | CompletionItem { | 1134 | CompletionItem { |
1135 | label: "y", | 1135 | label: "y", |
1136 | source_range: 145..146, | 1136 | source_range: 80..81, |
1137 | delete: 145..146, | 1137 | delete: 80..81, |
1138 | insert: "y", | 1138 | insert: "y", |
1139 | kind: Binding, | 1139 | kind: Binding, |
1140 | detail: "i32", | 1140 | detail: "i32", |
@@ -1160,14 +1160,14 @@ mod tests { | |||
1160 | [ | 1160 | [ |
1161 | CompletionItem { | 1161 | CompletionItem { |
1162 | label: "Quux", | 1162 | label: "Quux", |
1163 | source_range: 82..82, | 1163 | source_range: 33..33, |
1164 | delete: 82..82, | 1164 | delete: 33..33, |
1165 | insert: "Quux", | 1165 | insert: "Quux", |
1166 | }, | 1166 | }, |
1167 | CompletionItem { | 1167 | CompletionItem { |
1168 | label: "main()", | 1168 | label: "main()", |
1169 | source_range: 82..82, | 1169 | source_range: 33..33, |
1170 | delete: 82..82, | 1170 | delete: 33..33, |
1171 | insert: "main()$0", | 1171 | insert: "main()$0", |
1172 | kind: Function, | 1172 | kind: Function, |
1173 | lookup: "main", | 1173 | lookup: "main", |
@@ -1201,15 +1201,15 @@ mod tests { | |||
1201 | [ | 1201 | [ |
1202 | CompletionItem { | 1202 | CompletionItem { |
1203 | label: "Foo", | 1203 | label: "Foo", |
1204 | source_range: 248..250, | 1204 | source_range: 103..105, |
1205 | delete: 248..250, | 1205 | delete: 103..105, |
1206 | insert: "Foo", | 1206 | insert: "Foo", |
1207 | kind: Enum, | 1207 | kind: Enum, |
1208 | }, | 1208 | }, |
1209 | CompletionItem { | 1209 | CompletionItem { |
1210 | label: "Foo::Bar", | 1210 | label: "Foo::Bar", |
1211 | source_range: 248..250, | 1211 | source_range: 103..105, |
1212 | delete: 248..250, | 1212 | delete: 103..105, |
1213 | insert: "Foo::Bar", | 1213 | insert: "Foo::Bar", |
1214 | kind: EnumVariant, | 1214 | kind: EnumVariant, |
1215 | lookup: "Bar", | 1215 | lookup: "Bar", |
@@ -1217,8 +1217,8 @@ mod tests { | |||
1217 | }, | 1217 | }, |
1218 | CompletionItem { | 1218 | CompletionItem { |
1219 | label: "Foo::Baz", | 1219 | label: "Foo::Baz", |
1220 | source_range: 248..250, | 1220 | source_range: 103..105, |
1221 | delete: 248..250, | 1221 | delete: 103..105, |
1222 | insert: "Foo::Baz", | 1222 | insert: "Foo::Baz", |
1223 | kind: EnumVariant, | 1223 | kind: EnumVariant, |
1224 | lookup: "Baz", | 1224 | lookup: "Baz", |
@@ -1226,8 +1226,8 @@ mod tests { | |||
1226 | }, | 1226 | }, |
1227 | CompletionItem { | 1227 | CompletionItem { |
1228 | label: "Foo::Quux", | 1228 | label: "Foo::Quux", |
1229 | source_range: 248..250, | 1229 | source_range: 103..105, |
1230 | delete: 248..250, | 1230 | delete: 103..105, |
1231 | insert: "Foo::Quux", | 1231 | insert: "Foo::Quux", |
1232 | kind: EnumVariant, | 1232 | kind: EnumVariant, |
1233 | lookup: "Quux", | 1233 | lookup: "Quux", |
@@ -1262,15 +1262,15 @@ mod tests { | |||
1262 | [ | 1262 | [ |
1263 | CompletionItem { | 1263 | CompletionItem { |
1264 | label: "Foo", | 1264 | label: "Foo", |
1265 | source_range: 219..221, | 1265 | source_range: 90..92, |
1266 | delete: 219..221, | 1266 | delete: 90..92, |
1267 | insert: "Foo", | 1267 | insert: "Foo", |
1268 | kind: Enum, | 1268 | kind: Enum, |
1269 | }, | 1269 | }, |
1270 | CompletionItem { | 1270 | CompletionItem { |
1271 | label: "Foo::Bar", | 1271 | label: "Foo::Bar", |
1272 | source_range: 219..221, | 1272 | source_range: 90..92, |
1273 | delete: 219..221, | 1273 | delete: 90..92, |
1274 | insert: "Foo::Bar", | 1274 | insert: "Foo::Bar", |
1275 | kind: EnumVariant, | 1275 | kind: EnumVariant, |
1276 | lookup: "Bar", | 1276 | lookup: "Bar", |
@@ -1278,8 +1278,8 @@ mod tests { | |||
1278 | }, | 1278 | }, |
1279 | CompletionItem { | 1279 | CompletionItem { |
1280 | label: "Foo::Baz", | 1280 | label: "Foo::Baz", |
1281 | source_range: 219..221, | 1281 | source_range: 90..92, |
1282 | delete: 219..221, | 1282 | delete: 90..92, |
1283 | insert: "Foo::Baz", | 1283 | insert: "Foo::Baz", |
1284 | kind: EnumVariant, | 1284 | kind: EnumVariant, |
1285 | lookup: "Baz", | 1285 | lookup: "Baz", |
@@ -1287,8 +1287,8 @@ mod tests { | |||
1287 | }, | 1287 | }, |
1288 | CompletionItem { | 1288 | CompletionItem { |
1289 | label: "Foo::Quux", | 1289 | label: "Foo::Quux", |
1290 | source_range: 219..221, | 1290 | source_range: 90..92, |
1291 | delete: 219..221, | 1291 | delete: 90..92, |
1292 | insert: "Foo::Quux", | 1292 | insert: "Foo::Quux", |
1293 | kind: EnumVariant, | 1293 | kind: EnumVariant, |
1294 | lookup: "Quux", | 1294 | lookup: "Quux", |
@@ -1319,15 +1319,15 @@ mod tests { | |||
1319 | [ | 1319 | [ |
1320 | CompletionItem { | 1320 | CompletionItem { |
1321 | label: "Foo", | 1321 | label: "Foo", |
1322 | source_range: 185..186, | 1322 | source_range: 72..73, |
1323 | delete: 185..186, | 1323 | delete: 72..73, |
1324 | insert: "Foo", | 1324 | insert: "Foo", |
1325 | kind: Enum, | 1325 | kind: Enum, |
1326 | }, | 1326 | }, |
1327 | CompletionItem { | 1327 | CompletionItem { |
1328 | label: "Foo::Bar", | 1328 | label: "Foo::Bar", |
1329 | source_range: 185..186, | 1329 | source_range: 72..73, |
1330 | delete: 185..186, | 1330 | delete: 72..73, |
1331 | insert: "Foo::Bar", | 1331 | insert: "Foo::Bar", |
1332 | kind: EnumVariant, | 1332 | kind: EnumVariant, |
1333 | lookup: "Bar", | 1333 | lookup: "Bar", |
@@ -1335,8 +1335,8 @@ mod tests { | |||
1335 | }, | 1335 | }, |
1336 | CompletionItem { | 1336 | CompletionItem { |
1337 | label: "Foo::Baz", | 1337 | label: "Foo::Baz", |
1338 | source_range: 185..186, | 1338 | source_range: 72..73, |
1339 | delete: 185..186, | 1339 | delete: 72..73, |
1340 | insert: "Foo::Baz", | 1340 | insert: "Foo::Baz", |
1341 | kind: EnumVariant, | 1341 | kind: EnumVariant, |
1342 | lookup: "Baz", | 1342 | lookup: "Baz", |
@@ -1344,8 +1344,8 @@ mod tests { | |||
1344 | }, | 1344 | }, |
1345 | CompletionItem { | 1345 | CompletionItem { |
1346 | label: "Foo::Quux", | 1346 | label: "Foo::Quux", |
1347 | source_range: 185..186, | 1347 | source_range: 72..73, |
1348 | delete: 185..186, | 1348 | delete: 72..73, |
1349 | insert: "Foo::Quux", | 1349 | insert: "Foo::Quux", |
1350 | kind: EnumVariant, | 1350 | kind: EnumVariant, |
1351 | lookup: "Quux", | 1351 | lookup: "Quux", |
@@ -1353,8 +1353,8 @@ mod tests { | |||
1353 | }, | 1353 | }, |
1354 | CompletionItem { | 1354 | CompletionItem { |
1355 | label: "main()", | 1355 | label: "main()", |
1356 | source_range: 185..186, | 1356 | source_range: 72..73, |
1357 | delete: 185..186, | 1357 | delete: 72..73, |
1358 | insert: "main()$0", | 1358 | insert: "main()$0", |
1359 | kind: Function, | 1359 | kind: Function, |
1360 | lookup: "main", | 1360 | lookup: "main", |
@@ -1381,8 +1381,8 @@ mod tests { | |||
1381 | [ | 1381 | [ |
1382 | CompletionItem { | 1382 | CompletionItem { |
1383 | label: "f()", | 1383 | label: "f()", |
1384 | source_range: 98..99, | 1384 | source_range: 49..50, |
1385 | delete: 98..99, | 1385 | delete: 49..50, |
1386 | insert: "f()$0", | 1386 | insert: "f()$0", |
1387 | kind: Function, | 1387 | kind: Function, |
1388 | lookup: "f", | 1388 | lookup: "f", |
@@ -1390,15 +1390,15 @@ mod tests { | |||
1390 | }, | 1390 | }, |
1391 | CompletionItem { | 1391 | CompletionItem { |
1392 | label: "m", | 1392 | label: "m", |
1393 | source_range: 98..99, | 1393 | source_range: 49..50, |
1394 | delete: 98..99, | 1394 | delete: 49..50, |
1395 | insert: "m", | 1395 | insert: "m", |
1396 | kind: Module, | 1396 | kind: Module, |
1397 | }, | 1397 | }, |
1398 | CompletionItem { | 1398 | CompletionItem { |
1399 | label: "m::E::V", | 1399 | label: "m::E::V", |
1400 | source_range: 98..99, | 1400 | source_range: 49..50, |
1401 | delete: 98..99, | 1401 | delete: 49..50, |
1402 | insert: "m::E::V", | 1402 | insert: "m::E::V", |
1403 | kind: EnumVariant, | 1403 | kind: EnumVariant, |
1404 | lookup: "V", | 1404 | lookup: "V", |
diff --git a/crates/ra_ide/src/completion/presentation.rs b/crates/ra_ide/src/completion/presentation.rs index 61565c84f..4fdc2f0bb 100644 --- a/crates/ra_ide/src/completion/presentation.rs +++ b/crates/ra_ide/src/completion/presentation.rs | |||
@@ -491,13 +491,14 @@ mod tests { | |||
491 | [ | 491 | [ |
492 | CompletionItem { | 492 | CompletionItem { |
493 | label: "Foo", | 493 | label: "Foo", |
494 | source_range: 121..123, | 494 | source_range: 56..58, |
495 | delete: 121..123, | 495 | delete: 56..58, |
496 | insert: "Foo", | 496 | insert: "Foo", |
497 | kind: EnumVariant, | 497 | kind: EnumVariant, |
498 | detail: "{ x: i32, y: i32 }", | 498 | detail: "{ x: i32, y: i32 }", |
499 | }, | 499 | }, |
500 | ]"### | 500 | ] |
501 | "### | ||
501 | ); | 502 | ); |
502 | } | 503 | } |
503 | 504 | ||
@@ -517,15 +518,16 @@ mod tests { | |||
517 | [ | 518 | [ |
518 | CompletionItem { | 519 | CompletionItem { |
519 | label: "Foo(…)", | 520 | label: "Foo(…)", |
520 | source_range: 115..117, | 521 | source_range: 50..52, |
521 | delete: 115..117, | 522 | delete: 50..52, |
522 | insert: "Foo($0)", | 523 | insert: "Foo($0)", |
523 | kind: EnumVariant, | 524 | kind: EnumVariant, |
524 | lookup: "Foo", | 525 | lookup: "Foo", |
525 | detail: "(i32, i32)", | 526 | detail: "(i32, i32)", |
526 | trigger_call_info: true, | 527 | trigger_call_info: true, |
527 | }, | 528 | }, |
528 | ]"### | 529 | ] |
530 | "### | ||
529 | ); | 531 | ); |
530 | } | 532 | } |
531 | 533 | ||
@@ -545,13 +547,14 @@ mod tests { | |||
545 | [ | 547 | [ |
546 | CompletionItem { | 548 | CompletionItem { |
547 | label: "Foo", | 549 | label: "Foo", |
548 | source_range: 104..106, | 550 | source_range: 39..41, |
549 | delete: 104..106, | 551 | delete: 39..41, |
550 | insert: "Foo", | 552 | insert: "Foo", |
551 | kind: EnumVariant, | 553 | kind: EnumVariant, |
552 | detail: "()", | 554 | detail: "()", |
553 | }, | 555 | }, |
554 | ]"### | 556 | ] |
557 | "### | ||
555 | ); | 558 | ); |
556 | } | 559 | } |
557 | 560 | ||
@@ -573,8 +576,8 @@ mod tests { | |||
573 | [ | 576 | [ |
574 | CompletionItem { | 577 | CompletionItem { |
575 | label: "main()", | 578 | label: "main()", |
576 | source_range: 203..206, | 579 | source_range: 122..125, |
577 | delete: 203..206, | 580 | delete: 122..125, |
578 | insert: "main()$0", | 581 | insert: "main()$0", |
579 | kind: Function, | 582 | kind: Function, |
580 | lookup: "main", | 583 | lookup: "main", |
@@ -582,8 +585,8 @@ mod tests { | |||
582 | }, | 585 | }, |
583 | CompletionItem { | 586 | CompletionItem { |
584 | label: "something_deprecated()", | 587 | label: "something_deprecated()", |
585 | source_range: 203..206, | 588 | source_range: 122..125, |
586 | delete: 203..206, | 589 | delete: 122..125, |
587 | insert: "something_deprecated()$0", | 590 | insert: "something_deprecated()$0", |
588 | kind: Function, | 591 | kind: Function, |
589 | lookup: "something_deprecated", | 592 | lookup: "something_deprecated", |
@@ -592,8 +595,8 @@ mod tests { | |||
592 | }, | 595 | }, |
593 | CompletionItem { | 596 | CompletionItem { |
594 | label: "something_else_deprecated()", | 597 | label: "something_else_deprecated()", |
595 | source_range: 203..206, | 598 | source_range: 122..125, |
596 | delete: 203..206, | 599 | delete: 122..125, |
597 | insert: "something_else_deprecated()$0", | 600 | insert: "something_else_deprecated()$0", |
598 | kind: Function, | 601 | kind: Function, |
599 | lookup: "something_else_deprecated", | 602 | lookup: "something_else_deprecated", |
@@ -619,8 +622,8 @@ mod tests { | |||
619 | [ | 622 | [ |
620 | CompletionItem { | 623 | CompletionItem { |
621 | label: "main()", | 624 | label: "main()", |
622 | source_range: 61..64, | 625 | source_range: 28..31, |
623 | delete: 61..64, | 626 | delete: 28..31, |
624 | insert: "main()$0", | 627 | insert: "main()$0", |
625 | kind: Function, | 628 | kind: Function, |
626 | lookup: "main", | 629 | lookup: "main", |
@@ -628,8 +631,8 @@ mod tests { | |||
628 | }, | 631 | }, |
629 | CompletionItem { | 632 | CompletionItem { |
630 | label: "no_args()", | 633 | label: "no_args()", |
631 | source_range: 61..64, | 634 | source_range: 28..31, |
632 | delete: 61..64, | 635 | delete: 28..31, |
633 | insert: "no_args()$0", | 636 | insert: "no_args()$0", |
634 | kind: Function, | 637 | kind: Function, |
635 | lookup: "no_args", | 638 | lookup: "no_args", |
@@ -649,8 +652,8 @@ mod tests { | |||
649 | [ | 652 | [ |
650 | CompletionItem { | 653 | CompletionItem { |
651 | label: "main()", | 654 | label: "main()", |
652 | source_range: 80..85, | 655 | source_range: 47..52, |
653 | delete: 80..85, | 656 | delete: 47..52, |
654 | insert: "main()$0", | 657 | insert: "main()$0", |
655 | kind: Function, | 658 | kind: Function, |
656 | lookup: "main", | 659 | lookup: "main", |
@@ -658,8 +661,8 @@ mod tests { | |||
658 | }, | 661 | }, |
659 | CompletionItem { | 662 | CompletionItem { |
660 | label: "with_args(…)", | 663 | label: "with_args(…)", |
661 | source_range: 80..85, | 664 | source_range: 47..52, |
662 | delete: 80..85, | 665 | delete: 47..52, |
663 | insert: "with_args(${1:x}, ${2:y})$0", | 666 | insert: "with_args(${1:x}, ${2:y})$0", |
664 | kind: Function, | 667 | kind: Function, |
665 | lookup: "with_args", | 668 | lookup: "with_args", |
@@ -680,8 +683,8 @@ mod tests { | |||
680 | [ | 683 | [ |
681 | CompletionItem { | 684 | CompletionItem { |
682 | label: "main()", | 685 | label: "main()", |
683 | source_range: 110..115, | 686 | source_range: 77..82, |
684 | delete: 110..115, | 687 | delete: 77..82, |
685 | insert: "main()$0", | 688 | insert: "main()$0", |
686 | kind: Function, | 689 | kind: Function, |
687 | lookup: "main", | 690 | lookup: "main", |
@@ -689,8 +692,8 @@ mod tests { | |||
689 | }, | 692 | }, |
690 | CompletionItem { | 693 | CompletionItem { |
691 | label: "with_ignored_args(…)", | 694 | label: "with_ignored_args(…)", |
692 | source_range: 110..115, | 695 | source_range: 77..82, |
693 | delete: 110..115, | 696 | delete: 77..82, |
694 | insert: "with_ignored_args(${1:foo}, ${2:bar}, ${3:ho_ge_})$0", | 697 | insert: "with_ignored_args(${1:foo}, ${2:bar}, ${3:ho_ge_})$0", |
695 | kind: Function, | 698 | kind: Function, |
696 | lookup: "with_ignored_args", | 699 | lookup: "with_ignored_args", |
@@ -716,8 +719,8 @@ mod tests { | |||
716 | [ | 719 | [ |
717 | CompletionItem { | 720 | CompletionItem { |
718 | label: "foo()", | 721 | label: "foo()", |
719 | source_range: 163..164, | 722 | source_range: 66..67, |
720 | delete: 163..164, | 723 | delete: 66..67, |
721 | insert: "foo()$0", | 724 | insert: "foo()$0", |
722 | kind: Method, | 725 | kind: Method, |
723 | lookup: "foo", | 726 | lookup: "foo", |
@@ -742,8 +745,8 @@ mod tests { | |||
742 | [ | 745 | [ |
743 | CompletionItem { | 746 | CompletionItem { |
744 | label: "foo_ignored_args(…)", | 747 | label: "foo_ignored_args(…)", |
745 | source_range: 194..195, | 748 | source_range: 97..98, |
746 | delete: 194..195, | 749 | delete: 97..98, |
747 | insert: "foo_ignored_args(${1:a}, ${2:b})$0", | 750 | insert: "foo_ignored_args(${1:a}, ${2:b})$0", |
748 | kind: Method, | 751 | kind: Method, |
749 | lookup: "foo_ignored_args", | 752 | lookup: "foo_ignored_args", |
@@ -771,23 +774,23 @@ mod tests { | |||
771 | [ | 774 | [ |
772 | CompletionItem { | 775 | CompletionItem { |
773 | label: "None", | 776 | label: "None", |
774 | source_range: 144..147, | 777 | source_range: 79..82, |
775 | delete: 144..147, | 778 | delete: 79..82, |
776 | insert: "None", | 779 | insert: "None", |
777 | kind: EnumVariant, | 780 | kind: EnumVariant, |
778 | detail: "()", | 781 | detail: "()", |
779 | }, | 782 | }, |
780 | CompletionItem { | 783 | CompletionItem { |
781 | label: "Option", | 784 | label: "Option", |
782 | source_range: 144..147, | 785 | source_range: 79..82, |
783 | delete: 144..147, | 786 | delete: 79..82, |
784 | insert: "Option", | 787 | insert: "Option", |
785 | kind: Enum, | 788 | kind: Enum, |
786 | }, | 789 | }, |
787 | CompletionItem { | 790 | CompletionItem { |
788 | label: "Some(…)", | 791 | label: "Some(…)", |
789 | source_range: 144..147, | 792 | source_range: 79..82, |
790 | delete: 144..147, | 793 | delete: 79..82, |
791 | insert: "Some($0)", | 794 | insert: "Some($0)", |
792 | kind: EnumVariant, | 795 | kind: EnumVariant, |
793 | lookup: "Some", | 796 | lookup: "Some", |
@@ -796,8 +799,8 @@ mod tests { | |||
796 | }, | 799 | }, |
797 | CompletionItem { | 800 | CompletionItem { |
798 | label: "main()", | 801 | label: "main()", |
799 | source_range: 144..147, | 802 | source_range: 79..82, |
800 | delete: 144..147, | 803 | delete: 79..82, |
801 | insert: "main()$0", | 804 | insert: "main()$0", |
802 | kind: Function, | 805 | kind: Function, |
803 | lookup: "main", | 806 | lookup: "main", |
@@ -822,23 +825,23 @@ mod tests { | |||
822 | [ | 825 | [ |
823 | CompletionItem { | 826 | CompletionItem { |
824 | label: "None", | 827 | label: "None", |
825 | source_range: 185..188, | 828 | source_range: 104..107, |
826 | delete: 185..188, | 829 | delete: 104..107, |
827 | insert: "None", | 830 | insert: "None", |
828 | kind: EnumVariant, | 831 | kind: EnumVariant, |
829 | detail: "()", | 832 | detail: "()", |
830 | }, | 833 | }, |
831 | CompletionItem { | 834 | CompletionItem { |
832 | label: "Option", | 835 | label: "Option", |
833 | source_range: 185..188, | 836 | source_range: 104..107, |
834 | delete: 185..188, | 837 | delete: 104..107, |
835 | insert: "Option", | 838 | insert: "Option", |
836 | kind: Enum, | 839 | kind: Enum, |
837 | }, | 840 | }, |
838 | CompletionItem { | 841 | CompletionItem { |
839 | label: "Some(…)", | 842 | label: "Some(…)", |
840 | source_range: 185..188, | 843 | source_range: 104..107, |
841 | delete: 185..188, | 844 | delete: 104..107, |
842 | insert: "Some($0)", | 845 | insert: "Some($0)", |
843 | kind: EnumVariant, | 846 | kind: EnumVariant, |
844 | lookup: "Some", | 847 | lookup: "Some", |
@@ -872,23 +875,23 @@ mod tests { | |||
872 | [ | 875 | [ |
873 | CompletionItem { | 876 | CompletionItem { |
874 | label: "ManualVtable", | 877 | label: "ManualVtable", |
875 | source_range: 295..299, | 878 | source_range: 182..186, |
876 | delete: 295..299, | 879 | delete: 182..186, |
877 | insert: "ManualVtable", | 880 | insert: "ManualVtable", |
878 | kind: Struct, | 881 | kind: Struct, |
879 | }, | 882 | }, |
880 | CompletionItem { | 883 | CompletionItem { |
881 | label: "main", | 884 | label: "main", |
882 | source_range: 295..299, | 885 | source_range: 182..186, |
883 | delete: 295..299, | 886 | delete: 182..186, |
884 | insert: "main", | 887 | insert: "main", |
885 | kind: Function, | 888 | kind: Function, |
886 | detail: "fn main() -> ManualVtable", | 889 | detail: "fn main() -> ManualVtable", |
887 | }, | 890 | }, |
888 | CompletionItem { | 891 | CompletionItem { |
889 | label: "somefn", | 892 | label: "somefn", |
890 | source_range: 295..299, | 893 | source_range: 182..186, |
891 | delete: 295..299, | 894 | delete: 182..186, |
892 | insert: "somefn", | 895 | insert: "somefn", |
893 | kind: Function, | 896 | kind: Function, |
894 | detail: "fn somefn(with: u8, a: u8, lot: u8, of: u8, args: u8)", | 897 | detail: "fn somefn(with: u8, a: u8, lot: u8, of: u8, args: u8)", |
@@ -916,8 +919,8 @@ mod tests { | |||
916 | [ | 919 | [ |
917 | CompletionItem { | 920 | CompletionItem { |
918 | label: "foo(…)", | 921 | label: "foo(…)", |
919 | source_range: 171..172, | 922 | source_range: 74..75, |
920 | delete: 171..172, | 923 | delete: 74..75, |
921 | insert: "foo(${1:x})$0", | 924 | insert: "foo(${1:x})$0", |
922 | kind: Method, | 925 | kind: Method, |
923 | lookup: "foo", | 926 | lookup: "foo", |
@@ -951,8 +954,8 @@ mod tests { | |||
951 | [ | 954 | [ |
952 | CompletionItem { | 955 | CompletionItem { |
953 | label: "foo(…)", | 956 | label: "foo(…)", |
954 | source_range: 171..172, | 957 | source_range: 74..75, |
955 | delete: 171..172, | 958 | delete: 74..75, |
956 | insert: "foo($0)", | 959 | insert: "foo($0)", |
957 | kind: Method, | 960 | kind: Method, |
958 | lookup: "foo", | 961 | lookup: "foo", |
@@ -1062,16 +1065,16 @@ mod tests { | |||
1062 | [ | 1065 | [ |
1063 | CompletionItem { | 1066 | CompletionItem { |
1064 | label: "Vec<…>", | 1067 | label: "Vec<…>", |
1065 | source_range: 61..63, | 1068 | source_range: 28..30, |
1066 | delete: 61..63, | 1069 | delete: 28..30, |
1067 | insert: "Vec<$0>", | 1070 | insert: "Vec<$0>", |
1068 | kind: Struct, | 1071 | kind: Struct, |
1069 | lookup: "Vec", | 1072 | lookup: "Vec", |
1070 | }, | 1073 | }, |
1071 | CompletionItem { | 1074 | CompletionItem { |
1072 | label: "foo(…)", | 1075 | label: "foo(…)", |
1073 | source_range: 61..63, | 1076 | source_range: 28..30, |
1074 | delete: 61..63, | 1077 | delete: 28..30, |
1075 | insert: "foo(${1:xs})$0", | 1078 | insert: "foo(${1:xs})$0", |
1076 | kind: Function, | 1079 | kind: Function, |
1077 | lookup: "foo", | 1080 | lookup: "foo", |
@@ -1092,16 +1095,16 @@ mod tests { | |||
1092 | [ | 1095 | [ |
1093 | CompletionItem { | 1096 | CompletionItem { |
1094 | label: "Vec<…>", | 1097 | label: "Vec<…>", |
1095 | source_range: 64..66, | 1098 | source_range: 31..33, |
1096 | delete: 64..66, | 1099 | delete: 31..33, |
1097 | insert: "Vec<$0>", | 1100 | insert: "Vec<$0>", |
1098 | kind: TypeAlias, | 1101 | kind: TypeAlias, |
1099 | lookup: "Vec", | 1102 | lookup: "Vec", |
1100 | }, | 1103 | }, |
1101 | CompletionItem { | 1104 | CompletionItem { |
1102 | label: "foo(…)", | 1105 | label: "foo(…)", |
1103 | source_range: 64..66, | 1106 | source_range: 31..33, |
1104 | delete: 64..66, | 1107 | delete: 31..33, |
1105 | insert: "foo(${1:xs})$0", | 1108 | insert: "foo(${1:xs})$0", |
1106 | kind: Function, | 1109 | kind: Function, |
1107 | lookup: "foo", | 1110 | lookup: "foo", |
@@ -1122,15 +1125,15 @@ mod tests { | |||
1122 | [ | 1125 | [ |
1123 | CompletionItem { | 1126 | CompletionItem { |
1124 | label: "Vec", | 1127 | label: "Vec", |
1125 | source_range: 68..70, | 1128 | source_range: 35..37, |
1126 | delete: 68..70, | 1129 | delete: 35..37, |
1127 | insert: "Vec", | 1130 | insert: "Vec", |
1128 | kind: Struct, | 1131 | kind: Struct, |
1129 | }, | 1132 | }, |
1130 | CompletionItem { | 1133 | CompletionItem { |
1131 | label: "foo(…)", | 1134 | label: "foo(…)", |
1132 | source_range: 68..70, | 1135 | source_range: 35..37, |
1133 | delete: 68..70, | 1136 | delete: 35..37, |
1134 | insert: "foo(${1:xs})$0", | 1137 | insert: "foo(${1:xs})$0", |
1135 | kind: Function, | 1138 | kind: Function, |
1136 | lookup: "foo", | 1139 | lookup: "foo", |
@@ -1151,15 +1154,15 @@ mod tests { | |||
1151 | [ | 1154 | [ |
1152 | CompletionItem { | 1155 | CompletionItem { |
1153 | label: "Vec", | 1156 | label: "Vec", |
1154 | source_range: 61..63, | 1157 | source_range: 28..30, |
1155 | delete: 61..63, | 1158 | delete: 28..30, |
1156 | insert: "Vec", | 1159 | insert: "Vec", |
1157 | kind: Struct, | 1160 | kind: Struct, |
1158 | }, | 1161 | }, |
1159 | CompletionItem { | 1162 | CompletionItem { |
1160 | label: "foo(…)", | 1163 | label: "foo(…)", |
1161 | source_range: 61..63, | 1164 | source_range: 28..30, |
1162 | delete: 61..63, | 1165 | delete: 28..30, |
1163 | insert: "foo(${1:xs})$0", | 1166 | insert: "foo(${1:xs})$0", |
1164 | kind: Function, | 1167 | kind: Function, |
1165 | lookup: "foo", | 1168 | lookup: "foo", |
@@ -1254,24 +1257,24 @@ mod tests { | |||
1254 | [ | 1257 | [ |
1255 | CompletionItem { | 1258 | CompletionItem { |
1256 | label: "another_field", | 1259 | label: "another_field", |
1257 | source_range: 201..201, | 1260 | source_range: 136..136, |
1258 | delete: 201..201, | 1261 | delete: 136..136, |
1259 | insert: "another_field", | 1262 | insert: "another_field", |
1260 | kind: Field, | 1263 | kind: Field, |
1261 | detail: "i64", | 1264 | detail: "i64", |
1262 | }, | 1265 | }, |
1263 | CompletionItem { | 1266 | CompletionItem { |
1264 | label: "my_string", | 1267 | label: "my_string", |
1265 | source_range: 201..201, | 1268 | source_range: 136..136, |
1266 | delete: 201..201, | 1269 | delete: 136..136, |
1267 | insert: "my_string", | 1270 | insert: "my_string", |
1268 | kind: Field, | 1271 | kind: Field, |
1269 | detail: "{unknown}", | 1272 | detail: "{unknown}", |
1270 | }, | 1273 | }, |
1271 | CompletionItem { | 1274 | CompletionItem { |
1272 | label: "the_field", | 1275 | label: "the_field", |
1273 | source_range: 201..201, | 1276 | source_range: 136..136, |
1274 | delete: 201..201, | 1277 | delete: 136..136, |
1275 | insert: "the_field", | 1278 | insert: "the_field", |
1276 | kind: Field, | 1279 | kind: Field, |
1277 | detail: "u32", | 1280 | detail: "u32", |
@@ -1298,16 +1301,16 @@ mod tests { | |||
1298 | [ | 1301 | [ |
1299 | CompletionItem { | 1302 | CompletionItem { |
1300 | label: "another_field", | 1303 | label: "another_field", |
1301 | source_range: 208..208, | 1304 | source_range: 143..143, |
1302 | delete: 208..208, | 1305 | delete: 143..143, |
1303 | insert: "another_field", | 1306 | insert: "another_field", |
1304 | kind: Field, | 1307 | kind: Field, |
1305 | detail: "i64", | 1308 | detail: "i64", |
1306 | }, | 1309 | }, |
1307 | CompletionItem { | 1310 | CompletionItem { |
1308 | label: "another_good_type", | 1311 | label: "another_good_type", |
1309 | source_range: 208..208, | 1312 | source_range: 143..143, |
1310 | delete: 208..208, | 1313 | delete: 143..143, |
1311 | insert: "another_good_type", | 1314 | insert: "another_good_type", |
1312 | kind: Field, | 1315 | kind: Field, |
1313 | detail: "u32", | 1316 | detail: "u32", |
@@ -1315,8 +1318,8 @@ mod tests { | |||
1315 | }, | 1318 | }, |
1316 | CompletionItem { | 1319 | CompletionItem { |
1317 | label: "the_field", | 1320 | label: "the_field", |
1318 | source_range: 208..208, | 1321 | source_range: 143..143, |
1319 | delete: 208..208, | 1322 | delete: 143..143, |
1320 | insert: "the_field", | 1323 | insert: "the_field", |
1321 | kind: Field, | 1324 | kind: Field, |
1322 | detail: "u32", | 1325 | detail: "u32", |
@@ -1346,16 +1349,16 @@ mod tests { | |||
1346 | [ | 1349 | [ |
1347 | CompletionItem { | 1350 | CompletionItem { |
1348 | label: "another_field", | 1351 | label: "another_field", |
1349 | source_range: 270..270, | 1352 | source_range: 189..189, |
1350 | delete: 270..270, | 1353 | delete: 189..189, |
1351 | insert: "another_field", | 1354 | insert: "another_field", |
1352 | kind: Field, | 1355 | kind: Field, |
1353 | detail: "i64", | 1356 | detail: "i64", |
1354 | }, | 1357 | }, |
1355 | CompletionItem { | 1358 | CompletionItem { |
1356 | label: "another_good_type", | 1359 | label: "another_good_type", |
1357 | source_range: 270..270, | 1360 | source_range: 189..189, |
1358 | delete: 270..270, | 1361 | delete: 189..189, |
1359 | insert: "another_good_type", | 1362 | insert: "another_good_type", |
1360 | kind: Field, | 1363 | kind: Field, |
1361 | detail: "u32", | 1364 | detail: "u32", |
@@ -1363,8 +1366,8 @@ mod tests { | |||
1363 | }, | 1366 | }, |
1364 | CompletionItem { | 1367 | CompletionItem { |
1365 | label: "the_field", | 1368 | label: "the_field", |
1366 | source_range: 270..270, | 1369 | source_range: 189..189, |
1367 | delete: 270..270, | 1370 | delete: 189..189, |
1368 | insert: "the_field", | 1371 | insert: "the_field", |
1369 | kind: Field, | 1372 | kind: Field, |
1370 | detail: "u32", | 1373 | detail: "u32", |
@@ -1394,8 +1397,8 @@ mod tests { | |||
1394 | [ | 1397 | [ |
1395 | CompletionItem { | 1398 | CompletionItem { |
1396 | label: "another_field", | 1399 | label: "another_field", |
1397 | source_range: 336..336, | 1400 | source_range: 239..239, |
1398 | delete: 336..336, | 1401 | delete: 239..239, |
1399 | insert: "another_field", | 1402 | insert: "another_field", |
1400 | kind: Field, | 1403 | kind: Field, |
1401 | detail: "i64", | 1404 | detail: "i64", |
@@ -1403,16 +1406,16 @@ mod tests { | |||
1403 | }, | 1406 | }, |
1404 | CompletionItem { | 1407 | CompletionItem { |
1405 | label: "another_good_type", | 1408 | label: "another_good_type", |
1406 | source_range: 336..336, | 1409 | source_range: 239..239, |
1407 | delete: 336..336, | 1410 | delete: 239..239, |
1408 | insert: "another_good_type", | 1411 | insert: "another_good_type", |
1409 | kind: Field, | 1412 | kind: Field, |
1410 | detail: "u32", | 1413 | detail: "u32", |
1411 | }, | 1414 | }, |
1412 | CompletionItem { | 1415 | CompletionItem { |
1413 | label: "the_field", | 1416 | label: "the_field", |
1414 | source_range: 336..336, | 1417 | source_range: 239..239, |
1415 | delete: 336..336, | 1418 | delete: 239..239, |
1416 | insert: "the_field", | 1419 | insert: "the_field", |
1417 | kind: Field, | 1420 | kind: Field, |
1418 | detail: "u32", | 1421 | detail: "u32", |
@@ -1441,16 +1444,16 @@ mod tests { | |||
1441 | [ | 1444 | [ |
1442 | CompletionItem { | 1445 | CompletionItem { |
1443 | label: "another_field", | 1446 | label: "another_field", |
1444 | source_range: 328..328, | 1447 | source_range: 231..231, |
1445 | delete: 328..328, | 1448 | delete: 231..231, |
1446 | insert: "another_field", | 1449 | insert: "another_field", |
1447 | kind: Field, | 1450 | kind: Field, |
1448 | detail: "i64", | 1451 | detail: "i64", |
1449 | }, | 1452 | }, |
1450 | CompletionItem { | 1453 | CompletionItem { |
1451 | label: "another_good_type", | 1454 | label: "another_good_type", |
1452 | source_range: 328..328, | 1455 | source_range: 231..231, |
1453 | delete: 328..328, | 1456 | delete: 231..231, |
1454 | insert: "another_good_type", | 1457 | insert: "another_good_type", |
1455 | kind: Field, | 1458 | kind: Field, |
1456 | detail: "u32", | 1459 | detail: "u32", |
@@ -1458,8 +1461,8 @@ mod tests { | |||
1458 | }, | 1461 | }, |
1459 | CompletionItem { | 1462 | CompletionItem { |
1460 | label: "the_field", | 1463 | label: "the_field", |
1461 | source_range: 328..328, | 1464 | source_range: 231..231, |
1462 | delete: 328..328, | 1465 | delete: 231..231, |
1463 | insert: "the_field", | 1466 | insert: "the_field", |
1464 | kind: Field, | 1467 | kind: Field, |
1465 | detail: "u32", | 1468 | detail: "u32", |
@@ -1485,15 +1488,15 @@ mod tests { | |||
1485 | [ | 1488 | [ |
1486 | CompletionItem { | 1489 | CompletionItem { |
1487 | label: "WorldSnapshot", | 1490 | label: "WorldSnapshot", |
1488 | source_range: 132..133, | 1491 | source_range: 71..72, |
1489 | delete: 132..133, | 1492 | delete: 71..72, |
1490 | insert: "WorldSnapshot", | 1493 | insert: "WorldSnapshot", |
1491 | kind: Struct, | 1494 | kind: Struct, |
1492 | }, | 1495 | }, |
1493 | CompletionItem { | 1496 | CompletionItem { |
1494 | label: "go(…)", | 1497 | label: "go(…)", |
1495 | source_range: 132..133, | 1498 | source_range: 71..72, |
1496 | delete: 132..133, | 1499 | delete: 71..72, |
1497 | insert: "go(${1:world})$0", | 1500 | insert: "go(${1:world})$0", |
1498 | kind: Function, | 1501 | kind: Function, |
1499 | lookup: "go", | 1502 | lookup: "go", |
@@ -1502,8 +1505,8 @@ mod tests { | |||
1502 | }, | 1505 | }, |
1503 | CompletionItem { | 1506 | CompletionItem { |
1504 | label: "world", | 1507 | label: "world", |
1505 | source_range: 132..133, | 1508 | source_range: 71..72, |
1506 | delete: 132..133, | 1509 | delete: 71..72, |
1507 | insert: "world", | 1510 | insert: "world", |
1508 | kind: Binding, | 1511 | kind: Binding, |
1509 | detail: "&WorldSnapshot", | 1512 | detail: "&WorldSnapshot", |
diff --git a/crates/ra_ide/src/completion/test_utils.rs b/crates/ra_ide/src/completion/test_utils.rs index 1e16a43ca..a1b7c1193 100644 --- a/crates/ra_ide/src/completion/test_utils.rs +++ b/crates/ra_ide/src/completion/test_utils.rs | |||
@@ -2,7 +2,7 @@ | |||
2 | 2 | ||
3 | use crate::{ | 3 | use crate::{ |
4 | completion::{completion_item::CompletionKind, CompletionConfig}, | 4 | completion::{completion_item::CompletionKind, CompletionConfig}, |
5 | mock_analysis::{analysis_and_position, single_file_with_position}, | 5 | mock_analysis::analysis_and_position, |
6 | CompletionItem, | 6 | CompletionItem, |
7 | }; | 7 | }; |
8 | use hir::Semantics; | 8 | use hir::Semantics; |
@@ -33,7 +33,7 @@ fn get_all_completion_items(code: &str, options: &CompletionConfig) -> Vec<Compl | |||
33 | let (analysis, position) = if code.contains("//-") { | 33 | let (analysis, position) = if code.contains("//-") { |
34 | analysis_and_position(code) | 34 | analysis_and_position(code) |
35 | } else { | 35 | } else { |
36 | single_file_with_position(code) | 36 | analysis_and_position(code) |
37 | }; | 37 | }; |
38 | analysis.completions(options, position).unwrap().unwrap().into() | 38 | analysis.completions(options, position).unwrap().unwrap().into() |
39 | } | 39 | } |
@@ -55,7 +55,7 @@ pub(crate) fn completion_list_with_options( | |||
55 | } | 55 | } |
56 | 56 | ||
57 | pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) -> bool) { | 57 | pub(crate) fn check_pattern_is_applicable(code: &str, check: fn(SyntaxElement) -> bool) { |
58 | let (analysis, pos) = single_file_with_position(code); | 58 | let (analysis, pos) = analysis_and_position(code); |
59 | analysis | 59 | analysis |
60 | .with_db(|db| { | 60 | .with_db(|db| { |
61 | let sema = Semantics::new(db); | 61 | let sema = Semantics::new(db); |