From f193fbcbae0783953cfaa88aaec6a8d4e1255007 Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 11 Jan 2019 21:02:12 +0300 Subject: actually produce missing def kinds --- crates/ra_ide_api/src/completion/completion_item.rs | 20 ++++++++++++++++++++ crates/ra_ide_api/src/navigation_target.rs | 16 ++++++++++++++++ 2 files changed, 36 insertions(+) (limited to 'crates/ra_ide_api/src') diff --git a/crates/ra_ide_api/src/completion/completion_item.rs b/crates/ra_ide_api/src/completion/completion_item.rs index 6a9770429..e7fa967a0 100644 --- a/crates/ra_ide_api/src/completion/completion_item.rs +++ b/crates/ra_ide_api/src/completion/completion_item.rs @@ -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)), .. diff --git a/crates/ra_ide_api/src/navigation_target.rs b/crates/ra_ide_api/src/navigation_target.rs index b955bbe42..b0d0a3e8b 100644 --- a/crates/ra_ide_api/src/navigation_target.rs +++ b/crates/ra_ide_api/src/navigation_target.rs @@ -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), }; -- cgit v1.2.3