Unnamed repository; edit this file 'description' to name the repository.
Merge pull request #20497 from ChayimFriedman2/symbols-attach2
Attach the DB when mapping the result of `world_symbols()`
Chayim Refael Friedman 8 months ago
parent 75ce5dc · parent 7a27a27 · commit a161fd6
-rw-r--r--crates/ide/src/lib.rs15
1 files changed, 9 insertions, 6 deletions
diff --git a/crates/ide/src/lib.rs b/crates/ide/src/lib.rs
index 874e04702e..4b93535c89 100644
--- a/crates/ide/src/lib.rs
+++ b/crates/ide/src/lib.rs
@@ -481,12 +481,15 @@ impl Analysis {
// `world_symbols` currently clones the database to run stuff in parallel, which will make any query panic
// if we were to attach it here.
Cancelled::catch(|| {
- symbol_index::world_symbols(&self.db, query)
- .into_iter()
- .filter_map(|s| s.try_to_nav(&self.db))
- .take(limit)
- .map(UpmappingResult::call_site)
- .collect::<Vec<_>>()
+ let symbols = symbol_index::world_symbols(&self.db, query);
+ salsa::attach(&self.db, || {
+ symbols
+ .into_iter()
+ .filter_map(|s| s.try_to_nav(&self.db))
+ .take(limit)
+ .map(UpmappingResult::call_site)
+ .collect::<Vec<_>>()
+ })
})
}