aboutsummaryrefslogtreecommitdiff
path: root/crates/ide_db
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2021-03-13 13:50:35 +0000
committerGitHub <[email protected]>2021-03-13 13:50:35 +0000
commit7accf6bc37c059a83a58c82f463f02a02ed2226f (patch)
tree979c8ebe39bde9c989cb1a09f06cea4cf7cb04ac /crates/ide_db
parent9674490b45a931399a9a05cd3a4c7e8fae9ec2a8 (diff)
parent49cdb2452a225dec3834e69fb011c3d7e68084f7 (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_db')
-rw-r--r--crates/ide_db/src/search.rs4
1 files changed, 4 insertions, 0 deletions
diff --git a/crates/ide_db/src/search.rs b/crates/ide_db/src/search.rs
index ddcfbd3f3..fa18703e1 100644
--- a/crates/ide_db/src/search.rs
+++ b/crates/ide_db/src/search.rs
@@ -86,6 +86,10 @@ impl SearchScope {
86 SearchScope::new(std::iter::once((file, None)).collect()) 86 SearchScope::new(std::iter::once((file, None)).collect())
87 } 87 }
88 88
89 pub fn file_range(range: FileRange) -> SearchScope {
90 SearchScope::new(std::iter::once((range.file_id, Some(range.range))).collect())
91 }
92
89 pub fn files(files: &[FileId]) -> SearchScope { 93 pub fn files(files: &[FileId]) -> SearchScope {
90 SearchScope::new(files.iter().map(|f| (*f, None)).collect()) 94 SearchScope::new(files.iter().map(|f| (*f, None)).collect())
91 } 95 }