aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKirill Bulatov <[email protected]>2020-07-29 13:35:27 +0100
committerKirill Bulatov <[email protected]>2020-07-29 13:35:27 +0100
commit85d71f4dff6d96678eeb195249fd340dc8cf4912 (patch)
treeb20c755d57d3af543821d4e48a6401b50e88693b
parente35804355797a50195718918efc6f7272786d62e (diff)
Run package-specific cargo check and test for all targets
-rw-r--r--crates/rust-analyzer/src/handlers.rs5
-rw-r--r--crates/rust-analyzer/tests/heavy_tests/main.rs8
2 files changed, 7 insertions, 6 deletions
diff --git a/crates/rust-analyzer/src/handlers.rs b/crates/rust-analyzer/src/handlers.rs
index 1350bd400..87a1367ac 100644
--- a/crates/rust-analyzer/src/handlers.rs
+++ b/crates/rust-analyzer/src/handlers.rs
@@ -469,12 +469,12 @@ pub(crate) fn handle_runnables(
469 res.push(runnable); 469 res.push(runnable);
470 } 470 }
471 471
472 // Add `cargo check` and `cargo test` for the whole package 472 // Add `cargo check` and `cargo test` for all targets of the whole package
473 match cargo_spec { 473 match cargo_spec {
474 Some(spec) => { 474 Some(spec) => {
475 for &cmd in ["check", "test"].iter() { 475 for &cmd in ["check", "test"].iter() {
476 res.push(lsp_ext::Runnable { 476 res.push(lsp_ext::Runnable {
477 label: format!("cargo {} -p {}", cmd, spec.package), 477 label: format!("cargo {} -p {} --all-targets", cmd, spec.package),
478 location: None, 478 location: None,
479 kind: lsp_ext::RunnableKind::Cargo, 479 kind: lsp_ext::RunnableKind::Cargo,
480 args: lsp_ext::CargoRunnable { 480 args: lsp_ext::CargoRunnable {
@@ -483,6 +483,7 @@ pub(crate) fn handle_runnables(
483 cmd.to_string(), 483 cmd.to_string(),
484 "--package".to_string(), 484 "--package".to_string(),
485 spec.package.clone(), 485 spec.package.clone(),
486 "--all-targets".to_string(),
486 ], 487 ],
487 executable_args: Vec::new(), 488 executable_args: Vec::new(),
488 expect_test: None, 489 expect_test: None,
diff --git a/crates/rust-analyzer/tests/heavy_tests/main.rs b/crates/rust-analyzer/tests/heavy_tests/main.rs
index 28e896648..7370505f8 100644
--- a/crates/rust-analyzer/tests/heavy_tests/main.rs
+++ b/crates/rust-analyzer/tests/heavy_tests/main.rs
@@ -115,21 +115,21 @@ fn main() {}
115 }, 115 },
116 { 116 {
117 "args": { 117 "args": {
118 "cargoArgs": ["check", "--package", "foo"], 118 "cargoArgs": ["check", "--package", "foo", "--all-targets"],
119 "executableArgs": [], 119 "executableArgs": [],
120 "workspaceRoot": server.path().join("foo") 120 "workspaceRoot": server.path().join("foo")
121 }, 121 },
122 "kind": "cargo", 122 "kind": "cargo",
123 "label": "cargo check -p foo" 123 "label": "cargo check -p foo --all-targets"
124 }, 124 },
125 { 125 {
126 "args": { 126 "args": {
127 "cargoArgs": ["test", "--package", "foo"], 127 "cargoArgs": ["test", "--package", "foo", "--all-targets"],
128 "executableArgs": [], 128 "executableArgs": [],
129 "workspaceRoot": server.path().join("foo") 129 "workspaceRoot": server.path().join("foo")
130 }, 130 },
131 "kind": "cargo", 131 "kind": "cargo",
132 "label": "cargo test -p foo" 132 "label": "cargo test -p foo --all-targets"
133 } 133 }
134 ]), 134 ]),
135 ); 135 );