Skip to content

Commit 7accf6b

Browse files
bors[bot]vsrs
andauthored
Merge #7799
7799: Related tests r=matklad a=vsrs ![tests](https://user-images.githubusercontent.com/62505555/109397453-a9013680-7947-11eb-8b11-ac03079f7645.gif) This adds an ability to look for tests for the item under the cursor: function, constant, data type, etc The LSP part is bound to change. But the feature itself already works and I'm looking for a feedback :) Co-authored-by: vsrs <[email protected]>
2 parents 9674490 + 49cdb24 commit 7accf6b

File tree

13 files changed

+471
-28
lines changed

13 files changed

+471
-28
lines changed

crates/cfg/src/cfg_expr.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ impl fmt::Display for CfgAtom {
4949
}
5050
}
5151

52-
#[derive(Debug, Clone, PartialEq, Eq)]
52+
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
5353
pub enum CfgExpr {
5454
Invalid,
5555
Atom(CfgAtom),

crates/ide/src/lib.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -447,6 +447,15 @@ impl Analysis {
447447
self.with_db(|db| runnables::runnables(db, file_id))
448448
}
449449

450+
/// Returns the set of tests for the given file position.
451+
pub fn related_tests(
452+
&self,
453+
position: FilePosition,
454+
search_scope: Option<SearchScope>,
455+
) -> Cancelable<Vec<Runnable>> {
456+
self.with_db(|db| runnables::related_tests(db, position, search_scope))
457+
}
458+
450459
/// Computes syntax highlighting for the given file
451460
pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HlRange>> {
452461
self.with_db(|db| syntax_highlighting::highlight(db, file_id, None, false))

0 commit comments

Comments
 (0)