mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-26 11:59:49 +00:00
Remove limit from symbol_index::Query
This commit is contained in:
parent
0af780ea3e
commit
2666349392
8 changed files with 10 additions and 29 deletions
|
@ -414,11 +414,12 @@ impl Analysis {
|
|||
}
|
||||
|
||||
/// Fuzzy searches for a symbol.
|
||||
pub fn symbol_search(&self, query: Query) -> Cancellable<Vec<NavigationTarget>> {
|
||||
pub fn symbol_search(&self, query: Query, limit: usize) -> Cancellable<Vec<NavigationTarget>> {
|
||||
self.with_db(|db| {
|
||||
symbol_index::world_symbols(db, query)
|
||||
.into_iter() // xx: should we make this a par iter?
|
||||
.filter_map(|s| s.try_to_nav(db))
|
||||
.take(limit)
|
||||
.map(UpmappingResult::call_site)
|
||||
.collect::<Vec<_>>()
|
||||
})
|
||||
|
|
|
@ -860,7 +860,7 @@ fn foo() { enum FooInner { } }
|
|||
"#,
|
||||
);
|
||||
|
||||
let navs = analysis.symbol_search(Query::new("FooInner".to_string())).unwrap();
|
||||
let navs = analysis.symbol_search(Query::new("FooInner".to_string()), !0).unwrap();
|
||||
expect![[r#"
|
||||
[
|
||||
NavigationTarget {
|
||||
|
@ -898,7 +898,7 @@ struct Foo;
|
|||
"#,
|
||||
);
|
||||
|
||||
let navs = analysis.symbol_search(Query::new("foo".to_string())).unwrap();
|
||||
let navs = analysis.symbol_search(Query::new("foo".to_string()), !0).unwrap();
|
||||
assert_eq!(navs.len(), 2)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue