aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_batch
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_batch')
-rw-r--r--crates/ra_batch/src/lib.rs20
1 files changed, 14 insertions, 6 deletions
diff --git a/crates/ra_batch/src/lib.rs b/crates/ra_batch/src/lib.rs
index ffc9e16bb..a5fc2a23e 100644
--- a/crates/ra_batch/src/lib.rs
+++ b/crates/ra_batch/src/lib.rs
@@ -1,3 +1,5 @@
1//! FIXME: write short doc here
2
1use std::{collections::HashSet, error::Error, path::Path}; 3use std::{collections::HashSet, error::Error, path::Path};
2 4
3use rustc_hash::FxHashMap; 5use rustc_hash::FxHashMap;
@@ -5,7 +7,7 @@ use rustc_hash::FxHashMap;
5use crossbeam_channel::{unbounded, Receiver}; 7use crossbeam_channel::{unbounded, Receiver};
6use ra_db::{CrateGraph, FileId, SourceRootId}; 8use ra_db::{CrateGraph, FileId, SourceRootId};
7use ra_ide_api::{AnalysisChange, AnalysisHost, FeatureFlags}; 9use ra_ide_api::{AnalysisChange, AnalysisHost, FeatureFlags};
8use ra_project_model::{PackageRoot, ProjectWorkspace}; 10use ra_project_model::{get_rustc_cfg_options, PackageRoot, ProjectWorkspace};
9use ra_vfs::{RootEntry, Vfs, VfsChange, VfsTask, Watch}; 11use ra_vfs::{RootEntry, Vfs, VfsChange, VfsTask, Watch};
10use ra_vfs_glob::RustPackageFilterBuilder; 12use ra_vfs_glob::RustPackageFilterBuilder;
11 13
@@ -39,11 +41,17 @@ pub fn load_cargo(root: &Path) -> Result<(AnalysisHost, FxHashMap<SourceRootId,
39 sender, 41 sender,
40 Watch(false), 42 Watch(false),
41 ); 43 );
42 let (crate_graph, _crate_names) = ws.to_crate_graph(&mut |path: &Path| { 44
43 let vfs_file = vfs.load(path); 45 // FIXME: cfg options?
44 log::debug!("vfs file {:?} -> {:?}", path, vfs_file); 46 let default_cfg_options =
45 vfs_file.map(vfs_file_to_id) 47 get_rustc_cfg_options().atom("test".into()).atom("debug_assertion".into());
46 }); 48
49 let (crate_graph, _crate_names) =
50 ws.to_crate_graph(&default_cfg_options, &mut |path: &Path| {
51 let vfs_file = vfs.load(path);
52 log::debug!("vfs file {:?} -> {:?}", path, vfs_file);
53 vfs_file.map(vfs_file_to_id)
54 });
47 log::debug!("crate graph: {:?}", crate_graph); 55 log::debug!("crate graph: {:?}", crate_graph);
48 56
49 let source_roots = roots 57 let source_roots = roots