mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 13:51:31 +00:00
actually produce missing def kinds
This commit is contained in:
parent
19136cde00
commit
f193fbcbae
7 changed files with 122 additions and 8 deletions
|
@ -33,6 +33,10 @@ pub enum CompletionItemKind {
|
|||
EnumVariant,
|
||||
Binding,
|
||||
Field,
|
||||
Static,
|
||||
Const,
|
||||
Trait,
|
||||
TypeAlias,
|
||||
}
|
||||
|
||||
#[derive(Debug, PartialEq, Eq)]
|
||||
|
@ -153,6 +157,22 @@ impl Builder {
|
|||
types: Some(hir::Def::Enum(..)),
|
||||
..
|
||||
} => CompletionItemKind::Enum,
|
||||
PerNs {
|
||||
types: Some(hir::Def::Trait(..)),
|
||||
..
|
||||
} => CompletionItemKind::Trait,
|
||||
PerNs {
|
||||
types: Some(hir::Def::Type(..)),
|
||||
..
|
||||
} => CompletionItemKind::TypeAlias,
|
||||
PerNs {
|
||||
values: Some(hir::Def::Const(..)),
|
||||
..
|
||||
} => CompletionItemKind::Const,
|
||||
PerNs {
|
||||
values: Some(hir::Def::Static(..)),
|
||||
..
|
||||
} => CompletionItemKind::Static,
|
||||
PerNs {
|
||||
values: Some(hir::Def::Function(function)),
|
||||
..
|
||||
|
|
|
@ -108,6 +108,22 @@ impl NavigationTarget {
|
|||
let (file_id, node) = f.source(db)?;
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Trait(f) => {
|
||||
let (file_id, node) = f.source(db)?;
|
||||
NavigationTarget::from_named(file_id.original_file(db), &*node)
|
||||
}
|
||||
Def::Type(f) => {
|
||||
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::Module(m) => NavigationTarget::from_module(db, m)?,
|
||||
Def::Item => return Ok(None),
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue