mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-11-02 12:59:12 +00:00
Make completion work too
This commit is contained in:
parent
7e45915aa4
commit
2156815f12
2 changed files with 11 additions and 4 deletions
|
|
@ -168,8 +168,9 @@ pub(crate) fn complete_type_path(acc: &mut Completions, ctx: &CompletionContext)
|
|||
if let Some(hir::PathResolution::Def(hir::ModuleDef::Trait(trait_))) =
|
||||
ctx.sema.resolve_path(&path_seg.parent_path())
|
||||
{
|
||||
trait_.items(ctx.sema.db).into_iter().for_each(|it| {
|
||||
trait_.items_with_supertraits(ctx.sema.db).into_iter().for_each(|it| {
|
||||
if let hir::AssocItem::TypeAlias(alias) = it {
|
||||
cov_mark::hit!(complete_assoc_type_in_generics_list);
|
||||
acc.add_type_alias_with_eq(ctx, alias)
|
||||
}
|
||||
});
|
||||
|
|
|
|||
|
|
@ -336,9 +336,13 @@ fn foo<'lt, T, const C: usize>() {
|
|||
|
||||
#[test]
|
||||
fn completes_types_and_const_in_arg_list() {
|
||||
cov_mark::check!(complete_assoc_type_in_generics_list);
|
||||
check(
|
||||
r#"
|
||||
trait Trait2 {
|
||||
trait Trait1 {
|
||||
type Super;
|
||||
}
|
||||
trait Trait2: Trait1 {
|
||||
type Foo;
|
||||
}
|
||||
|
||||
|
|
@ -354,8 +358,10 @@ fn foo<'lt, T: Trait2<$0>, const CONST_PARAM: usize>(_: T) {}
|
|||
st Tuple
|
||||
st Unit
|
||||
tt Trait
|
||||
tt Trait1
|
||||
tt Trait2
|
||||
ta Foo = (as Trait2) type Foo
|
||||
ta Super = (as Trait1) type Super
|
||||
tp T
|
||||
un Union
|
||||
bt u32
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue