Skip to content

Commit

Permalink
Name the tests in the runnable annotations if they come from a macro …
Browse files Browse the repository at this point in the history
…invocation
  • Loading branch information
Veykril committed Jun 30, 2021
1 parent 8d3a378 commit 5602f0e
Show file tree
Hide file tree
Showing 6 changed files with 348 additions and 121 deletions.
10 changes: 10 additions & 0 deletions crates/hir/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1634,6 +1634,16 @@ impl HasVisibility for AssocItem {
}
}

impl From<AssocItem> for ModuleDef {
fn from(assoc: AssocItem) -> Self {
match assoc {
AssocItem::Function(it) => ModuleDef::Function(it),
AssocItem::Const(it) => ModuleDef::Const(it),
AssocItem::TypeAlias(it) => ModuleDef::TypeAlias(it),
}
}
}

#[derive(Clone, Copy, PartialEq, Eq, Debug, Hash)]
pub enum GenericDef {
Function(Function),
Expand Down
19 changes: 17 additions & 2 deletions crates/ide/src/annotations.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ pub(crate) fn annotations(
continue;
}

let action = runnable.action();
let range = runnable.nav.focus_or_full_range();

if config.run {
Expand All @@ -69,7 +68,7 @@ pub(crate) fn annotations(
});
}

if action.debugee && config.debug {
if runnable.debugee() && config.debug {
annotations.push(Annotation {
range,
kind: AnnotationKind::Runnable { debug: true, runnable },
Expand Down Expand Up @@ -228,6 +227,7 @@ fn main() {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -247,6 +247,7 @@ fn main() {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down Expand Up @@ -332,6 +333,7 @@ fn main() {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -351,6 +353,7 @@ fn main() {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down Expand Up @@ -440,6 +443,7 @@ fn main() {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -459,6 +463,7 @@ fn main() {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down Expand Up @@ -601,6 +606,7 @@ fn main() {}
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -620,6 +626,7 @@ fn main() {}
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down Expand Up @@ -674,6 +681,7 @@ fn main() {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -693,6 +701,7 @@ fn main() {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down Expand Up @@ -816,6 +825,7 @@ mod tests {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -835,6 +845,7 @@ mod tests {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -854,6 +865,7 @@ mod tests {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -876,6 +888,7 @@ mod tests {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -898,6 +911,7 @@ mod tests {
kind: Runnable {
debug: false,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand All @@ -924,6 +938,7 @@ mod tests {
kind: Runnable {
debug: true,
runnable: Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down
2 changes: 2 additions & 0 deletions crates/ide/src/hover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2462,6 +2462,7 @@ fn foo_$0test() {}
),
Runnable(
Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down Expand Up @@ -2500,6 +2501,7 @@ mod tests$0 {
[
Runnable(
Runnable {
use_name_in_title: false,
nav: NavigationTarget {
file_id: FileId(
0,
Expand Down
Loading

0 comments on commit 5602f0e

Please sign in to comment.