mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Initial support for lang items.
This commit is contained in:
parent
d55f1136d6
commit
e85ee60c42
11 changed files with 204 additions and 41 deletions
|
@ -38,18 +38,21 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
}
|
||||
hir::ModuleDef::Struct(s) => {
|
||||
let ty = s.ty(ctx.db);
|
||||
ty.iterate_impl_items(ctx.db, |item| {
|
||||
match item {
|
||||
hir::ImplItem::Method(func) => {
|
||||
let sig = func.signature(ctx.db);
|
||||
if !sig.has_self_param() {
|
||||
acc.add_function(ctx, func);
|
||||
let krate = ctx.module.and_then(|m| m.krate(ctx.db));
|
||||
krate.map_or((), |krate| {
|
||||
ty.iterate_impl_items(ctx.db, krate, |item| {
|
||||
match item {
|
||||
hir::ImplItem::Method(func) => {
|
||||
let sig = func.signature(ctx.db);
|
||||
if !sig.has_self_param() {
|
||||
acc.add_function(ctx, func);
|
||||
}
|
||||
}
|
||||
hir::ImplItem::Const(ct) => acc.add_const(ctx, ct),
|
||||
hir::ImplItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
|
||||
}
|
||||
hir::ImplItem::Const(ct) => acc.add_const(ctx, ct),
|
||||
hir::ImplItem::TypeAlias(ty) => acc.add_type_alias(ctx, ty),
|
||||
}
|
||||
None::<()>
|
||||
None::<()>
|
||||
});
|
||||
});
|
||||
}
|
||||
_ => return,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue