mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-29 21:35:20 +00:00
move consts&statics to new id
This commit is contained in:
parent
f588535273
commit
1db2cbcb8b
8 changed files with 86 additions and 47 deletions
|
@ -43,6 +43,8 @@ pub(super) fn complete_path(acc: &mut Completions, ctx: &CompletionContext) {
|
|||
hir::ModuleDef::Function(_)
|
||||
| hir::ModuleDef::Struct(_)
|
||||
| hir::ModuleDef::Def(_)
|
||||
| hir::ModuleDef::Const(_)
|
||||
| hir::ModuleDef::Static(_)
|
||||
| hir::ModuleDef::EnumVariant(_) => return,
|
||||
};
|
||||
}
|
||||
|
|
|
@ -223,11 +223,11 @@ impl Builder {
|
|||
hir::ModuleDef::Struct(it) => (CompletionItemKind::Struct, it.docs(ctx.db)),
|
||||
hir::ModuleDef::Enum(it) => (CompletionItemKind::Enum, it.docs(ctx.db)),
|
||||
hir::ModuleDef::EnumVariant(it) => (CompletionItemKind::EnumVariant, it.docs(ctx.db)),
|
||||
hir::ModuleDef::Const(it) => (CompletionItemKind::Const, it.docs(ctx.db)),
|
||||
hir::ModuleDef::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)),
|
||||
hir::ModuleDef::Def(def_id) => match def_id.resolve(ctx.db) {
|
||||
hir::Def::Trait(it) => (CompletionItemKind::Trait, it.docs(ctx.db)),
|
||||
hir::Def::Type(it) => (CompletionItemKind::TypeAlias, it.docs(ctx.db)),
|
||||
hir::Def::Const(it) => (CompletionItemKind::Const, it.docs(ctx.db)),
|
||||
hir::Def::Static(it) => (CompletionItemKind::Static, it.docs(ctx.db)),
|
||||
_ => return self,
|
||||
},
|
||||
};
|
||||
|
|
|
@ -121,6 +121,20 @@ impl NavigationTarget {
|
|||
&*node,
|
||||
));
|
||||
}
|
||||
hir::ModuleDef::Const(s) => {
|
||||
let (file_id, node) = s.source(db);
|
||||
return Some(NavigationTarget::from_named(
|
||||
file_id.original_file(db),
|
||||
&*node,
|
||||
));
|
||||
}
|
||||
hir::ModuleDef::Static(s) => {
|
||||
let (file_id, node) = s.source(db);
|
||||
return Some(NavigationTarget::from_named(
|
||||
file_id.original_file(db),
|
||||
&*node,
|
||||
));
|
||||
}
|
||||
hir::ModuleDef::Enum(e) => {
|
||||
let (file_id, node) = e.source(db);
|
||||
return Some(NavigationTarget::from_named(
|
||||
|
@ -146,14 +160,6 @@ impl NavigationTarget {
|
|||
let (file_id, node) = f.source(db);
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Static(f) => {
|
||||
let (file_id, node) = f.source(db);
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Const(f) => {
|
||||
let (file_id, node) = f.source(db);
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Item => return None,
|
||||
};
|
||||
Some(res)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue