Add support of runnables arguments in Rust Analyzer

This commit is contained in:
Igor Aleksanov
2020-09-05 12:52:27 +03:00
parent c01cd6e3ed
commit 2c125f3c63
4 changed files with 30 additions and 0 deletions

View File

@@ -491,6 +491,7 @@ pub(crate) fn handle_runnables(
}
// Add `cargo check` and `cargo test` for all targets of the whole package
let config = &snap.config.runnables;
match cargo_spec {
Some(spec) => {
for &cmd in ["check", "test"].iter() {
@@ -500,12 +501,14 @@ pub(crate) fn handle_runnables(
kind: lsp_ext::RunnableKind::Cargo,
args: lsp_ext::CargoRunnable {
workspace_root: Some(spec.workspace_root.clone().into()),
cargo_prefix: config.cargo_prefix.clone(),
cargo_args: vec![
cmd.to_string(),
"--package".to_string(),
spec.package.clone(),
"--all-targets".to_string(),
],
cargo_extra_args: config.cargo_extra_args.clone(),
executable_args: Vec::new(),
expect_test: None,
},
@@ -519,7 +522,9 @@ pub(crate) fn handle_runnables(
kind: lsp_ext::RunnableKind::Cargo,
args: lsp_ext::CargoRunnable {
workspace_root: None,
cargo_prefix: config.cargo_prefix.clone(),
cargo_args: vec!["check".to_string(), "--workspace".to_string()],
cargo_extra_args: config.cargo_extra_args.clone(),
executable_args: Vec::new(),
expect_test: None,
},