aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_analysis/src/symbol_index.rs
diff options
context:
space:
mode:
authorbors[bot] <bors[bot]@users.noreply.github.com>2018-10-20 21:04:06 +0100
committerbors[bot] <bors[bot]@users.noreply.github.com>2018-10-20 21:04:06 +0100
commitfd336d1134d405d833b762101a25c00076bc7fd2 (patch)
tree040ab6dc1286ab9fe5da0002d29ae4eb7a37850a /crates/ra_analysis/src/symbol_index.rs
parent73dd870da2dcc991b0fdcdde8bee91f05cb9e182 (diff)
parent0102a01f76c855da447e25eb81191047a3ca79b8 (diff)
Merge #147
147: Cancelation r=matklad a=matklad This series of commits switch cancellation strategy from `JobToken` (which are cancellation tokens, explicitly controlled by the called) to salsa built-in auto cancellation. "Auto" means that, as soon as we advance the revision, all pending queries are cancelled automatically, and this looks like a semantic we actually want. "client-side" cancellation is a rare event, and it's ok to just punt on it. Automatic cancellation after the user types something in happens all the time. Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_analysis/src/symbol_index.rs')
-rw-r--r--crates/ra_analysis/src/symbol_index.rs14
1 files changed, 7 insertions, 7 deletions
diff --git a/crates/ra_analysis/src/symbol_index.rs b/crates/ra_analysis/src/symbol_index.rs
index 51eef8170..a0f3c0437 100644
--- a/crates/ra_analysis/src/symbol_index.rs
+++ b/crates/ra_analysis/src/symbol_index.rs
@@ -1,4 +1,8 @@
1use crate::{FileId, JobToken, Query}; 1use std::{
2 hash::{Hash, Hasher},
3 sync::Arc,
4};
5
2use fst::{self, Streamer}; 6use fst::{self, Streamer};
3use ra_editor::{file_symbols, FileSymbol}; 7use ra_editor::{file_symbols, FileSymbol};
4use ra_syntax::{ 8use ra_syntax::{
@@ -7,10 +11,7 @@ use ra_syntax::{
7}; 11};
8use rayon::prelude::*; 12use rayon::prelude::*;
9 13
10use std::{ 14use crate::{FileId, Query};
11 hash::{Hash, Hasher},
12 sync::Arc,
13};
14 15
15#[derive(Debug)] 16#[derive(Debug)]
16pub(crate) struct SymbolIndex { 17pub(crate) struct SymbolIndex {
@@ -59,7 +60,6 @@ impl Query {
59 pub(crate) fn search( 60 pub(crate) fn search(
60 self, 61 self,
61 indices: &[Arc<SymbolIndex>], 62 indices: &[Arc<SymbolIndex>],
62 token: &JobToken,
63 ) -> Vec<(FileId, FileSymbol)> { 63 ) -> Vec<(FileId, FileSymbol)> {
64 let mut op = fst::map::OpBuilder::new(); 64 let mut op = fst::map::OpBuilder::new();
65 for file_symbols in indices.iter() { 65 for file_symbols in indices.iter() {
@@ -69,7 +69,7 @@ impl Query {
69 let mut stream = op.union(); 69 let mut stream = op.union();
70 let mut res = Vec::new(); 70 let mut res = Vec::new();
71 while let Some((_, indexed_values)) = stream.next() { 71 while let Some((_, indexed_values)) = stream.next() {
72 if res.len() >= self.limit || token.is_canceled() { 72 if res.len() >= self.limit {
73 break; 73 break;
74 } 74 }
75 for indexed_value in indexed_values { 75 for indexed_value in indexed_values {