diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2019-08-19 13:42:06 +0100 |
---|---|---|
committer | GitHub <[email protected]> | 2019-08-19 13:42:06 +0100 |
commit | c7d37e424f1e04f87982233f97e1e9385191b7f1 (patch) | |
tree | 90a43945782c23458a56a5c01f4adf4586b0ca85 /crates/ra_lsp_server/src | |
parent | 3ba9bc493fad9270dac74250d0b557495fe7d109 (diff) | |
parent | 7cd9b1dd7a91fb3b1e400fd4b47333c9699381f7 (diff) |
Merge #1703
1703: don't load sysroot in most heavy tests r=matklad a=matklad
Co-authored-by: Aleksey Kladov <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r-- | crates/ra_lsp_server/src/config.rs | 5 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/main_loop.rs | 2 | ||||
-rw-r--r-- | crates/ra_lsp_server/src/project_model.rs | 6 |
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 | ||
26 | impl Default for ServerConfig { | 30 | impl 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 | ||
11 | pub fn workspace_loader() -> Worker<PathBuf, Result<ProjectWorkspace>> { | 11 | pub 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 | }, |