diff options
author | Aleksey Kladov <[email protected]> | 2020-02-06 11:24:13 +0000 |
---|---|---|
committer | Aleksey Kladov <[email protected]> | 2020-02-06 11:24:13 +0000 |
commit | 0509a0a34e9b171d7ed7ea3e2a706c85c9b69433 (patch) | |
tree | a1ae6c63bd2d849a18069981115b7b6f5305747a /crates/ra_ide/src/lib.rs | |
parent | ad247aa67061f4dcba85e20b82ca47e9a86eff56 (diff) |
Move Query
Diffstat (limited to 'crates/ra_ide/src/lib.rs')
-rw-r--r-- | crates/ra_ide/src/lib.rs | 41 |
1 files changed, 1 insertions, 40 deletions
diff --git a/crates/ra_ide/src/lib.rs b/crates/ra_ide/src/lib.rs index 3926bc00f..109b5ad9f 100644 --- a/crates/ra_ide/src/lib.rs +++ b/crates/ra_ide/src/lib.rs | |||
@@ -78,6 +78,7 @@ pub use crate::{ | |||
78 | feature_flags::FeatureFlags, | 78 | feature_flags::FeatureFlags, |
79 | line_index::{LineCol, LineIndex}, | 79 | line_index::{LineCol, LineIndex}, |
80 | line_index_utils::translate_offset_with_edit, | 80 | line_index_utils::translate_offset_with_edit, |
81 | symbol_index::Query, | ||
81 | }, | 82 | }, |
82 | inlay_hints::{InlayHint, InlayKind}, | 83 | inlay_hints::{InlayHint, InlayKind}, |
83 | references::{ | 84 | references::{ |
@@ -103,46 +104,6 @@ pub struct Diagnostic { | |||
103 | pub severity: Severity, | 104 | pub severity: Severity, |
104 | } | 105 | } |
105 | 106 | ||
106 | #[derive(Debug)] | ||
107 | pub struct Query { | ||
108 | query: String, | ||
109 | lowercased: String, | ||
110 | only_types: bool, | ||
111 | libs: bool, | ||
112 | exact: bool, | ||
113 | limit: usize, | ||
114 | } | ||
115 | |||
116 | impl Query { | ||
117 | pub fn new(query: String) -> Query { | ||
118 | let lowercased = query.to_lowercase(); | ||
119 | Query { | ||
120 | query, | ||
121 | lowercased, | ||
122 | only_types: false, | ||
123 | libs: false, | ||
124 | exact: false, | ||
125 | limit: usize::max_value(), | ||
126 | } | ||
127 | } | ||
128 | |||
129 | pub fn only_types(&mut self) { | ||
130 | self.only_types = true; | ||
131 | } | ||
132 | |||
133 | pub fn libs(&mut self) { | ||
134 | self.libs = true; | ||
135 | } | ||
136 | |||
137 | pub fn exact(&mut self) { | ||
138 | self.exact = true; | ||
139 | } | ||
140 | |||
141 | pub fn limit(&mut self, limit: usize) { | ||
142 | self.limit = limit | ||
143 | } | ||
144 | } | ||
145 | |||
146 | /// Info associated with a text range. | 107 | /// Info associated with a text range. |
147 | #[derive(Debug)] | 108 | #[derive(Debug)] |
148 | pub struct RangeInfo<T> { | 109 | pub struct RangeInfo<T> { |