Pull enabled check up

This commit is contained in:
Aleksey Kladov 2020-04-01 11:01:37 +02:00
parent fae6cecf54
commit dda942debe
3 changed files with 12 additions and 11 deletions

View File

@ -24,7 +24,6 @@
#[derive(Clone, Debug)]
pub struct CheckConfig {
pub enable: bool,
pub args: Vec<String>,
pub command: String,
pub all_targets: bool,
@ -216,9 +215,6 @@ fn restart_check_process(&mut self) {
// First, clear and cancel the old thread
self.message_recv = never();
self.check_process = None;
if !self.options.enable {
return;
}
let mut args: Vec<String> = vec![
self.options.command.clone(),

View File

@ -101,11 +101,14 @@ fn get_config(
chaining_hints: config.inlay_hints_chaining,
max_length: config.inlay_hints_max_length,
},
check: CheckConfig {
enable: config.cargo_watch_enable,
args: config.cargo_watch_args.clone(),
command: config.cargo_watch_command.clone(),
all_targets: config.cargo_watch_all_targets,
check: if config.cargo_watch_enable {
Some(CheckConfig {
args: config.cargo_watch_args.clone(),
command: config.cargo_watch_command.clone(),
all_targets: config.cargo_watch_all_targets,
})
} else {
None
},
rustfmt_args: config.rustfmt_args.clone(),
vscode_lldb: config.vscode_lldb,

View File

@ -32,6 +32,8 @@
use rustc_hash::{FxHashMap, FxHashSet};
fn create_watcher(workspaces: &[ProjectWorkspace], config: &Config) -> Option<CheckWatcher> {
let check_config = config.check.as_ref()?;
// FIXME: Figure out the multi-workspace situation
workspaces
.iter()
@ -41,7 +43,7 @@ fn create_watcher(workspaces: &[ProjectWorkspace], config: &Config) -> Option<Ch
})
.map(|cargo| {
let cargo_project_root = cargo.workspace_root().to_path_buf();
Some(CheckWatcher::new(config.check.clone(), cargo_project_root))
Some(CheckWatcher::new(check_config.clone(), cargo_project_root))
})
.unwrap_or_else(|| {
log::warn!("Cargo check watching only supported for cargo workspaces, disabling");
@ -56,7 +58,7 @@ pub struct Config {
pub line_folding_only: bool,
pub inlay_hints: InlayHintsConfig,
pub rustfmt_args: Vec<String>,
pub check: CheckConfig,
pub check: Option<CheckConfig>,
pub vscode_lldb: bool,
pub proc_macro_srv: Option<String>,
}