diff options
author | bors[bot] <26634292+bors[bot]@users.noreply.github.com> | 2020-01-11 20:41:41 +0000 |
---|---|---|
committer | GitHub <[email protected]> | 2020-01-11 20:41:41 +0000 |
commit | 3924c7de505b591d3e1281857a61713fbe308d59 (patch) | |
tree | 2bab7953c6fb1d089ce2acaf7b646adc4921b128 /crates/ra_lsp_server | |
parent | 867081220921c1c593f11866bbdba8b845090c07 (diff) | |
parent | 8e778f9842123e1f688a2632d99e439821801bd2 (diff) |
Merge #2791
2791: Slightly more robust cargo watcher root search r=kiljacken a=kiljacken
Fixes #2780 (hopefully).
Use the already painstakingly found `workspaces` instead of naively using `folder_roots` from editor.
Co-authored-by: Emil Lauridsen <[email protected]>
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r-- | crates/ra_lsp_server/src/world.rs | 16 |
1 files changed, 14 insertions, 2 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs index 121ddfd1f..c0175c726 100644 --- a/crates/ra_lsp_server/src/world.rs +++ b/crates/ra_lsp_server/src/world.rs | |||
@@ -132,8 +132,20 @@ impl WorldState { | |||
132 | change.set_crate_graph(crate_graph); | 132 | change.set_crate_graph(crate_graph); |
133 | 133 | ||
134 | // FIXME: Figure out the multi-workspace situation | 134 | // FIXME: Figure out the multi-workspace situation |
135 | let check_watcher = | 135 | let check_watcher = workspaces |
136 | CheckWatcher::new(&options.cargo_watch, folder_roots.first().cloned().unwrap()); | 136 | .iter() |
137 | .find_map(|w| match w { | ||
138 | ProjectWorkspace::Cargo { cargo, .. } => Some(cargo), | ||
139 | ProjectWorkspace::Json { .. } => None, | ||
140 | }) | ||
141 | .map(|cargo| { | ||
142 | let cargo_project_root = cargo.workspace_root().to_path_buf(); | ||
143 | CheckWatcher::new(&options.cargo_watch, cargo_project_root) | ||
144 | }) | ||
145 | .unwrap_or_else(|| { | ||
146 | log::warn!("Cargo check watching only supported for cargo workspaces, disabling"); | ||
147 | CheckWatcher::dummy() | ||
148 | }); | ||
137 | 149 | ||
138 | let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags); | 150 | let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags); |
139 | analysis_host.apply_change(change); | 151 | analysis_host.apply_change(change); |