mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-28 12:54:58 +00:00
use salsa's LRU for syntax trees
This commit is contained in:
parent
80aa9d5f9f
commit
fc2658b074
5 changed files with 11 additions and 7 deletions
|
@ -7,7 +7,7 @@ use std::collections::HashSet;
|
|||
use rustc_hash::FxHashMap;
|
||||
|
||||
use ra_db::{
|
||||
CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa,
|
||||
CrateGraph, FileId, SourceRoot, SourceRootId, SourceDatabase, salsa::{self, Database},
|
||||
};
|
||||
use ra_hir::db;
|
||||
use ra_project_model::ProjectWorkspace;
|
||||
|
@ -43,6 +43,8 @@ fn vfs_root_to_id(r: ra_vfs::VfsRoot) -> SourceRootId {
|
|||
impl BatchDatabase {
|
||||
pub fn load(crate_graph: CrateGraph, vfs: &mut Vfs) -> BatchDatabase {
|
||||
let mut db = BatchDatabase { runtime: salsa::Runtime::default() };
|
||||
db.query_mut(ra_db::ParseQuery).set_lru_capacity(128);
|
||||
db.query_mut(ra_hir::db::ParseMacroQuery).set_lru_capacity(128);
|
||||
db.set_crate_graph(Arc::new(crate_graph));
|
||||
|
||||
// wait until Vfs has loaded all roots
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue