diff options
author | Ekaterina Babshukova <[email protected]> | 2019-10-12 13:47:36 +0100 |
---|---|---|
committer | Ekaterina Babshukova <[email protected]> | 2019-10-22 21:47:31 +0100 |
commit | 0dd08b8023eba053725d5032149808b8733be263 (patch) | |
tree | 47b294a490ab03782b654c5d2272bedd6263b858 /crates/ra_ide_api | |
parent | 79e6b3b0d17b9389ccdc422ae42beb38163c6610 (diff) |
classify definition of a function right
Diffstat (limited to 'crates/ra_ide_api')
-rw-r--r-- | crates/ra_ide_api/src/name_kind.rs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/crates/ra_ide_api/src/name_kind.rs b/crates/ra_ide_api/src/name_kind.rs index 2f944fb04..583399cfe 100644 --- a/crates/ra_ide_api/src/name_kind.rs +++ b/crates/ra_ide_api/src/name_kind.rs | |||
@@ -221,6 +221,9 @@ impl HasDefinition for AssocItem { | |||
221 | } | 221 | } |
222 | 222 | ||
223 | fn from_def(db: &RootDatabase, file_id: HirFileId, def: Self::Def) -> Option<Definition> { | 223 | fn from_def(db: &RootDatabase, file_id: HirFileId, def: Self::Def) -> Option<Definition> { |
224 | if def.syntax().parent().and_then(ast::ItemList::cast).is_none() { | ||
225 | return None; | ||
226 | } | ||
224 | let src = hir::Source { file_id, ast: def }; | 227 | let src = hir::Source { file_id, ast: def }; |
225 | let item = AssocItem::from_source(db, src)?; | 228 | let item = AssocItem::from_source(db, src)?; |
226 | Some(item.definition(db)) | 229 | Some(item.definition(db)) |