mirror of
https://github.com/rust-lang/rust-analyzer.git
synced 2025-10-01 11:31:15 +00:00
Disable cargo checking in workspaces with no cargo projects
This commit is contained in:
parent
d6da18e99d
commit
480c44918c
@ -58,6 +58,12 @@ impl CheckWatcher {
|
|||||||
CheckWatcher { task_recv, cmd_send: Some(cmd_send), handle: Some(handle), shared }
|
CheckWatcher { task_recv, cmd_send: Some(cmd_send), handle: Some(handle), shared }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a CheckWatcher that doesn't actually do anything
|
||||||
|
pub fn dummy() -> CheckWatcher {
|
||||||
|
let shared = Arc::new(RwLock::new(CheckWatcherSharedState::new()));
|
||||||
|
CheckWatcher { task_recv: never(), cmd_send: None, handle: None, shared }
|
||||||
|
}
|
||||||
|
|
||||||
/// Schedule a re-start of the cargo check worker.
|
/// Schedule a re-start of the cargo check worker.
|
||||||
pub fn update(&self) {
|
pub fn update(&self) {
|
||||||
if let Some(cmd_send) = &self.cmd_send {
|
if let Some(cmd_send) = &self.cmd_send {
|
||||||
|
@ -132,20 +132,20 @@ impl WorldState {
|
|||||||
change.set_crate_graph(crate_graph);
|
change.set_crate_graph(crate_graph);
|
||||||
|
|
||||||
// FIXME: Figure out the multi-workspace situation
|
// FIXME: Figure out the multi-workspace situation
|
||||||
let check_watcher = {
|
let check_watcher = workspaces
|
||||||
let first_workspace = workspaces.first().unwrap();
|
.iter()
|
||||||
let cargo_project_root = match first_workspace {
|
.find_map(|w| match w {
|
||||||
ProjectWorkspace::Cargo { cargo, .. } => cargo.workspace_root().to_path_buf(),
|
ProjectWorkspace::Cargo { cargo, .. } => Some(cargo),
|
||||||
ProjectWorkspace::Json { .. } => {
|
ProjectWorkspace::Json { .. } => None,
|
||||||
log::warn!(
|
})
|
||||||
"Cargo check watching only supported for cargo workspaces, disabling"
|
.map(|cargo| {
|
||||||
);
|
let cargo_project_root = cargo.workspace_root().to_path_buf();
|
||||||
options.cargo_watch.enable = false;
|
CheckWatcher::new(&options.cargo_watch, cargo_project_root)
|
||||||
PathBuf::new()
|
})
|
||||||
}
|
.unwrap_or_else(|| {
|
||||||
};
|
log::warn!("Cargo check watching only supported for cargo workspaces, disabling");
|
||||||
CheckWatcher::new(&options.cargo_watch, cargo_project_root)
|
CheckWatcher::dummy()
|
||||||
};
|
});
|
||||||
|
|
||||||
let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags);
|
let mut analysis_host = AnalysisHost::new(lru_capacity, feature_flags);
|
||||||
analysis_host.apply_change(change);
|
analysis_host.apply_change(change);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user