Skip to content

Commit 0509a0a

Browse files
committed
Move Query
1 parent ad247aa commit 0509a0a

File tree

2 files changed

+42
-41
lines changed

2 files changed

+42
-41
lines changed

crates/ra_ide/src/ide_db/symbol_index.rs

Lines changed: 41 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,47 @@ use ra_syntax::{
4040
#[cfg(not(feature = "wasm"))]
4141
use rayon::prelude::*;
4242

43-
use crate::{ide_db::RootDatabase, Query};
43+
use crate::ide_db::RootDatabase;
44+
45+
#[derive(Debug)]
46+
pub struct Query {
47+
query: String,
48+
lowercased: String,
49+
only_types: bool,
50+
libs: bool,
51+
exact: bool,
52+
limit: usize,
53+
}
54+
55+
impl Query {
56+
pub fn new(query: String) -> Query {
57+
let lowercased = query.to_lowercase();
58+
Query {
59+
query,
60+
lowercased,
61+
only_types: false,
62+
libs: false,
63+
exact: false,
64+
limit: usize::max_value(),
65+
}
66+
}
67+
68+
pub fn only_types(&mut self) {
69+
self.only_types = true;
70+
}
71+
72+
pub fn libs(&mut self) {
73+
self.libs = true;
74+
}
75+
76+
pub fn exact(&mut self) {
77+
self.exact = true;
78+
}
79+
80+
pub fn limit(&mut self, limit: usize) {
81+
self.limit = limit
82+
}
83+
}
4484

4585
#[salsa::query_group(SymbolsDatabaseStorage)]
4686
pub(crate) trait SymbolsDatabase: hir::db::HirDatabase {

crates/ra_ide/src/lib.rs

Lines changed: 1 addition & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ pub use crate::{
7878
feature_flags::FeatureFlags,
7979
line_index::{LineCol, LineIndex},
8080
line_index_utils::translate_offset_with_edit,
81+
symbol_index::Query,
8182
},
8283
inlay_hints::{InlayHint, InlayKind},
8384
references::{
@@ -103,46 +104,6 @@ pub struct Diagnostic {
103104
pub severity: Severity,
104105
}
105106

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-
146107
/// Info associated with a text range.
147108
#[derive(Debug)]
148109
pub struct RangeInfo<T> {

0 commit comments

Comments
 (0)