diff options
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/search.rs | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/crates/ra_ide_db/src/search.rs b/crates/ra_ide_db/src/search.rs index 7bd99d4cc..6f198df04 100644 --- a/crates/ra_ide_db/src/search.rs +++ b/crates/ra_ide_db/src/search.rs | |||
@@ -1,7 +1,9 @@ | |||
1 | //! Generally, `search_scope` returns files that might contain references for the element. | 1 | //! Implementation of find-usages functionality. |
2 | //! For `pub(crate)` things it's a crate, for `pub` things it's a crate and dependant crates. | 2 | //! |
3 | //! In some cases, the location of the references is known to within a `TextRange`, | 3 | //! It is based on the standard ide trick: first, we run a fast text search to |
4 | //! e.g. for things like local variables. | 4 | //! get a super-set of matches. Then, we we confirm each match using precise |
5 | //! name resolution. | ||
6 | |||
5 | use std::mem; | 7 | use std::mem; |
6 | 8 | ||
7 | use hir::{DefWithBody, HasSource, ModuleSource, Semantics}; | 9 | use hir::{DefWithBody, HasSource, ModuleSource, Semantics}; |
@@ -38,6 +40,10 @@ pub enum ReferenceAccess { | |||
38 | Write, | 40 | Write, |
39 | } | 41 | } |
40 | 42 | ||
43 | /// Generally, `search_scope` returns files that might contain references for the element. | ||
44 | /// For `pub(crate)` things it's a crate, for `pub` things it's a crate and dependant crates. | ||
45 | /// In some cases, the location of the references is known to within a `TextRange`, | ||
46 | /// e.g. for things like local variables. | ||
41 | pub struct SearchScope { | 47 | pub struct SearchScope { |
42 | entries: FxHashMap<FileId, Option<TextRange>>, | 48 | entries: FxHashMap<FileId, Option<TextRange>>, |
43 | } | 49 | } |