diff options
-rw-r--r-- | crates/rust-analyzer/src/handlers.rs | 5 | ||||
-rw-r--r-- | crates/rust-analyzer/tests/heavy_tests/main.rs | 8 |
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 | ); |