aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--crates/ra_lsp_server/src/world.rs18
-rw-r--r--crates/ra_project_model/src/cargo_workspace.rs2
2 files changed, 16 insertions, 4 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index 121ddfd1f..36b5242d1 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -74,7 +74,7 @@ impl WorldState {
74 lru_capacity: Option<usize>, 74 lru_capacity: Option<usize>,
75 exclude_globs: &[Glob], 75 exclude_globs: &[Glob],
76 watch: Watch, 76 watch: Watch,
77 options: Options, 77 mut options: Options,
78 feature_flags: FeatureFlags, 78 feature_flags: FeatureFlags,
79 ) -> WorldState { 79 ) -> WorldState {
80 let mut change = AnalysisChange::new(); 80 let mut change = AnalysisChange::new();
@@ -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 = {
136 CheckWatcher::new(&options.cargo_watch, folder_roots.first().cloned().unwrap()); 136 let first_workspace = workspaces.first().unwrap();
137 let cargo_project_root = match first_workspace {
138 ProjectWorkspace::Cargo { cargo, .. } => cargo.workspace_root.clone(),
139 ProjectWorkspace::Json { .. } => {
140 log::warn!(
141 "Cargo check watching only supported for cargo workspaces, disabling"
142 );
143 options.cargo_watch.enable = false;
144 PathBuf::new()
145 }
146 };
147 CheckWatcher::new(&options.cargo_watch, cargo_project_root)
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);
diff --git a/crates/ra_project_model/src/cargo_workspace.rs b/crates/ra_project_model/src/cargo_workspace.rs
index 1b3c246c7..18c2f11b7 100644
--- a/crates/ra_project_model/src/cargo_workspace.rs
+++ b/crates/ra_project_model/src/cargo_workspace.rs
@@ -21,7 +21,7 @@ use crate::Result;
21pub struct CargoWorkspace { 21pub struct CargoWorkspace {
22 packages: Arena<Package, PackageData>, 22 packages: Arena<Package, PackageData>,
23 targets: Arena<Target, TargetData>, 23 targets: Arena<Target, TargetData>,
24 pub(crate) workspace_root: PathBuf, 24 pub workspace_root: PathBuf,
25} 25}
26 26
27#[derive(Deserialize, Clone, Debug, PartialEq, Eq)] 27#[derive(Deserialize, Clone, Debug, PartialEq, Eq)]