mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-27 12:29:21 +00:00
Make description_from_symbol depends on symbol
This commit is contained in:
parent
4db0f0ccaf
commit
358ad0efca
1 changed files with 5 additions and 5 deletions
|
@ -75,9 +75,6 @@ impl NavigationTarget {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub(crate) fn from_symbol(db: &RootDatabase, symbol: FileSymbol) -> 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 {
|
NavigationTarget {
|
||||||
file_id: symbol.file_id,
|
file_id: symbol.file_id,
|
||||||
name: symbol.name.clone(),
|
name: symbol.name.clone(),
|
||||||
|
@ -85,7 +82,7 @@ impl NavigationTarget {
|
||||||
full_range: symbol.ptr.range(),
|
full_range: symbol.ptr.range(),
|
||||||
focus_range: symbol.name_range,
|
focus_range: symbol.name_range,
|
||||||
container_name: symbol.container_name.clone(),
|
container_name: symbol.container_name.clone(),
|
||||||
description: description_from_symbol(&node),
|
description: description_from_symbol(db, &symbol),
|
||||||
docs: docs_from_symbol(db, &symbol),
|
docs: docs_from_symbol(db, &symbol),
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -442,7 +439,10 @@ fn docs_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
|
||||||
/// Get a description of a symbol.
|
/// Get a description of a symbol.
|
||||||
///
|
///
|
||||||
/// e.g. `struct Name`, `enum Name`, `fn Name`
|
/// e.g. `struct Name`, `enum Name`, `fn Name`
|
||||||
fn description_from_symbol(node: &SyntaxNode) -> Option<String> {
|
fn description_from_symbol(db: &RootDatabase, symbol: &FileSymbol) -> Option<String> {
|
||||||
|
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
|
// FIXME: After type inference is done, add type information to improve the output
|
||||||
|
|
||||||
visitor()
|
visitor()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue