aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server/src
diff options
context:
space:
mode:
authorEmil Lauridsen <[email protected]>2020-01-10 21:10:26 +0000
committerEmil Lauridsen <[email protected]>2020-01-10 21:10:26 +0000
commit1d1eea217d5b674e6cad77704f912a3a76505d70 (patch)
treefadc5665683d934acea2bc21c0ff2bbde5f255c2 /crates/ra_lsp_server/src
parent19eb7fa1db7da8417314ddfafe7addbbd9c3b46a (diff)
Slightly more robust cargo watcher root search
Diffstat (limited to 'crates/ra_lsp_server/src')
-rw-r--r--crates/ra_lsp_server/src/world.rs18
1 files changed, 15 insertions, 3 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);