diff options
author | Jonas Schievink <[email protected]> | 2020-06-08 12:00:53 +0100 |
---|---|---|
committer | Jonas Schievink <[email protected]> | 2020-06-10 11:38:58 +0100 |
commit | 54936e8aa212ea5fdf737d8e1b0a02c231ed89eb (patch) | |
tree | ad5ea940cb9015a79992740d947ebbc8e00488cc /crates/ra_ide_db | |
parent | d50a1a0fe9055bf03b9746cb341b251af8e7b326 (diff) |
Fix the symbol query limit
Diffstat (limited to 'crates/ra_ide_db')
-rw-r--r-- | crates/ra_ide_db/src/symbol_index.rs | 7 |
1 files changed, 4 insertions, 3 deletions
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 { | |||
300 | let mut stream = op.union(); | 300 | let mut stream = op.union(); |
301 | let mut res = Vec::new(); | 301 | let mut res = Vec::new(); |
302 | while let Some((_, indexed_values)) = stream.next() { | 302 | while let Some((_, indexed_values)) = stream.next() { |
303 | if res.len() >= self.limit { | ||
304 | break; | ||
305 | } | ||
306 | for indexed_value in indexed_values { | 303 | for indexed_value in indexed_values { |
307 | let symbol_index = &indices[indexed_value.index]; | 304 | let symbol_index = &indices[indexed_value.index]; |
308 | let (start, end) = SymbolIndex::map_value_to_range(indexed_value.value); | 305 | let (start, end) = SymbolIndex::map_value_to_range(indexed_value.value); |
@@ -314,6 +311,10 @@ impl Query { | |||
314 | if self.exact && symbol.name != self.query { | 311 | if self.exact && symbol.name != self.query { |
315 | continue; | 312 | continue; |
316 | } | 313 | } |
314 | |||
315 | if res.len() >= self.limit { | ||
316 | return res; | ||
317 | } | ||
317 | res.push(symbol.clone()); | 318 | res.push(symbol.clone()); |
318 | } | 319 | } |
319 | } | 320 | } |