File tree Expand file tree Collapse file tree 2 files changed +47
-0
lines changed
crates/ide-completion/src Expand file tree Collapse file tree 2 files changed +47
-0
lines changed Original file line number Diff line number Diff line change @@ -884,6 +884,16 @@ fn classify_name_ref(
884
884
} ;
885
885
let make_path_kind_type = |ty : ast:: Type | {
886
886
let location = type_location ( ty. syntax ( ) ) ;
887
+ if let Some ( p) = ty. syntax ( ) . parent ( ) {
888
+ if ast:: GenericArg :: can_cast ( p. kind ( ) ) || ast:: GenericArgList :: can_cast ( p. kind ( ) ) {
889
+ if let Some ( p) = p. parent ( ) . and_then ( |p| p. parent ( ) ) {
890
+ if let Some ( segment) = ast:: PathSegment :: cast ( p) {
891
+ let path = segment. parent_path ( ) . top_path ( ) ;
892
+ dbg ! ( sema. resolve_path( & path) ) ;
893
+ }
894
+ }
895
+ }
896
+ }
887
897
PathKind :: Type { location : location. unwrap_or ( TypeLocation :: Other ) }
888
898
} ;
889
899
Original file line number Diff line number Diff line change @@ -719,3 +719,40 @@ pub struct S;
719
719
"# ] ] ,
720
720
)
721
721
}
722
+
723
+ #[ test]
724
+ fn completes_const_and_type_generics_separately ( ) {
725
+ check (
726
+ r#"
727
+ struct Foo;
728
+ const X: usize = 0;
729
+ mod foo {
730
+ fn foo<T>() {}
731
+ }
732
+ fn main() {
733
+ self::foo::foo::<F$0>();
734
+ }
735
+ "# ,
736
+ expect ! [ [ r#"
737
+ st Foo
738
+ bt u32
739
+ kw crate::
740
+ kw self::
741
+ "# ] ] ,
742
+ ) ;
743
+ check (
744
+ r#"
745
+ struct Foo;
746
+ const X: usize = 0;
747
+ fn foo<const X: usize>() {}
748
+ fn main() {
749
+ foo::<F$0>();
750
+ }
751
+ "# ,
752
+ expect ! [ [ r#"
753
+ ct X
754
+ kw crate::
755
+ kw self::
756
+ "# ] ] ,
757
+ ) ;
758
+ }
You can’t perform that action at this time.
0 commit comments