aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
Diffstat (limited to 'crates')
-rw-r--r--crates/completion/src/completions/unqualified_path.rs36
-rw-r--r--crates/completion/src/item.rs2
-rw-r--r--crates/completion/src/render.rs64
3 files changed, 66 insertions, 36 deletions
diff --git a/crates/completion/src/completions/unqualified_path.rs b/crates/completion/src/completions/unqualified_path.rs
index 860c774c1..a289efc34 100644
--- a/crates/completion/src/completions/unqualified_path.rs
+++ b/crates/completion/src/completions/unqualified_path.rs
@@ -165,8 +165,8 @@ fn quux(x: i32) {
165} 165}
166"#, 166"#,
167 expect![[r#" 167 expect![[r#"
168 bn y i32 168 lc y i32
169 bn x i32 169 lc x i32
170 fn quux(…) fn quux(x: i32) 170 fn quux(…) fn quux(x: i32)
171 "#]], 171 "#]],
172 ); 172 );
@@ -187,8 +187,8 @@ fn quux() {
187} 187}
188"#, 188"#,
189 expect![[r#" 189 expect![[r#"
190 bn b i32 190 lc b i32
191 bn a 191 lc a
192 fn quux() fn quux() 192 fn quux() fn quux()
193 "#]], 193 "#]],
194 ); 194 );
@@ -203,7 +203,7 @@ fn quux() {
203} 203}
204"#, 204"#,
205 expect![[r#" 205 expect![[r#"
206 bn x 206 lc x
207 fn quux() fn quux() 207 fn quux() fn quux()
208 "#]], 208 "#]],
209 ); 209 );
@@ -263,7 +263,7 @@ fn main() {
263 check( 263 check(
264 r#"struct S<T> { x: $0}"#, 264 r#"struct S<T> { x: $0}"#,
265 expect![[r#" 265 expect![[r#"
266 tp Self 266 sp Self
267 tp T 267 tp T
268 st S<…> 268 st S<…>
269 "#]], 269 "#]],
@@ -275,7 +275,7 @@ fn main() {
275 check( 275 check(
276 r#"enum X { Y($0) }"#, 276 r#"enum X { Y($0) }"#,
277 expect![[r#" 277 expect![[r#"
278 tp Self 278 sp Self
279 en X 279 en X
280 "#]], 280 "#]],
281 ); 281 );
@@ -378,8 +378,8 @@ fn foo() {
378"#, 378"#,
379 // FIXME: should be only one bar here 379 // FIXME: should be only one bar here
380 expect![[r#" 380 expect![[r#"
381 bn bar i32 381 lc bar i32
382 bn bar i32 382 lc bar i32
383 fn foo() fn foo() 383 fn foo() fn foo()
384 "#]], 384 "#]],
385 ); 385 );
@@ -390,8 +390,8 @@ fn foo() {
390 check( 390 check(
391 r#"impl S { fn foo(&self) { $0 } }"#, 391 r#"impl S { fn foo(&self) { $0 } }"#,
392 expect![[r#" 392 expect![[r#"
393 bn self &{unknown} 393 lc self &{unknown}
394 tp Self 394 sp Self
395 "#]], 395 "#]],
396 ); 396 );
397 } 397 }
@@ -575,8 +575,8 @@ fn quux(x: i32) {
575} 575}
576"#, 576"#,
577 expect![[r#" 577 expect![[r#"
578 bn y i32 578 lc y i32
579 bn x i32 579 lc x i32
580 fn quux(…) fn quux(x: i32) 580 fn quux(…) fn quux(x: i32)
581 ma m!(…) macro_rules! m 581 ma m!(…) macro_rules! m
582 "#]], 582 "#]],
@@ -594,8 +594,8 @@ fn quux(x: i32) {
594} 594}
595", 595",
596 expect![[r#" 596 expect![[r#"
597 bn y i32 597 lc y i32
598 bn x i32 598 lc x i32
599 fn quux(…) fn quux(x: i32) 599 fn quux(…) fn quux(x: i32)
600 ma m!(…) macro_rules! m 600 ma m!(…) macro_rules! m
601 "#]], 601 "#]],
@@ -613,8 +613,8 @@ fn quux(x: i32) {
613} 613}
614"#, 614"#,
615 expect![[r#" 615 expect![[r#"
616 bn y i32 616 lc y i32
617 bn x i32 617 lc x i32
618 fn quux(…) fn quux(x: i32) 618 fn quux(…) fn quux(x: i32)
619 ma m!(…) macro_rules! m 619 ma m!(…) macro_rules! m
620 "#]], 620 "#]],
@@ -750,7 +750,7 @@ struct MyStruct {}
750impl My$0 750impl My$0
751"#, 751"#,
752 expect![[r#" 752 expect![[r#"
753 tp Self 753 sp Self
754 tt MyTrait 754 tt MyTrait
755 st MyStruct 755 st MyStruct
756 "#]], 756 "#]],
diff --git a/crates/completion/src/item.rs b/crates/completion/src/item.rs
index 178e05c46..d2e6a6aeb 100644
--- a/crates/completion/src/item.rs
+++ b/crates/completion/src/item.rs
@@ -121,9 +121,9 @@ pub enum CompletionScore {
121#[derive(Debug, Clone, Copy, PartialEq, Eq)] 121#[derive(Debug, Clone, Copy, PartialEq, Eq)]
122pub enum CompletionItemKind { 122pub enum CompletionItemKind {
123 SymbolKind(SymbolKind), 123 SymbolKind(SymbolKind),
124 BuiltinType,
125 Attribute, 124 Attribute,
126 Binding, 125 Binding,
126 BuiltinType,
127 Keyword, 127 Keyword,
128 Method, 128 Method,
129 Snippet, 129 Snippet,
diff --git a/crates/completion/src/render.rs b/crates/completion/src/render.rs
index 8f66f6e59..fa594b5e5 100644
--- a/crates/completion/src/render.rs
+++ b/crates/completion/src/render.rs
@@ -409,7 +409,9 @@ fn main() { Foo::Fo$0 }
409 source_range: 54..56, 409 source_range: 54..56,
410 delete: 54..56, 410 delete: 54..56,
411 insert: "Foo", 411 insert: "Foo",
412 kind: EnumVariant, 412 kind: SymbolKind(
413 Variant,
414 ),
413 detail: "{ x: i32, y: i32 }", 415 detail: "{ x: i32, y: i32 }",
414 }, 416 },
415 ] 417 ]
@@ -432,7 +434,9 @@ fn main() { Foo::Fo$0 }
432 source_range: 46..48, 434 source_range: 46..48,
433 delete: 46..48, 435 delete: 46..48,
434 insert: "Foo($0)", 436 insert: "Foo($0)",
435 kind: EnumVariant, 437 kind: SymbolKind(
438 Variant,
439 ),
436 lookup: "Foo", 440 lookup: "Foo",
437 detail: "(i32, i32)", 441 detail: "(i32, i32)",
438 trigger_call_info: true, 442 trigger_call_info: true,
@@ -457,7 +461,9 @@ fn main() { Foo::Fo$0 }
457 source_range: 35..37, 461 source_range: 35..37,
458 delete: 35..37, 462 delete: 35..37,
459 insert: "Foo", 463 insert: "Foo",
460 kind: EnumVariant, 464 kind: SymbolKind(
465 Variant,
466 ),
461 detail: "()", 467 detail: "()",
462 }, 468 },
463 ] 469 ]
@@ -481,7 +487,9 @@ fn main() { let _: m::Spam = S$0 }
481 source_range: 75..76, 487 source_range: 75..76,
482 delete: 75..76, 488 delete: 75..76,
483 insert: "Spam::Bar($0)", 489 insert: "Spam::Bar($0)",
484 kind: EnumVariant, 490 kind: SymbolKind(
491 Variant,
492 ),
485 lookup: "Spam::Bar", 493 lookup: "Spam::Bar",
486 detail: "(i32)", 494 detail: "(i32)",
487 trigger_call_info: true, 495 trigger_call_info: true,
@@ -491,14 +499,18 @@ fn main() { let _: m::Spam = S$0 }
491 source_range: 75..76, 499 source_range: 75..76,
492 delete: 75..76, 500 delete: 75..76,
493 insert: "m", 501 insert: "m",
494 kind: Module, 502 kind: SymbolKind(
503 Module,
504 ),
495 }, 505 },
496 CompletionItem { 506 CompletionItem {
497 label: "m::Spam::Foo", 507 label: "m::Spam::Foo",
498 source_range: 75..76, 508 source_range: 75..76,
499 delete: 75..76, 509 delete: 75..76,
500 insert: "m::Spam::Foo", 510 insert: "m::Spam::Foo",
501 kind: EnumVariant, 511 kind: SymbolKind(
512 Variant,
513 ),
502 lookup: "Spam::Foo", 514 lookup: "Spam::Foo",
503 detail: "()", 515 detail: "()",
504 }, 516 },
@@ -507,7 +519,9 @@ fn main() { let _: m::Spam = S$0 }
507 source_range: 75..76, 519 source_range: 75..76,
508 delete: 75..76, 520 delete: 75..76,
509 insert: "main()$0", 521 insert: "main()$0",
510 kind: Function, 522 kind: SymbolKind(
523 Function,
524 ),
511 lookup: "main", 525 lookup: "main",
512 detail: "fn main()", 526 detail: "fn main()",
513 }, 527 },
@@ -534,7 +548,9 @@ fn main() { som$0 }
534 source_range: 127..130, 548 source_range: 127..130,
535 delete: 127..130, 549 delete: 127..130,
536 insert: "main()$0", 550 insert: "main()$0",
537 kind: Function, 551 kind: SymbolKind(
552 Function,
553 ),
538 lookup: "main", 554 lookup: "main",
539 detail: "fn main()", 555 detail: "fn main()",
540 }, 556 },
@@ -543,7 +559,9 @@ fn main() { som$0 }
543 source_range: 127..130, 559 source_range: 127..130,
544 delete: 127..130, 560 delete: 127..130,
545 insert: "something_deprecated()$0", 561 insert: "something_deprecated()$0",
546 kind: Function, 562 kind: SymbolKind(
563 Function,
564 ),
547 lookup: "something_deprecated", 565 lookup: "something_deprecated",
548 detail: "fn something_deprecated()", 566 detail: "fn something_deprecated()",
549 deprecated: true, 567 deprecated: true,
@@ -553,7 +571,9 @@ fn main() { som$0 }
553 source_range: 127..130, 571 source_range: 127..130,
554 delete: 127..130, 572 delete: 127..130,
555 insert: "something_else_deprecated()$0", 573 insert: "something_else_deprecated()$0",
556 kind: Function, 574 kind: SymbolKind(
575 Function,
576 ),
557 lookup: "something_else_deprecated", 577 lookup: "something_else_deprecated",
558 detail: "fn something_else_deprecated()", 578 detail: "fn something_else_deprecated()",
559 deprecated: true, 579 deprecated: true,
@@ -574,7 +594,9 @@ fn foo() { A { the$0 } }
574 source_range: 57..60, 594 source_range: 57..60,
575 delete: 57..60, 595 delete: 57..60,
576 insert: "the_field", 596 insert: "the_field",
577 kind: Field, 597 kind: SymbolKind(
598 Field,
599 ),
578 detail: "u32", 600 detail: "u32",
579 deprecated: true, 601 deprecated: true,
580 }, 602 },
@@ -614,7 +636,9 @@ impl S {
614 source_range: 94..94, 636 source_range: 94..94,
615 delete: 94..94, 637 delete: 94..94,
616 insert: "foo", 638 insert: "foo",
617 kind: Field, 639 kind: SymbolKind(
640 Field,
641 ),
618 detail: "{unknown}", 642 detail: "{unknown}",
619 documentation: Documentation( 643 documentation: Documentation(
620 "Field docs", 644 "Field docs",
@@ -645,7 +669,9 @@ use self::E::*;
645 source_range: 10..12, 669 source_range: 10..12,
646 delete: 10..12, 670 delete: 10..12,
647 insert: "E", 671 insert: "E",
648 kind: Enum, 672 kind: SymbolKind(
673 Enum,
674 ),
649 documentation: Documentation( 675 documentation: Documentation(
650 "enum docs", 676 "enum docs",
651 ), 677 ),
@@ -655,7 +681,9 @@ use self::E::*;
655 source_range: 10..12, 681 source_range: 10..12,
656 delete: 10..12, 682 delete: 10..12,
657 insert: "V", 683 insert: "V",
658 kind: EnumVariant, 684 kind: SymbolKind(
685 Variant,
686 ),
659 detail: "()", 687 detail: "()",
660 documentation: Documentation( 688 documentation: Documentation(
661 "variant docs", 689 "variant docs",
@@ -666,7 +694,9 @@ use self::E::*;
666 source_range: 10..12, 694 source_range: 10..12,
667 delete: 10..12, 695 delete: 10..12,
668 insert: "my", 696 insert: "my",
669 kind: Module, 697 kind: SymbolKind(
698 Module,
699 ),
670 documentation: Documentation( 700 documentation: Documentation(
671 "mod docs", 701 "mod docs",
672 ), 702 ),
@@ -892,7 +922,7 @@ struct WorldSnapshot { _f: () };
892fn go(world: &WorldSnapshot) { go(w$0) } 922fn go(world: &WorldSnapshot) { go(w$0) }
893"#, 923"#,
894 expect![[r#" 924 expect![[r#"
895 bn world [type+name] 925 lc world [type+name]
896 st WorldSnapshot [] 926 st WorldSnapshot []
897 fn go(…) [] 927 fn go(…) []
898 "#]], 928 "#]],
@@ -909,7 +939,7 @@ fn f(foo: &Foo) { f(foo, w$0) }
909 expect![[r#" 939 expect![[r#"
910 st Foo [] 940 st Foo []
911 fn f(…) [] 941 fn f(…) []
912 bn foo [] 942 lc foo []
913 "#]], 943 "#]],
914 ); 944 );
915 } 945 }