diff options
author | Benjamin Coenen <[email protected]> | 2020-06-18 10:31:15 +0100 |
---|---|---|
committer | Benjamin Coenen <[email protected]> | 2020-06-18 10:31:15 +0100 |
commit | 2732fdb5956851671d9e0339d80371e39a5a2361 (patch) | |
tree | eac77ad079aace512813450b873fbcd2d8f1d77a | |
parent | 36d9105d0e3b023b30e1c232701952395c68ce01 (diff) |
display Doctest code lens before comment #4785
Signed-off-by: Benjamin Coenen <[email protected]>
-rw-r--r-- | crates/ra_ide/src/display/navigation_target.rs | 4 | ||||
-rw-r--r-- | crates/ra_ide/src/runnables.rs | 8 |
2 files changed, 3 insertions, 9 deletions
diff --git a/crates/ra_ide/src/display/navigation_target.rs b/crates/ra_ide/src/display/navigation_target.rs index 820be583f..0b52b01ab 100644 --- a/crates/ra_ide/src/display/navigation_target.rs +++ b/crates/ra_ide/src/display/navigation_target.rs | |||
@@ -4,7 +4,6 @@ use either::Either; | |||
4 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; | 4 | use hir::{original_range, AssocItem, FieldSource, HasSource, InFile, ModuleSource}; |
5 | use ra_db::{FileId, SourceDatabase}; | 5 | use ra_db::{FileId, SourceDatabase}; |
6 | use ra_ide_db::{defs::Definition, RootDatabase}; | 6 | use ra_ide_db::{defs::Definition, RootDatabase}; |
7 | use ra_syntax::ast::AstToken; | ||
8 | use ra_syntax::{ | 7 | use ra_syntax::{ |
9 | ast::{self, DocCommentsOwner, NameOwner}, | 8 | ast::{self, DocCommentsOwner, NameOwner}, |
10 | match_ast, AstNode, SmolStr, | 9 | match_ast, AstNode, SmolStr, |
@@ -159,13 +158,12 @@ impl NavigationTarget { | |||
159 | ) -> NavigationTarget { | 158 | ) -> NavigationTarget { |
160 | let name = | 159 | let name = |
161 | named.value.name().map(|it| it.text().clone()).unwrap_or_else(|| SmolStr::new("_")); | 160 | named.value.name().map(|it| it.text().clone()).unwrap_or_else(|| SmolStr::new("_")); |
162 | let focus_range = node.value.doc_comments().next().map(|it| it.syntax().text_range()); | ||
163 | let frange = original_range(db, node.map(|it| it.syntax())); | 161 | let frange = original_range(db, node.map(|it| it.syntax())); |
164 | 162 | ||
165 | NavigationTarget::from_syntax( | 163 | NavigationTarget::from_syntax( |
166 | frange.file_id, | 164 | frange.file_id, |
167 | name, | 165 | name, |
168 | focus_range, | 166 | None, |
169 | frange.range, | 167 | frange.range, |
170 | node.value.syntax().kind(), | 168 | node.value.syntax().kind(), |
171 | ) | 169 | ) |
diff --git a/crates/ra_ide/src/runnables.rs b/crates/ra_ide/src/runnables.rs index 7c505a765..8105ef373 100644 --- a/crates/ra_ide/src/runnables.rs +++ b/crates/ra_ide/src/runnables.rs | |||
@@ -427,9 +427,7 @@ mod tests { | |||
427 | full_range: 22..64, | 427 | full_range: 22..64, |
428 | name: "foo", | 428 | name: "foo", |
429 | kind: FN_DEF, | 429 | kind: FN_DEF, |
430 | focus_range: Some( | 430 | focus_range: None, |
431 | 22..29, | ||
432 | ), | ||
433 | container_name: None, | 431 | container_name: None, |
434 | description: None, | 432 | description: None, |
435 | docs: None, | 433 | docs: None, |
@@ -494,9 +492,7 @@ mod tests { | |||
494 | full_range: 51..105, | 492 | full_range: 51..105, |
495 | name: "foo", | 493 | name: "foo", |
496 | kind: FN_DEF, | 494 | kind: FN_DEF, |
497 | focus_range: Some( | 495 | focus_range: None, |
498 | 51..58, | ||
499 | ), | ||
500 | container_name: None, | 496 | container_name: None, |
501 | description: None, | 497 | description: None, |
502 | docs: None, | 498 | docs: None, |