Skip to content

Commit 132ba6d

Browse files
committed
Use the workspace root for rls-analysis prefix, not the project dir
1 parent 751686c commit 132ba6d

File tree

2 files changed

+14
-4
lines changed

2 files changed

+14
-4
lines changed

src/file_controller/mod.rs

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,10 @@ use std::collections::HashMap;
1111
use std::env;
1212
use std::path::{Path, PathBuf};
1313
use std::str;
14+
use std::sync::Arc;
1415

1516
use analysis::{AnalysisHost, Id, Target};
17+
use config::Config;
1618
use span;
1719
use vfs::Vfs;
1820

@@ -32,6 +34,7 @@ use file_controller::results::{
3234
};
3335

3436
pub struct Cache {
37+
config: Arc<Config>,
3538
files: Vfs<VfsUserData>,
3639
analysis: AnalysisHost,
3740
project_dir: PathBuf,
@@ -62,8 +65,9 @@ macro_rules! vfs_err {
6265
}
6366

6467
impl Cache {
65-
pub fn new() -> Cache {
68+
pub fn new(config: Arc<Config>) -> Cache {
6669
Cache {
70+
config,
6771
files: Vfs::new(),
6872
analysis: AnalysisHost::new(Target::Debug),
6973
project_dir: env::current_dir().unwrap(),
@@ -138,8 +142,14 @@ impl Cache {
138142

139143
pub fn update_analysis(&self) {
140144
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());
141151
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)
143153
.unwrap();
144154

145155
// FIXME Possibly extreme, could invalidate by crate or by file. Also, only

src/server.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -56,8 +56,8 @@ impl Server {
5656

5757
let mut instance = Server {
5858
builder: build::Builder::new(config.clone(), build_args),
59-
config: config,
60-
file_cache: Arc::new(Cache::new()),
59+
file_cache: Arc::new(Cache::new(config.clone())),
60+
config,
6161
status: Status::new(),
6262
};
6363

0 commit comments

Comments
 (0)