Add an ra_cli command that analyses all crates in the current workspace

... and prints various stats about how many expressions have a type etc.
This commit is contained in:
Florian Diebold 2019-02-09 18:27:11 +01:00
parent 43e52ac9e2
commit 6964a88e8c
9 changed files with 227 additions and 4 deletions

View file

@ -60,7 +60,11 @@ impl BatchDatabase {
match change {
VfsChange::AddRoot { root, files } => {
let source_root_id = vfs_root_to_id(root);
log::debug!("loaded source root {:?} with path {:?}", source_root_id, vfs.root2path(root));
log::debug!(
"loaded source root {:?} with path {:?}",
source_root_id,
vfs.root2path(root)
);
let mut file_map = FxHashMap::default();
for (vfs_file, path, text) in files {
let file_id = vfs_file_to_id(vfs_file);
@ -111,7 +115,8 @@ impl BatchDatabase {
let crate_graph = ws.to_crate_graph(&mut load);
log::debug!("crate graph: {:?}", crate_graph);
let local_roots = roots.into_iter()
let local_roots = roots
.into_iter()
.filter(|r| vfs.root2path(*r).starts_with(&root))
.map(vfs_root_to_id)
.collect();