diff options
author | Dmitry <[email protected]> | 2020-08-09 14:35:51 +0100 |
---|---|---|
committer | Dmitry <[email protected]> | 2020-08-09 14:39:32 +0100 |
commit | 8068302fefc75440b823f4bf1731a5f347d7c767 (patch) | |
tree | 251b967182e79bc82a58c2fb208c688f6152df1f /crates/ra_ssr/src/lib.rs | |
parent | 1a43a0f63e0008787225abb6fb2baef97b6a39e0 (diff) | |
parent | 8a57afe5a4bfab40072a83f7dc4ca560bf860919 (diff) |
Merge remote-tracking branch 'origin/master'
Diffstat (limited to 'crates/ra_ssr/src/lib.rs')
-rw-r--r-- | crates/ra_ssr/src/lib.rs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/crates/ra_ssr/src/lib.rs b/crates/ra_ssr/src/lib.rs index 7014a6ac6..c780b460a 100644 --- a/crates/ra_ssr/src/lib.rs +++ b/crates/ra_ssr/src/lib.rs | |||
@@ -52,6 +52,7 @@ pub struct MatchFinder<'db> { | |||
52 | sema: Semantics<'db, ra_ide_db::RootDatabase>, | 52 | sema: Semantics<'db, ra_ide_db::RootDatabase>, |
53 | rules: Vec<ResolvedRule>, | 53 | rules: Vec<ResolvedRule>, |
54 | resolution_scope: resolving::ResolutionScope<'db>, | 54 | resolution_scope: resolving::ResolutionScope<'db>, |
55 | restrict_ranges: Vec<FileRange>, | ||
55 | } | 56 | } |
56 | 57 | ||
57 | impl<'db> MatchFinder<'db> { | 58 | impl<'db> MatchFinder<'db> { |
@@ -60,10 +61,12 @@ impl<'db> MatchFinder<'db> { | |||
60 | pub fn in_context( | 61 | pub fn in_context( |
61 | db: &'db ra_ide_db::RootDatabase, | 62 | db: &'db ra_ide_db::RootDatabase, |
62 | lookup_context: FilePosition, | 63 | lookup_context: FilePosition, |
64 | mut restrict_ranges: Vec<FileRange>, | ||
63 | ) -> MatchFinder<'db> { | 65 | ) -> MatchFinder<'db> { |
66 | restrict_ranges.retain(|range| !range.range.is_empty()); | ||
64 | let sema = Semantics::new(db); | 67 | let sema = Semantics::new(db); |
65 | let resolution_scope = resolving::ResolutionScope::new(&sema, lookup_context); | 68 | let resolution_scope = resolving::ResolutionScope::new(&sema, lookup_context); |
66 | MatchFinder { sema: Semantics::new(db), rules: Vec::new(), resolution_scope } | 69 | MatchFinder { sema, rules: Vec::new(), resolution_scope, restrict_ranges } |
67 | } | 70 | } |
68 | 71 | ||
69 | /// Constructs an instance using the start of the first file in `db` as the lookup context. | 72 | /// Constructs an instance using the start of the first file in `db` as the lookup context. |
@@ -79,6 +82,7 @@ impl<'db> MatchFinder<'db> { | |||
79 | Ok(MatchFinder::in_context( | 82 | Ok(MatchFinder::in_context( |
80 | db, | 83 | db, |
81 | FilePosition { file_id: first_file_id, offset: 0.into() }, | 84 | FilePosition { file_id: first_file_id, offset: 0.into() }, |
85 | vec![], | ||
82 | )) | 86 | )) |
83 | } else { | 87 | } else { |
84 | bail!("No files to search"); | 88 | bail!("No files to search"); |