diff options
-rw-r--r-- | crates/ra_hir/src/code_model.rs | 1 | ||||
-rw-r--r-- | crates/ra_hir/src/code_model/docs.rs (renamed from crates/ra_hir/src/docs.rs) | 0 | ||||
-rw-r--r-- | crates/ra_hir/src/db.rs | 4 | ||||
-rw-r--r-- | crates/ra_hir/src/lib.rs | 3 | ||||
-rw-r--r-- | crates/ra_ide_api/src/display/navigation_target.rs | 8 | ||||
-rw-r--r-- | crates/ra_ide_api/src/goto_definition.rs | 8 |
6 files changed, 10 insertions, 14 deletions
diff --git a/crates/ra_hir/src/code_model.rs b/crates/ra_hir/src/code_model.rs index 0cfab27dc..830aea1f3 100644 --- a/crates/ra_hir/src/code_model.rs +++ b/crates/ra_hir/src/code_model.rs | |||
@@ -1,4 +1,5 @@ | |||
1 | pub(crate) mod src; | 1 | pub(crate) mod src; |
2 | pub(crate) mod docs; | ||
2 | 3 | ||
3 | use std::sync::Arc; | 4 | use std::sync::Arc; |
4 | 5 | ||
diff --git a/crates/ra_hir/src/docs.rs b/crates/ra_hir/src/code_model/docs.rs index da2b9b854..da2b9b854 100644 --- a/crates/ra_hir/src/docs.rs +++ b/crates/ra_hir/src/code_model/docs.rs | |||
diff --git a/crates/ra_hir/src/db.rs b/crates/ra_hir/src/db.rs index d2a372f3b..d2d6f95b7 100644 --- a/crates/ra_hir/src/db.rs +++ b/crates/ra_hir/src/db.rs | |||
@@ -128,8 +128,8 @@ pub trait DefDatabase: SourceDatabase { | |||
128 | #[salsa::invoke(crate::lang_item::LangItems::lang_item_query)] | 128 | #[salsa::invoke(crate::lang_item::LangItems::lang_item_query)] |
129 | fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option<LangItemTarget>; | 129 | fn lang_item(&self, start_crate: Crate, item: SmolStr) -> Option<LangItemTarget>; |
130 | 130 | ||
131 | #[salsa::invoke(crate::docs::documentation_query)] | 131 | #[salsa::invoke(crate::code_model::docs::documentation_query)] |
132 | fn documentation(&self, def: crate::docs::DocDef) -> Option<crate::docs::Documentation>; | 132 | fn documentation(&self, def: crate::DocDef) -> Option<crate::Documentation>; |
133 | } | 133 | } |
134 | 134 | ||
135 | #[salsa::query_group(HirDatabaseStorage)] | 135 | #[salsa::query_group(HirDatabaseStorage)] |
diff --git a/crates/ra_hir/src/lib.rs b/crates/ra_hir/src/lib.rs index 1690296e5..2e99bdac8 100644 --- a/crates/ra_hir/src/lib.rs +++ b/crates/ra_hir/src/lib.rs | |||
@@ -38,7 +38,6 @@ mod impl_block; | |||
38 | mod expr; | 38 | mod expr; |
39 | mod lang_item; | 39 | mod lang_item; |
40 | mod generics; | 40 | mod generics; |
41 | mod docs; | ||
42 | mod resolve; | 41 | mod resolve; |
43 | pub mod diagnostics; | 42 | pub mod diagnostics; |
44 | 43 | ||
@@ -64,7 +63,6 @@ pub use self::{ | |||
64 | nameres::{PerNs, Namespace, ImportId}, | 63 | nameres::{PerNs, Namespace, ImportId}, |
65 | ty::{Ty, ApplicationTy, TypeCtor, TraitRef, Substs, display::HirDisplay, CallableDef}, | 64 | ty::{Ty, ApplicationTy, TypeCtor, TraitRef, Substs, display::HirDisplay, CallableDef}, |
66 | impl_block::{ImplBlock, ImplItem}, | 65 | impl_block::{ImplBlock, ImplItem}, |
67 | docs::{Docs, Documentation}, | ||
68 | adt::AdtDef, | 66 | adt::AdtDef, |
69 | expr::ExprScopes, | 67 | expr::ExprScopes, |
70 | resolve::Resolution, | 68 | resolve::Resolution, |
@@ -83,4 +81,5 @@ pub use self::code_model::{ | |||
83 | Trait, TypeAlias, MacroDef, Container, | 81 | Trait, TypeAlias, MacroDef, Container, |
84 | BuiltinType, | 82 | BuiltinType, |
85 | src::{Source, HasSource}, | 83 | src::{Source, HasSource}, |
84 | docs::{Docs, Documentation, DocDef}, | ||
86 | }; | 85 | }; |
diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index 1e9cdaff4..823cdaaf3 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs | |||
@@ -163,10 +163,6 @@ impl NavigationTarget { | |||
163 | NavigationTarget::from_module(db, module) | 163 | NavigationTarget::from_module(db, module) |
164 | } | 164 | } |
165 | 165 | ||
166 | pub(crate) fn from_function(db: &RootDatabase, func: hir::Function) -> NavigationTarget { | ||
167 | NavigationTarget::from_def_source(db, func) | ||
168 | } | ||
169 | |||
170 | pub(crate) fn from_field(db: &RootDatabase, field: hir::StructField) -> NavigationTarget { | 166 | pub(crate) fn from_field(db: &RootDatabase, field: hir::StructField) -> NavigationTarget { |
171 | let src = field.source(db); | 167 | let src = field.source(db); |
172 | let file_id = src.file_id.original_file(db); | 168 | let file_id = src.file_id.original_file(db); |
@@ -208,7 +204,7 @@ impl NavigationTarget { | |||
208 | ) -> Option<NavigationTarget> { | 204 | ) -> Option<NavigationTarget> { |
209 | let nav = match module_def { | 205 | let nav = match module_def { |
210 | hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), | 206 | hir::ModuleDef::Module(module) => NavigationTarget::from_module(db, module), |
211 | hir::ModuleDef::Function(func) => NavigationTarget::from_function(db, func), | 207 | hir::ModuleDef::Function(func) => NavigationTarget::from_def_source(db, func), |
212 | hir::ModuleDef::Struct(it) => NavigationTarget::from_adt_def(db, it.into()), | 208 | hir::ModuleDef::Struct(it) => NavigationTarget::from_adt_def(db, it.into()), |
213 | hir::ModuleDef::Enum(it) => NavigationTarget::from_adt_def(db, it.into()), | 209 | hir::ModuleDef::Enum(it) => NavigationTarget::from_adt_def(db, it.into()), |
214 | hir::ModuleDef::Union(it) => NavigationTarget::from_adt_def(db, it.into()), | 210 | hir::ModuleDef::Union(it) => NavigationTarget::from_adt_def(db, it.into()), |
@@ -241,7 +237,7 @@ impl NavigationTarget { | |||
241 | 237 | ||
242 | pub(crate) fn from_impl_item(db: &RootDatabase, impl_item: hir::ImplItem) -> NavigationTarget { | 238 | pub(crate) fn from_impl_item(db: &RootDatabase, impl_item: hir::ImplItem) -> NavigationTarget { |
243 | match impl_item { | 239 | match impl_item { |
244 | ImplItem::Method(it) => NavigationTarget::from_function(db, it), | 240 | ImplItem::Method(it) => NavigationTarget::from_def_source(db, it), |
245 | ImplItem::Const(it) => NavigationTarget::from_def_source(db, it), | 241 | ImplItem::Const(it) => NavigationTarget::from_def_source(db, it), |
246 | ImplItem::TypeAlias(it) => NavigationTarget::from_def_source(db, it), | 242 | ImplItem::TypeAlias(it) => NavigationTarget::from_def_source(db, it), |
247 | } | 243 | } |
diff --git a/crates/ra_ide_api/src/goto_definition.rs b/crates/ra_ide_api/src/goto_definition.rs index 325a5a4f3..63ba6cf9d 100644 --- a/crates/ra_ide_api/src/goto_definition.rs +++ b/crates/ra_ide_api/src/goto_definition.rs | |||
@@ -59,10 +59,10 @@ pub(crate) fn reference_definition( | |||
59 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); | 59 | let analyzer = hir::SourceAnalyzer::new(db, file_id, name_ref.syntax(), None); |
60 | 60 | ||
61 | match classify_name_ref(db, &analyzer, name_ref) { | 61 | match classify_name_ref(db, &analyzer, name_ref) { |
62 | Some(Method(func)) => return Exact(NavigationTarget::from_function(db, func)), | ||
63 | Some(Macro(mac)) => return Exact(NavigationTarget::from_macro_def(db, mac)), | 62 | Some(Macro(mac)) => return Exact(NavigationTarget::from_macro_def(db, mac)), |
64 | Some(FieldAccess(field)) => return Exact(NavigationTarget::from_field(db, field)), | 63 | Some(FieldAccess(field)) => return Exact(NavigationTarget::from_field(db, field)), |
65 | Some(AssocItem(assoc)) => return Exact(NavigationTarget::from_impl_item(db, assoc)), | 64 | Some(AssocItem(assoc)) => return Exact(NavigationTarget::from_impl_item(db, assoc)), |
65 | Some(Method(func)) => return Exact(NavigationTarget::from_def_source(db, func)), | ||
66 | Some(Def(def)) => match NavigationTarget::from_def(db, def) { | 66 | Some(Def(def)) => match NavigationTarget::from_def(db, def) { |
67 | Some(nav) => return Exact(nav), | 67 | Some(nav) => return Exact(nav), |
68 | None => return Approximate(vec![]), | 68 | None => return Approximate(vec![]), |
@@ -253,12 +253,12 @@ mod tests { | |||
253 | //- /foo/lib.rs | 253 | //- /foo/lib.rs |
254 | #[macro_export] | 254 | #[macro_export] |
255 | macro_rules! foo { | 255 | macro_rules! foo { |
256 | () => { | 256 | () => { |
257 | {} | 257 | {} |
258 | }; | 258 | }; |
259 | } | 259 | } |
260 | ", | 260 | ", |
261 | "foo MACRO_CALL FileId(2) [0; 79) [29; 32)", | 261 | "foo MACRO_CALL FileId(2) [0; 66) [29; 32)", |
262 | ); | 262 | ); |
263 | } | 263 | } |
264 | 264 | ||