mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-27 05:23:24 +00:00
display Doctest code lens before comment #4785
Signed-off-by: Benjamin Coenen <5719034+bnjjj@users.noreply.github.com>
This commit is contained in:
parent
36d9105d0e
commit
2732fdb595
2 changed files with 3 additions and 9 deletions
|
@ -4,7 +4,6 @@ use either::Either;
|
|||
use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource};
|
||||
use ra_db::{FileId, SourceDatabase};
|
||||
use ra_ide_db::{defs::Definition, RootDatabase};
|
||||
use ra_syntax::ast::AstToken;
|
||||
use ra_syntax::{
|
||||
ast::{self, DocCommentsOwner, NameOwner},
|
||||
match_ast, AstNode, SmolStr,
|
||||
|
@ -159,13 +158,12 @@ impl NavigationTarget {
|
|||
) -> NavigationTarget {
|
||||
let name =
|
||||
named.value.name().map(|it| it.text().clone()).unwrap_or_else(|| SmolStr::new("_"));
|
||||
let focus_range = node.value.doc_comments().next().map(|it| it.syntax().text_range());
|
||||
let frange = original_range(db, node.map(|it| it.syntax()));
|
||||
|
||||
NavigationTarget::from_syntax(
|
||||
frange.file_id,
|
||||
name,
|
||||
focus_range,
|
||||
None,
|
||||
frange.range,
|
||||
node.value.syntax().kind(),
|
||||
)
|
||||
|
|
|
@ -427,9 +427,7 @@ mod tests {
|
|||
full_range: 22..64,
|
||||
name: "foo",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
22..29,
|
||||
),
|
||||
focus_range: None,
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
|
@ -494,9 +492,7 @@ mod tests {
|
|||
full_range: 51..105,
|
||||
name: "foo",
|
||||
kind: FN_DEF,
|
||||
focus_range: Some(
|
||||
51..58,
|
||||
),
|
||||
focus_range: None,
|
||||
container_name: None,
|
||||
description: None,
|
||||
docs: None,
|
||||
|
|
Loading…
Reference in a new issue