diff options
| author | Laurențiu Nicola <lnicola@users.noreply.github.com> | 2025-02-17 05:58:35 +0000 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-02-17 05:58:35 +0000 |
| commit | 6b46937305053be16f222c078b5f30ce46c78ec2 (patch) | |
| tree | b2b5b0af72cc0797d78c3059b94456535bf770cf | |
| parent | 4273bece6f6ddf1a3b1e19dc319c5cb87a42384a (diff) | |
| parent | 04ab8373c89d143feca797dfd5d501a98f59a43f (diff) | |
| download | rust-6b46937305053be16f222c078b5f30ce46c78ec2.tar.gz rust-6b46937305053be16f222c078b5f30ce46c78ec2.zip | |
Merge pull request #19166 from ChayimFriedman2/runnables-order
fix: Fix sorting of runnables
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/annotations.rs | 9 | ||||
| -rw-r--r-- | src/tools/rust-analyzer/crates/ide/src/runnables.rs | 6 |
2 files changed, 4 insertions, 11 deletions
diff --git a/src/tools/rust-analyzer/crates/ide/src/annotations.rs b/src/tools/rust-analyzer/crates/ide/src/annotations.rs index a0add4741f3..e47891bbdfe 100644 --- a/src/tools/rust-analyzer/crates/ide/src/annotations.rs +++ b/src/tools/rust-analyzer/crates/ide/src/annotations.rs @@ -173,14 +173,7 @@ pub(crate) fn annotations( annotations .into_iter() .sorted_by_key(|a| { - ( - a.range.start(), - a.range.end(), - match &a.kind { - AnnotationKind::Runnable(runnable) => Some(runnable.nav.name.clone()), - _ => None, - }, - ) + (a.range.start(), a.range.end(), matches!(a.kind, AnnotationKind::Runnable(..))) }) .collect() } diff --git a/src/tools/rust-analyzer/crates/ide/src/runnables.rs b/src/tools/rust-analyzer/crates/ide/src/runnables.rs index 9e3b70fa8ea..509ae3204c3 100644 --- a/src/tools/rust-analyzer/crates/ide/src/runnables.rs +++ b/src/tools/rust-analyzer/crates/ide/src/runnables.rs @@ -61,8 +61,8 @@ pub enum RunnableKind { #[derive(Debug, Clone, Hash, PartialEq, Eq, PartialOrd, Ord)] enum RunnableDiscKind { - Test, TestMod, + Test, DocTest, Bench, Bin, @@ -1233,8 +1233,8 @@ gen_main!(); "(TestMod, NavigationTarget { file_id: FileId(0), full_range: 0..315, name: \"\", kind: Module })", "(TestMod, NavigationTarget { file_id: FileId(0), full_range: 267..292, focus_range: 271..276, name: \"tests\", kind: Module, description: \"mod tests\" })", "(Test, NavigationTarget { file_id: FileId(0), full_range: 283..290, name: \"foo_test\", kind: Function })", - "(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)", "(TestMod, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"tests2\", kind: Module, description: \"mod tests2\" }, true)", + "(Test, NavigationTarget { file_id: FileId(0), full_range: 293..301, name: \"foo_test2\", kind: Function }, true)", "(Bin, NavigationTarget { file_id: FileId(0), full_range: 302..314, name: \"main\", kind: Function })", ] "#]], @@ -1263,10 +1263,10 @@ foo!(); "#, expect![[r#" [ + "(TestMod, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo_tests\", kind: Module, description: \"mod foo_tests\" }, true)", "(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo0\", kind: Function }, true)", "(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo1\", kind: Function }, true)", "(Test, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo2\", kind: Function }, true)", - "(TestMod, NavigationTarget { file_id: FileId(0), full_range: 210..217, name: \"foo_tests\", kind: Module, description: \"mod foo_tests\" }, true)", ] "#]], ); |
