mirror of
https://github.com/rust-lang/rust.git
synced 2025-02-09 13:33:43 +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
@ -4,7 +4,6 @@ use either::Either;
|
|||||||
use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource};
|
use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource};
|
||||||
use ra_db::{FileId, SourceDatabase};
|
use ra_db::{FileId, SourceDatabase};
|
||||||
use ra_ide_db::{defs::Definition, RootDatabase};
|
use ra_ide_db::{defs::Definition, RootDatabase};
|
||||||
use ra_syntax::ast::AstToken;
|
|
||||||
use ra_syntax::{
|
use ra_syntax::{
|
||||||
ast::{self, DocCommentsOwner, NameOwner},
|
ast::{self, DocCommentsOwner, NameOwner},
|
||||||
match_ast, AstNode, SmolStr,
|
match_ast, AstNode, SmolStr,
|
||||||
@ -159,13 +158,12 @@ impl NavigationTarget {
|
|||||||
) -> NavigationTarget {
|
) -> NavigationTarget {
|
||||||
let name =
|
let name =
|
||||||
named.value.name().map(|it| it.text().clone()).unwrap_or_else(|| SmolStr::new("_"));
|
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()));
|
let frange = original_range(db, node.map(|it| it.syntax()));
|
||||||
|
|
||||||
NavigationTarget::from_syntax(
|
NavigationTarget::from_syntax(
|
||||||
frange.file_id,
|
frange.file_id,
|
||||||
name,
|
name,
|
||||||
focus_range,
|
None,
|
||||||
frange.range,
|
frange.range,
|
||||||
node.value.syntax().kind(),
|
node.value.syntax().kind(),
|
||||||
)
|
)
|
||||||
|
@ -427,9 +427,7 @@ mod tests {
|
|||||||
full_range: 22..64,
|
full_range: 22..64,
|
||||||
name: "foo",
|
name: "foo",
|
||||||
kind: FN_DEF,
|
kind: FN_DEF,
|
||||||
focus_range: Some(
|
focus_range: None,
|
||||||
22..29,
|
|
||||||
),
|
|
||||||
container_name: None,
|
container_name: None,
|
||||||
description: None,
|
description: None,
|
||||||
docs: None,
|
docs: None,
|
||||||
@ -494,9 +492,7 @@ mod tests {
|
|||||||
full_range: 51..105,
|
full_range: 51..105,
|
||||||
name: "foo",
|
name: "foo",
|
||||||
kind: FN_DEF,
|
kind: FN_DEF,
|
||||||
focus_range: Some(
|
focus_range: None,
|
||||||
51..58,
|
|
||||||
),
|
|
||||||
container_name: None,
|
container_name: None,
|
||||||
description: None,
|
description: None,
|
||||||
docs: None,
|
docs: None,
|
||||||
|
Loading…
Reference in New Issue
Block a user