mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-02 14:51:48 +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
|
@ -1,10 +1,11 @@
|
|||
use std::ffi::OsStr;
|
||||
|
||||
use expect_test::{expect, Expect};
|
||||
use hir::{HasAttrs, Semantics};
|
||||
use hir::Semantics;
|
||||
use ide_db::{
|
||||
base_db::{FilePosition, FileRange},
|
||||
defs::Definition,
|
||||
documentation::{Documentation, HasDocs},
|
||||
RootDatabase,
|
||||
};
|
||||
use itertools::Itertools;
|
||||
|
@ -78,7 +79,7 @@ fn check_doc_links(ra_fixture: &str) {
|
|||
fn def_under_cursor(
|
||||
sema: &Semantics<'_, RootDatabase>,
|
||||
position: &FilePosition,
|
||||
) -> (Definition, hir::Documentation) {
|
||||
) -> (Definition, Documentation) {
|
||||
let (docs, def) = sema
|
||||
.parse(position.file_id)
|
||||
.syntax()
|
||||
|
@ -96,7 +97,7 @@ fn def_under_cursor(
|
|||
fn node_to_def(
|
||||
sema: &Semantics<'_, RootDatabase>,
|
||||
node: &SyntaxNode,
|
||||
) -> Option<Option<(Option<hir::Documentation>, Definition)>> {
|
||||
) -> Option<Option<(Option<Documentation>, Definition)>> {
|
||||
Some(match_ast! {
|
||||
match node {
|
||||
ast::SourceFile(it) => sema.to_def(&it).map(|def| (def.docs(sema.db), Definition::Module(def))),
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue