mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 04:44:57 +00:00
Move doc comment handling into ide-db
This commit is contained in:
parent
0bf0563a00
commit
b1575528c0
26 changed files with 342 additions and 266 deletions
|
@ -3,12 +3,13 @@ use std::fmt::Display;
|
|||
|
||||
use either::Either;
|
||||
use hir::{
|
||||
Adt, AsAssocItem, AttributeTemplate, CaptureKind, HasAttrs, HasSource, HirDisplay, Layout,
|
||||
LayoutError, Semantics, TypeInfo,
|
||||
Adt, AsAssocItem, AttributeTemplate, CaptureKind, HasSource, HirDisplay, Layout, LayoutError,
|
||||
Semantics, TypeInfo,
|
||||
};
|
||||
use ide_db::{
|
||||
base_db::SourceDatabase,
|
||||
defs::Definition,
|
||||
documentation::{Documentation, HasDocs},
|
||||
famous_defs::FamousDefs,
|
||||
generated::lints::{CLIPPY_LINTS, DEFAULT_LINTS, FEATURES},
|
||||
syntax_helpers::insert_whitespace_into_node,
|
||||
|
@ -616,9 +617,9 @@ fn render_builtin_attr(db: &RootDatabase, attr: hir::BuiltinAttr) -> Option<Mark
|
|||
markup(Some(docs.replace('*', "\\*")), desc, None)
|
||||
}
|
||||
|
||||
fn label_and_docs<D>(db: &RootDatabase, def: D) -> (String, Option<hir::Documentation>)
|
||||
fn label_and_docs<D>(db: &RootDatabase, def: D) -> (String, Option<Documentation>)
|
||||
where
|
||||
D: HasAttrs + HirDisplay,
|
||||
D: HasDocs + HirDisplay,
|
||||
{
|
||||
let label = def.display(db).to_string();
|
||||
let docs = def.docs(db);
|
||||
|
@ -631,9 +632,9 @@ fn label_and_layout_info_and_docs<D, E, E2>(
|
|||
config: &HoverConfig,
|
||||
layout_extractor: E,
|
||||
layout_offset_extractor: E2,
|
||||
) -> (String, Option<hir::Documentation>)
|
||||
) -> (String, Option<Documentation>)
|
||||
where
|
||||
D: HasAttrs + HirDisplay,
|
||||
D: HasDocs + HirDisplay,
|
||||
E: Fn(&D) -> Result<Layout, LayoutError>,
|
||||
E2: Fn(&Layout) -> Option<u64>,
|
||||
{
|
||||
|
@ -657,9 +658,9 @@ fn label_value_and_layout_info_and_docs<D, E, E2, E3, V>(
|
|||
value_extractor: E,
|
||||
layout_extractor: E2,
|
||||
layout_tag_extractor: E3,
|
||||
) -> (String, Option<hir::Documentation>)
|
||||
) -> (String, Option<Documentation>)
|
||||
where
|
||||
D: HasAttrs + HirDisplay,
|
||||
D: HasDocs + HirDisplay,
|
||||
E: Fn(&D) -> Option<V>,
|
||||
E2: Fn(&D) -> Result<Layout, LayoutError>,
|
||||
E3: Fn(&Layout) -> Option<usize>,
|
||||
|
@ -686,9 +687,9 @@ fn label_value_and_docs<D, E, V>(
|
|||
db: &RootDatabase,
|
||||
def: D,
|
||||
value_extractor: E,
|
||||
) -> (String, Option<hir::Documentation>)
|
||||
) -> (String, Option<Documentation>)
|
||||
where
|
||||
D: HasAttrs + HirDisplay,
|
||||
D: HasDocs + HirDisplay,
|
||||
E: Fn(&D) -> Option<V>,
|
||||
V: Display,
|
||||
{
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue