mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 22:54:58 +00:00
Add display::Description
This commit is contained in:
parent
2acf1e16fc
commit
aacc894134
4 changed files with 163 additions and 67 deletions
|
@ -13,6 +13,7 @@ use crate::{
|
|||
db::RootDatabase,
|
||||
RangeInfo,
|
||||
name_ref_kind::{NameRefKind::*, classify_name_ref},
|
||||
display::Description,
|
||||
};
|
||||
|
||||
pub(crate) fn goto_definition(
|
||||
|
@ -72,7 +73,7 @@ pub(crate) fn reference_definition(
|
|||
}
|
||||
}
|
||||
Some(Pat(pat)) => return Exact(NavigationTarget::from_pat(db, file_id, pat)),
|
||||
Some(SelfParam(par)) => return Exact(NavigationTarget::from_self_param(db, file_id, par)),
|
||||
Some(SelfParam(par)) => return Exact(NavigationTarget::from_self_param(file_id, par)),
|
||||
Some(GenericParam(_)) => {
|
||||
// FIXME: go to the generic param def
|
||||
}
|
||||
|
@ -115,37 +116,37 @@ pub(crate) fn name_definition(
|
|||
fn named_target(file_id: FileId, node: &SyntaxNode) -> Option<NavigationTarget> {
|
||||
visitor()
|
||||
.visit(|node: &ast::StructDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::EnumDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::EnumVariant| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::FnDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::TypeAliasDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::ConstDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::StaticDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::TraitDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::NamedFieldDef| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::Module| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), node.description())
|
||||
})
|
||||
.visit(|node: &ast::MacroCall| {
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text())
|
||||
NavigationTarget::from_named(file_id, node, node.doc_comment_text(), None)
|
||||
})
|
||||
.accept(node)
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue