]> git.lizzy.rs Git - rust.git/commitdiff
Run package-specific cargo check and test for all targets
authorKirill Bulatov <mail4score@gmail.com>
Wed, 29 Jul 2020 12:35:27 +0000 (15:35 +0300)
committerKirill Bulatov <mail4score@gmail.com>
Wed, 29 Jul 2020 12:35:27 +0000 (15:35 +0300)
crates/rust-analyzer/src/handlers.rs
crates/rust-analyzer/tests/heavy_tests/main.rs

index 1350bd4002cdcb172b25a5e8fe2f218b2c1bcb75..87a1367ac2e89b62ec0b134ad639a15d8938d01b 100644 (file)
@@ -469,12 +469,12 @@ pub(crate) fn handle_runnables(
         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 {
         Some(spec) => {
             for &cmd in ["check", "test"].iter() {
                 res.push(lsp_ext::Runnable {
-                    label: format!("cargo {} -p {}", cmd, spec.package),
+                    label: format!("cargo {} -p {} --all-targets", cmd, spec.package),
                     location: None,
                     kind: lsp_ext::RunnableKind::Cargo,
                     args: lsp_ext::CargoRunnable {
@@ -483,6 +483,7 @@ pub(crate) fn handle_runnables(
                             cmd.to_string(),
                             "--package".to_string(),
                             spec.package.clone(),
+                            "--all-targets".to_string(),
                         ],
                         executable_args: Vec::new(),
                         expect_test: None,
index 28e8966487334fbc04ee952bb0f7305c4ae5ae2f..7370505f8bfb2514aee27e5fe20029fbd8e6282b 100644 (file)
@@ -115,21 +115,21 @@ fn main() {}
           },
           {
             "args": {
-              "cargoArgs": ["check", "--package", "foo"],
+              "cargoArgs": ["check", "--package", "foo", "--all-targets"],
               "executableArgs": [],
               "workspaceRoot": server.path().join("foo")
             },
             "kind": "cargo",
-            "label": "cargo check -p foo"
+            "label": "cargo check -p foo --all-targets"
           },
           {
             "args": {
-              "cargoArgs": ["test", "--package", "foo"],
+              "cargoArgs": ["test", "--package", "foo", "--all-targets"],
               "executableArgs": [],
               "workspaceRoot": server.path().join("foo")
             },
             "kind": "cargo",
-            "label": "cargo test -p foo"
+            "label": "cargo test -p foo --all-targets"
           }
         ]),
     );