From f9ed8d4d23cd210f24ca303c72b436bfbe84741f Mon Sep 17 00:00:00 2001 From: Aleksey Kladov Date: Fri, 11 Jan 2019 14:00:54 +0300 Subject: envapsulate navigation target better --- crates/ra_ide_api/src/imp.rs | 15 ++------------- 1 file changed, 2 insertions(+), 13 deletions(-) (limited to 'crates/ra_ide_api/src/imp.rs') diff --git a/crates/ra_ide_api/src/imp.rs b/crates/ra_ide_api/src/imp.rs index 7c60ab7d6..12bfe1761 100644 --- a/crates/ra_ide_api/src/imp.rs +++ b/crates/ra_ide_api/src/imp.rs @@ -11,7 +11,6 @@ use ra_syntax::{ TextRange, AstNode, SourceFile, ast::{self, NameOwner}, algo::find_node_at_offset, - SyntaxKind::*, }; use crate::{ @@ -109,18 +108,8 @@ impl db::RootDatabase { None => return Ok(Vec::new()), Some(it) => it, }; - let (file_id, ast_module) = match module.declaration_source(self)? { - None => return Ok(Vec::new()), - Some(it) => it, - }; - let name = ast_module.name().unwrap(); - Ok(vec![NavigationTarget { - file_id, - name: name.text().clone(), - range: name.syntax().range(), - kind: MODULE, - ptr: None, - }]) + let nav = NavigationTarget::from_module(self, module)?; + Ok(vec![nav]) } /// Returns `Vec` for the same reason as `parent_module` pub(crate) fn crate_for(&self, file_id: FileId) -> Cancelable> { -- cgit v1.2.3