aboutsummaryrefslogtreecommitdiff
path: root/crates/libanalysis/src/symbol_index.rs
diff options
context:
space:
mode:
Diffstat (limited to 'crates/libanalysis/src/symbol_index.rs')
-rw-r--r--crates/libanalysis/src/symbol_index.rs32
1 files changed, 1 insertions, 31 deletions
diff --git a/crates/libanalysis/src/symbol_index.rs b/crates/libanalysis/src/symbol_index.rs
index 73cbf5702..cb35ab1d1 100644
--- a/crates/libanalysis/src/symbol_index.rs
+++ b/crates/libanalysis/src/symbol_index.rs
@@ -4,6 +4,7 @@ use libsyntax2::{
4 SyntaxKind::{self, *}, 4 SyntaxKind::{self, *},
5}; 5};
6use fst::{self, IntoStreamer, Streamer}; 6use fst::{self, IntoStreamer, Streamer};
7use Query;
7 8
8#[derive(Debug)] 9#[derive(Debug)]
9pub(crate) struct FileSymbols { 10pub(crate) struct FileSymbols {
@@ -30,38 +31,7 @@ impl FileSymbols {
30 } 31 }
31} 32}
32 33
33pub struct Query {
34 query: String,
35 lowercased: String,
36 only_types: bool,
37 exact: bool,
38 limit: usize,
39}
40
41impl Query { 34impl Query {
42 pub fn new(query: String) -> Query {
43 let lowercased = query.to_lowercase();
44 Query {
45 query,
46 lowercased,
47 only_types: false,
48 exact: false,
49 limit: usize::max_value()
50 }
51 }
52
53 pub fn only_types(&mut self) {
54 self.only_types = true;
55 }
56
57 pub fn exact(&mut self) {
58 self.exact = true;
59 }
60
61 pub fn limit(&mut self, limit: usize) {
62 self.limit = limit
63 }
64
65 pub(crate) fn process( 35 pub(crate) fn process(
66 &mut self, 36 &mut self,
67 file: &FileSymbols, 37 file: &FileSymbols,