aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/imp.rs
diff options
context:
space:
mode:
authorAleksey Kladov <[email protected]>2018-10-20 20:02:41 +0100
committerAleksey Kladov <[email protected]>2018-10-20 20:02:41 +0100
commit998f2ae7627053a9363a05a1ab79359882dce39f (patch)
tree6be2e60ebae8c03d117edec200aa942d810b3e31 /crates/ra_analysis/src/imp.rs
parentc4b0d3cd56ab68f4fa23f7c1f6c76f7f6148153e (diff)
remove job tokens
Diffstat (limited to 'crates/ra_analysis/src/imp.rs')
-rw-r--r--crates/ra_analysis/src/imp.rs16
1 files changed, 7 insertions, 9 deletions
diff --git a/crates/ra_analysis/src/imp.rs b/crates/ra_analysis/src/imp.rs
index 3a135ef13..4cfb681d8 100644
--- a/crates/ra_analysis/src/imp.rs
+++ b/crates/ra_analysis/src/imp.rs
@@ -148,14 +148,14 @@ impl AnalysisImpl {
148 pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> { 148 pub fn file_line_index(&self, file_id: FileId) -> Arc<LineIndex> {
149 self.root(file_id).lines(file_id) 149 self.root(file_id).lines(file_id)
150 } 150 }
151 pub fn world_symbols(&self, query: Query, token: &JobToken) -> Vec<(FileId, FileSymbol)> { 151 pub fn world_symbols(&self, query: Query) -> Vec<(FileId, FileSymbol)> {
152 let mut buf = Vec::new(); 152 let mut buf = Vec::new();
153 if query.libs { 153 if query.libs {
154 self.data.libs.iter().for_each(|it| it.symbols(&mut buf)); 154 self.data.libs.iter().for_each(|it| it.symbols(&mut buf));
155 } else { 155 } else {
156 self.data.root.symbols(&mut buf); 156 self.data.root.symbols(&mut buf);
157 } 157 }
158 query.search(&buf, token) 158 query.search(&buf)
159 } 159 }
160 pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> { 160 pub fn parent_module(&self, file_id: FileId) -> Cancelable<Vec<(FileId, FileSymbol)>> {
161 let root = self.root(file_id); 161 let root = self.root(file_id);
@@ -205,7 +205,6 @@ impl AnalysisImpl {
205 &self, 205 &self,
206 file_id: FileId, 206 file_id: FileId,
207 offset: TextUnit, 207 offset: TextUnit,
208 token: &JobToken,
209 ) -> Vec<(FileId, FileSymbol)> { 208 ) -> Vec<(FileId, FileSymbol)> {
210 let root = self.root(file_id); 209 let root = self.root(file_id);
211 let module_tree = root.module_tree(); 210 let module_tree = root.module_tree();
@@ -227,7 +226,7 @@ impl AnalysisImpl {
227 return vec; 226 return vec;
228 } else { 227 } else {
229 // If that fails try the index based approach. 228 // If that fails try the index based approach.
230 return self.index_resolve(name_ref, token); 229 return self.index_resolve(name_ref);
231 } 230 }
232 } 231 }
233 if let Some(name) = find_node_at_offset::<ast::Name>(syntax, offset) { 232 if let Some(name) = find_node_at_offset::<ast::Name>(syntax, offset) {
@@ -258,7 +257,7 @@ impl AnalysisImpl {
258 vec![] 257 vec![]
259 } 258 }
260 259
261 pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit, _token: &JobToken) -> Vec<(FileId, TextRange)> { 260 pub fn find_all_refs(&self, file_id: FileId, offset: TextUnit) -> Vec<(FileId, TextRange)> {
262 let root = self.root(file_id); 261 let root = self.root(file_id);
263 let file = root.syntax(file_id); 262 let file = root.syntax(file_id);
264 let syntax = file.syntax(); 263 let syntax = file.syntax();
@@ -380,7 +379,6 @@ impl AnalysisImpl {
380 &self, 379 &self,
381 file_id: FileId, 380 file_id: FileId,
382 offset: TextUnit, 381 offset: TextUnit,
383 token: &JobToken,
384 ) -> Option<(FnDescriptor, Option<usize>)> { 382 ) -> Option<(FnDescriptor, Option<usize>)> {
385 let root = self.root(file_id); 383 let root = self.root(file_id);
386 let file = root.syntax(file_id); 384 let file = root.syntax(file_id);
@@ -391,7 +389,7 @@ impl AnalysisImpl {
391 let name_ref = calling_node.name_ref()?; 389 let name_ref = calling_node.name_ref()?;
392 390
393 // Resolve the function's NameRef (NOTE: this isn't entirely accurate). 391 // Resolve the function's NameRef (NOTE: this isn't entirely accurate).
394 let file_symbols = self.index_resolve(name_ref, token); 392 let file_symbols = self.index_resolve(name_ref);
395 for (_, fs) in file_symbols { 393 for (_, fs) in file_symbols {
396 if fs.kind == FN_DEF { 394 if fs.kind == FN_DEF {
397 if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) { 395 if let Some(fn_def) = find_node_at_offset(syntax, fs.node_range.start()) {
@@ -442,12 +440,12 @@ impl AnalysisImpl {
442 None 440 None
443 } 441 }
444 442
445 fn index_resolve(&self, name_ref: ast::NameRef, token: &JobToken) -> Vec<(FileId, FileSymbol)> { 443 fn index_resolve(&self, name_ref: ast::NameRef) -> Vec<(FileId, FileSymbol)> {
446 let name = name_ref.text(); 444 let name = name_ref.text();
447 let mut query = Query::new(name.to_string()); 445 let mut query = Query::new(name.to_string());
448 query.exact(); 446 query.exact();
449 query.limit(4); 447 query.limit(4);
450 self.world_symbols(query, token) 448 self.world_symbols(query)
451 } 449 }
452 450
453 fn resolve_module( 451 fn resolve_module(