aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/config.rs5
-rw-r--r--crates/ra_lsp_server/src/main_loop.rs2
-rw-r--r--crates/ra_lsp_server/src/project_model.rs6
3 files changed, 9 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/config.rs b/crates/ra_lsp_server/src/config.rs
index 6dcdc695a..71838b89c 100644
--- a/crates/ra_lsp_server/src/config.rs
+++ b/crates/ra_lsp_server/src/config.rs
@@ -21,6 +21,10 @@ pub struct ServerConfig {
21 pub exclude_globs: Vec<String>, 21 pub exclude_globs: Vec<String>,
22 22
23 pub lru_capacity: Option<usize>, 23 pub lru_capacity: Option<usize>,
24
25 /// For internal usage to make integrated tests faster.
26 #[serde(deserialize_with = "nullable_bool_true")]
27 pub with_sysroot: bool,
24} 28}
25 29
26impl Default for ServerConfig { 30impl Default for ServerConfig {
@@ -30,6 +34,7 @@ impl Default for ServerConfig {
30 show_workspace_loaded: true, 34 show_workspace_loaded: true,
31 exclude_globs: Vec::new(), 35 exclude_globs: Vec::new(),
32 lru_capacity: None, 36 lru_capacity: None,
37 with_sysroot: true,
33 } 38 }
34 } 39 }
35} 40}
diff --git a/crates/ra_lsp_server/src/main_loop.rs b/crates/ra_lsp_server/src/main_loop.rs
index b9c99a223..3ee0ad652 100644
--- a/crates/ra_lsp_server/src/main_loop.rs
+++ b/crates/ra_lsp_server/src/main_loop.rs
@@ -59,7 +59,7 @@ pub fn main_loop(
59 log::debug!("server_config: {:?}", config); 59 log::debug!("server_config: {:?}", config);
60 // FIXME: support dynamic workspace loading. 60 // FIXME: support dynamic workspace loading.
61 let workspaces = { 61 let workspaces = {
62 let ws_worker = workspace_loader(); 62 let ws_worker = workspace_loader(config.with_sysroot);
63 let mut loaded_workspaces = Vec::new(); 63 let mut loaded_workspaces = Vec::new();
64 for ws_root in &ws_roots { 64 for ws_root in &ws_roots {
65 ws_worker.sender().send(ws_root.clone()).unwrap(); 65 ws_worker.sender().send(ws_root.clone()).unwrap();
diff --git a/crates/ra_lsp_server/src/project_model.rs b/crates/ra_lsp_server/src/project_model.rs
index 1130d08de..ad59cde64 100644
--- a/crates/ra_lsp_server/src/project_model.rs
+++ b/crates/ra_lsp_server/src/project_model.rs
@@ -8,14 +8,14 @@ pub use ra_project_model::{
8 CargoWorkspace, Package, ProjectWorkspace, Sysroot, Target, TargetKind, 8 CargoWorkspace, Package, ProjectWorkspace, Sysroot, Target, TargetKind,
9}; 9};
10 10
11pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> { 11pub fn workspace_loader(with_sysroot: bool) -> Worker<PathBuf, Result<ProjectWorkspace>> {
12 Worker::<PathBuf, Result<ProjectWorkspace>>::spawn( 12 Worker::<PathBuf, Result<ProjectWorkspace>>::spawn(
13 "workspace loader", 13 "workspace loader",
14 1, 14 1,
15 |input_receiver, output_sender| { 15 move |input_receiver, output_sender| {
16 input_receiver 16 input_receiver
17 .into_iter() 17 .into_iter()
18 .map(|path| ProjectWorkspace::discover(path.as_path())) 18 .map(|path| ProjectWorkspace::discover_with_sysroot(path.as_path(), with_sysroot))
19 .try_for_each(|it| output_sender.send(it)) 19 .try_for_each(|it| output_sender.send(it))
20 .unwrap() 20 .unwrap()
21 }, 21 },