From 358ad0efca0fe76b040b47d199e166feb6128ac0 Mon Sep 17 00:00:00 2001 From: Edwin Cheng Date: Mon, 10 Jun 2019 00:20:49 +0800 Subject: Make description_from_symbol depends on symbol --- crates/ra_ide_api/src/display/navigation_target.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/ra_ide_api/src/display/navigation_target.rs b/crates/ra_ide_api/src/display/navigation_target.rs index c0fa9439e..f441ae943 100644 --- a/crates/ra_ide_api/src/display/navigation_target.rs +++ b/crates/ra_ide_api/src/display/navigation_target.rs @@ -75,9 +75,6 @@ impl NavigationTarget { } pub(crate) fn from_symbol(db: &RootDatabase, symbol: FileSymbol) -> NavigationTarget { - let file = db.parse(symbol.file_id).tree; - let node = symbol.ptr.to_node(file.syntax()).to_owned(); - NavigationTarget { file_id: symbol.file_id, name: symbol.name.clone(), @@ -85,7 +82,7 @@ impl NavigationTarget { full_range: symbol.ptr.range(), focus_range: symbol.name_range, container_name: symbol.container_name.clone(), - description: description_from_symbol(&node), + description: description_from_symbol(db, &symbol), docs: docs_from_symbol(db, &symbol), } } @@ -442,7 +439,10 @@ fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option { /// Get a description of a symbol. /// /// e.g. `struct Name`, `enum Name`, `fn Name` -fn description_from_symbol(node: &SyntaxNode) -> Option { +fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option { + let file = db.parse(symbol.file_id).tree; + let node = symbol.ptr.to_node(file.syntax()).to_owned(); + // FIXME: After type inference is done, add type information to improve the output visitor() -- cgit v1.2.3