mirror of
https://github.com/rust-lang/rust-analyzer
synced 2024-12-25 20:43:21 +00:00
Run package-specific cargo check and test for all targets
This commit is contained in:
parent
e358043557
commit
85d71f4dff
2 changed files with 7 additions and 6 deletions
|
@ -469,12 +469,12 @@ pub(crate) fn handle_runnables(
|
||||||
res.push(runnable);
|
res.push(runnable);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add `cargo check` and `cargo test` for the whole package
|
// Add `cargo check` and `cargo test` for all targets of the whole package
|
||||||
match cargo_spec {
|
match cargo_spec {
|
||||||
Some(spec) => {
|
Some(spec) => {
|
||||||
for &cmd in ["check", "test"].iter() {
|
for &cmd in ["check", "test"].iter() {
|
||||||
res.push(lsp_ext::Runnable {
|
res.push(lsp_ext::Runnable {
|
||||||
label: format!("cargo {} -p {}", cmd, spec.package),
|
label: format!("cargo {} -p {} --all-targets", cmd, spec.package),
|
||||||
location: None,
|
location: None,
|
||||||
kind: lsp_ext::RunnableKind::Cargo,
|
kind: lsp_ext::RunnableKind::Cargo,
|
||||||
args: lsp_ext::CargoRunnable {
|
args: lsp_ext::CargoRunnable {
|
||||||
|
@ -483,6 +483,7 @@ pub(crate) fn handle_runnables(
|
||||||
cmd.to_string(),
|
cmd.to_string(),
|
||||||
"--package".to_string(),
|
"--package".to_string(),
|
||||||
spec.package.clone(),
|
spec.package.clone(),
|
||||||
|
"--all-targets".to_string(),
|
||||||
],
|
],
|
||||||
executable_args: Vec::new(),
|
executable_args: Vec::new(),
|
||||||
expect_test: None,
|
expect_test: None,
|
||||||
|
|
|
@ -115,21 +115,21 @@ fn main() {}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": {
|
"args": {
|
||||||
"cargoArgs": ["check", "--package", "foo"],
|
"cargoArgs": ["check", "--package", "foo", "--all-targets"],
|
||||||
"executableArgs": [],
|
"executableArgs": [],
|
||||||
"workspaceRoot": server.path().join("foo")
|
"workspaceRoot": server.path().join("foo")
|
||||||
},
|
},
|
||||||
"kind": "cargo",
|
"kind": "cargo",
|
||||||
"label": "cargo check -p foo"
|
"label": "cargo check -p foo --all-targets"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"args": {
|
"args": {
|
||||||
"cargoArgs": ["test", "--package", "foo"],
|
"cargoArgs": ["test", "--package", "foo", "--all-targets"],
|
||||||
"executableArgs": [],
|
"executableArgs": [],
|
||||||
"workspaceRoot": server.path().join("foo")
|
"workspaceRoot": server.path().join("foo")
|
||||||
},
|
},
|
||||||
"kind": "cargo",
|
"kind": "cargo",
|
||||||
"label": "cargo test -p foo"
|
"label": "cargo test -p foo --all-targets"
|
||||||
}
|
}
|
||||||
]),
|
]),
|
||||||
);
|
);
|
||||||
|
|
Loading…
Reference in a new issue