aboutsummaryrefslogtreecommitdiff
path: root/crates/ra_lsp_server
diff options
context:
space:
mode:
authorEmil Lauridsen <[email protected]>2020-01-11 20:32:40 +0000
committerEmil Lauridsen <[email protected]>2020-01-11 20:32:40 +0000
commit480c44918c73922b134b670cbd33014b8fcfc883 (patch)
treed26ccf2d4cce9639b6f7b3373734d989c8861ba0 /crates/ra_lsp_server
parentd6da18e99d2fb4e67e3bc7503059282b5e14bd13 (diff)
Disable cargo checking in workspaces with no cargo projects
Diffstat (limited to 'crates/ra_lsp_server')
-rw-r--r--crates/ra_lsp_server/src/world.rs28
1 files changed, 14 insertions, 14 deletions
diff --git a/crates/ra_lsp_server/src/world.rs b/crates/ra_lsp_server/src/world.rs
index cea18937f..a52bd2633 100644
--- a/crates/ra_lsp_server/src/world.rs
+++ b/crates/ra_lsp_server/src/world.rs
@@ -132,20 +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 let first_workspace = workspaces.first().unwrap(); 136 .iter()
137 let cargo_project_root = match first_workspace { 137 .find_map(|w| match w {
138 ProjectWorkspace::Cargo { cargo, .. } => cargo.workspace_root().to_path_buf(), 138 ProjectWorkspace::Cargo { cargo, .. } => Some(cargo),
139 ProjectWorkspace::Json { .. } => { 139 ProjectWorkspace::Json { .. } => None,
140 log::warn!( 140 })
141 "Cargo check watching only supported for cargo workspaces, disabling" 141 .map(|cargo| {
142 ); 142 let cargo_project_root = cargo.workspace_root().to_path_buf();
143 options.cargo_watch.enable = false; 143 CheckWatcher::new(&options.cargo_watch, cargo_project_root)
144 PathBuf::new() 144 })
145 } 145 .unwrap_or_else(|| {
146 }; 146 log::warn!("Cargo check watching only supported for cargo workspaces, disabling");
147 CheckWatcher::new(&options.cargo_watch, cargo_project_root) 147 CheckWatcher::dummy()
148 }; 148 });
149 149
150 let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags); 150 let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags);
151 analysis_host.apply_change(change); 151 analysis_host.apply_change(change);