aboutsummaryrefslogtreecommitdiff
path: root/crates
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2020-07-29 22:51:49 +0100
committerGitHub <[email protected]>2020-07-29 22:51:49 +0100
commitbd5d236724ff1418b3d3e70fd946374db67479d7 (patch)
tree1680e94c544070a5170b8f133d2897f4cfeb75a2 /crates
parent16caadb404de465d8ea1cb6a107740ef004f232b (diff)
parent85d71f4dff6d96678eeb195249fd340dc8cf4912 (diff)
Merge #5563
5563: Check all targets for package-level tasks r=matklad a=SomeoneToIgnore When invoking "Select Runnable" with the caret on a runnable with a specific target (test, bench, binary), append the corresponding argument for the `cargo check -p` module runnable. Co-authored-by: Kirill Bulatov <[email protected]>
Diffstat (limited to 'crates')
-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 );