From 54936e8aa212ea5fdf737d8e1b0a02c231ed89eb Mon Sep 17 00:00:00 2001 From: Jonas Schievink Date: Mon, 8 Jun 2020 13:00:53 +0200 Subject: Fix the symbol query limit --- crates/ra_ide_db/src/symbol_index.rs | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) (limited to 'crates/ra_ide_db') diff --git a/crates/ra_ide_db/src/symbol_index.rs b/crates/ra_ide_db/src/symbol_index.rs index 299b47c6a..78c714356 100644 --- a/crates/ra_ide_db/src/symbol_index.rs +++ b/crates/ra_ide_db/src/symbol_index.rs @@ -300,9 +300,6 @@ impl Query { let mut stream = op.union(); let mut res = Vec::new(); while let Some((_, indexed_values)) = stream.next() { - if res.len() >= self.limit { - break; - } for indexed_value in indexed_values { let symbol_index = &indices[indexed_value.index]; let (start, end) = SymbolIndex::map_value_to_range(indexed_value.value); @@ -314,6 +311,10 @@ impl Query { if self.exact && symbol.name != self.query { continue; } + + if res.len() >= self.limit { + return res; + } res.push(symbol.clone()); } } -- cgit v1.2.3