diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2021-03-13 13:50:35 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2021-03-13 13:50:35 +0000 |
commit | 7accf6bc37c059a83a58c82f463f02a02ed2226f (patch) | |
tree | 979c8ebe39bde9c989cb1a09f06cea4cf7cb04ac /crates/ide/src/lib.rs | |
parent | 9674490b45a931399a9a05cd3a4c7e8fae9ec2a8 (diff) | |
parent | 49cdb2452a225dec3834e69fb011c3d7e68084f7 (diff) |
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]>
Diffstat (limited to 'crates/ide/src/lib.rs')
-rw-r--r-- | crates/ide/src/lib.rs | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs index 0a493d2f3..a8b169e87 100644 --- a/crates/ide/src/lib.rs +++ b/crates/ide/src/lib.rs | |||
@@ -447,6 +447,15 @@ impl Analysis { | |||
447 | self.with_db(|db| runnables::runnables(db, file_id)) | 447 | self.with_db(|db| runnables::runnables(db, file_id)) |
448 | } | 448 | } |
449 | 449 | ||
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 | |||
450 | /// Computes syntax highlighting for the given file | 459 | /// Computes syntax highlighting for the given file |
451 | pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HlRange>> { | 460 | pub fn highlight(&self, file_id: FileId) -> Cancelable<Vec<HlRange>> { |
452 | self.with_db(|db| syntax_highlighting::highlight(db, file_id, None, false)) | 461 | self.with_db(|db| syntax_highlighting::highlight(db, file_id, None, false)) |