Add test explorer

This commit is contained in:
hkalbasi 2024-03-01 13:40:29 +03:30
parent 916914418a
commit 44be2432f5
19 changed files with 1083 additions and 172 deletions

View file

@ -50,6 +50,7 @@ mod static_index;
mod status;
mod syntax_highlighting;
mod syntax_tree;
mod test_explorer;
mod typing;
mod view_crate_graph;
mod view_hir;
@ -108,6 +109,7 @@ pub use crate::{
tags::{Highlight, HlMod, HlMods, HlOperator, HlPunct, HlTag},
HighlightConfig, HlRange,
},
test_explorer::{TestItem, TestItemKind},
};
pub use hir::Semantics;
pub use ide_assists::{
@ -340,6 +342,18 @@ impl Analysis {
self.with_db(|db| view_item_tree::view_item_tree(db, file_id))
}
pub fn discover_test_roots(&self) -> Cancellable<Vec<TestItem>> {
self.with_db(test_explorer::discover_test_roots)
}
pub fn discover_tests_in_crate_by_test_id(&self, crate_id: &str) -> Cancellable<Vec<TestItem>> {
self.with_db(|db| test_explorer::discover_tests_in_crate_by_test_id(db, crate_id))
}
pub fn discover_tests_in_crate(&self, crate_id: CrateId) -> Cancellable<Vec<TestItem>> {
self.with_db(|db| test_explorer::discover_tests_in_crate(db, crate_id))
}
/// Renders the crate graph to GraphViz "dot" syntax.
pub fn view_crate_graph(&self, full: bool) -> Cancellable<Result<String, String>> {
self.with_db(|db| view_crate_graph::view_crate_graph(db, full))