aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorEdwin Cheng <[email protected]>2019-06-09 17:20:49 +0100
committerEdwin Cheng <[email protected]>2019-06-09 17:20:49 +0100
commit358ad0efca0fe76b040b47d199e166feb6128ac0 (patch)
treed2cad563312ebc186cf689107735bdcdca998005
parent4db0f0ccaf6d44be6369b2da3a0cf58db6a7246c (diff)
Make description_from_symbol depends on symbol
-rw-r--r--crates/ra_ide_api/src/display/navigation_target.rs10
1 files 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 {
75 } 75 }
76 76
77 pub(crate) fn from_symbol(db: &RootDatabase, symbol: FileSymbol) -> NavigationTarget { 77 pub(crate) fn from_symbol(db: &RootDatabase, symbol: FileSymbol) -> NavigationTarget {
78 let file = db.parse(symbol.file_id).tree;
79 let node = symbol.ptr.to_node(file.syntax()).to_owned();
80
81 NavigationTarget { 78 NavigationTarget {
82 file_id: symbol.file_id, 79 file_id: symbol.file_id,
83 name: symbol.name.clone(), 80 name: symbol.name.clone(),
@@ -85,7 +82,7 @@ impl NavigationTarget {
85 full_range: symbol.ptr.range(), 82 full_range: symbol.ptr.range(),
86 focus_range: symbol.name_range, 83 focus_range: symbol.name_range,
87 container_name: symbol.container_name.clone(), 84 container_name: symbol.container_name.clone(),
88 description: description_from_symbol(&node), 85 description: description_from_symbol(db, &symbol),
89 docs: docs_from_symbol(db, &symbol), 86 docs: docs_from_symbol(db, &symbol),
90 } 87 }
91 } 88 }
@@ -442,7 +439,10 @@ fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
442/// Get a description of a symbol. 439/// Get a description of a symbol.
443/// 440///
444/// e.g. `struct Name`, `enum Name`, `fn Name` 441/// e.g. `struct Name`, `enum Name`, `fn Name`
445fn description_from_symbol(node: &SyntaxNode) -> Option<String> { 442fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
443 let file = db.parse(symbol.file_id).tree;
444 let node = symbol.ptr.to_node(file.syntax()).to_owned();
445
446 // FIXME: After type inference is done, add type information to improve the output 446 // FIXME: After type inference is done, add type information to improve the output
447 447
448 visitor() 448 visitor()