mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-09-30 05:45:12 +00:00
Add support for environment to CrateGraph
This commit is contained in:
parent
5be7bd605a
commit
2c48fa087b
7 changed files with 79 additions and 28 deletions
|
@ -54,7 +54,7 @@ use std::sync::Arc;
|
|||
use ra_cfg::CfgOptions;
|
||||
use ra_db::{
|
||||
salsa::{self, ParallelDatabase},
|
||||
CheckCanceled, FileLoader, SourceDatabase,
|
||||
CheckCanceled, Env, FileLoader, SourceDatabase,
|
||||
};
|
||||
use ra_syntax::{SourceFile, TextRange, TextUnit};
|
||||
|
||||
|
@ -240,7 +240,7 @@ impl Analysis {
|
|||
// Default to enable test for single file.
|
||||
let mut cfg_options = CfgOptions::default();
|
||||
cfg_options.insert_atom("test".into());
|
||||
crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options);
|
||||
crate_graph.add_crate_root(file_id, Edition::Edition2018, cfg_options, Env::default());
|
||||
change.add_file(source_root, file_id, "main.rs".into(), Arc::new(text));
|
||||
change.set_crate_graph(crate_graph);
|
||||
host.apply_change(change);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue