mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
make source_root API more abstract
This commit is contained in:
parent
3bdb456d17
commit
9ae455ea52
7 changed files with 31 additions and 17 deletions
|
@ -213,11 +213,11 @@ impl RootDatabase {
|
|||
durability,
|
||||
);
|
||||
self.set_file_source_root_with_durability(add_file.file_id, root_id, durability);
|
||||
source_root.files.insert(add_file.path, add_file.file_id);
|
||||
source_root.insert_file(add_file.path, add_file.file_id);
|
||||
}
|
||||
for remove_file in root_change.removed {
|
||||
self.set_file_text_with_durability(remove_file.file_id, Default::default(), durability);
|
||||
source_root.files.remove(&remove_file.path);
|
||||
source_root.remove_file(&remove_file.path);
|
||||
}
|
||||
self.set_source_root_with_durability(root_id, Arc::new(source_root), durability);
|
||||
}
|
||||
|
|
|
@ -87,7 +87,7 @@ pub(crate) fn world_symbols(db: &RootDatabase, query: Query) -> Vec<FileSymbol>
|
|||
let mut files = Vec::new();
|
||||
for &root in db.local_roots().iter() {
|
||||
let sr = db.source_root(root);
|
||||
files.extend(sr.files.values().copied())
|
||||
files.extend(sr.walk())
|
||||
}
|
||||
|
||||
let snap = Snap(db.snapshot());
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue