@@ -11,8 +11,10 @@ use std::collections::HashMap;
11
11
use std:: env;
12
12
use std:: path:: { Path , PathBuf } ;
13
13
use std:: str;
14
+ use std:: sync:: Arc ;
14
15
15
16
use analysis:: { AnalysisHost , Id , Target } ;
17
+ use config:: Config ;
16
18
use span;
17
19
use vfs:: Vfs ;
18
20
@@ -32,6 +34,7 @@ use file_controller::results::{
32
34
} ;
33
35
34
36
pub struct Cache {
37
+ config : Arc < Config > ,
35
38
files : Vfs < VfsUserData > ,
36
39
analysis : AnalysisHost ,
37
40
project_dir : PathBuf ,
@@ -62,8 +65,9 @@ macro_rules! vfs_err {
62
65
}
63
66
64
67
impl Cache {
65
- pub fn new ( ) -> Cache {
68
+ pub fn new ( config : Arc < Config > ) -> Cache {
66
69
Cache {
70
+ config,
67
71
files : Vfs :: new ( ) ,
68
72
analysis : AnalysisHost :: new ( Target :: Debug ) ,
69
73
project_dir : env:: current_dir ( ) . unwrap ( ) ,
@@ -138,8 +142,14 @@ impl Cache {
138
142
139
143
pub fn update_analysis ( & self ) {
140
144
println ! ( "Processing analysis..." ) ;
145
+ let workspace_root = self
146
+ . config
147
+ . workspace_root
148
+ . as_ref ( )
149
+ . map ( |s| Path :: new ( s) . to_owned ( ) )
150
+ . unwrap_or ( self . project_dir . clone ( ) ) ;
141
151
self . analysis
142
- . reload_with_blacklist ( & self . project_dir , & self . project_dir , & :: blacklist:: CRATE_BLACKLIST )
152
+ . reload_with_blacklist ( & self . project_dir , & workspace_root , & :: blacklist:: CRATE_BLACKLIST )
143
153
. unwrap ( ) ;
144
154
145
155
// FIXME Possibly extreme, could invalidate by crate or by file. Also, only
0 commit comments