]> git.lizzy.rs Git - rust.git/commitdiff
Add option to disable all-targets.
authorVadzim Dambrouski <vadzim.dambrouski@promwad.com>
Sun, 15 Dec 2019 17:32:13 +0000 (23:02 +0530)
committerVadzim Dambrouski <vadzim.dambrouski@promwad.com>
Sun, 15 Dec 2019 18:02:13 +0000 (23:32 +0530)
Can be useful in embedded.

editors/code/package.json
editors/code/src/commands/cargo_watch.ts
editors/code/src/config.ts

index 9290599c7adee7f3c2cdbe0f5e0f37071e4e945a..df8e9eecb9756267189afe8e24e016eaeee85372 100644 (file)
                     "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)",
                     "default": []
                 },
+                "rust-analyzer.cargo-watch.allTargets": {
+                    "type": "boolean",
+                    "description": "Check all targets and tests (will be passed as `--all-targets`)",
+                    "default": true
+                },
                 "rust-analyzer.trace.server": {
                     "type": "string",
                     "scope": "window",
index 512362eb1884dd96b403784a3b48c6c1c5c4d044..45f1dd49f46160363c11b56af4efea74c4be32f4 100644 (file)
@@ -83,7 +83,10 @@ export class CargoWatchProvider implements vscode.Disposable {
 
         let args =
             Server.config.cargoWatchOptions.command +
-            ' --all-targets --message-format json';
+            ' --message-format json';
+        if (Server.config.cargoWatchOptions.allTargets) {
+            args += ' --all-targets';
+        }
         if (Server.config.cargoWatchOptions.command.length > 0) {
             // Excape the double quote string:
             args += ' ' + Server.config.cargoWatchOptions.arguments;
index defdfeb9c4bdca69d8d23467136041318ac9369d..a6e0f6454f1669a5e25b2a1ec0695b31434ba5c1 100644 (file)
@@ -13,6 +13,7 @@ export interface CargoWatchOptions {
     command: string;
     trace: CargoWatchTraceOptions;
     ignore: string[];
+    allTargets: boolean;
 }
 
 export interface CargoFeatures {
@@ -40,6 +41,7 @@ export class Config {
         arguments: '',
         command: '',
         ignore: [],
+        allTargets: true,
     };
     public cargoFeatures: CargoFeatures = {
         noDefaultFeatures: false,
@@ -132,6 +134,13 @@ export class Config {
             );
         }
 
+        if (config.has('cargo-watch.allTargets')) {
+            this.cargoWatchOptions.allTargets = config.get<boolean>(
+                'cargo-watch.allTargets',
+                true,
+            );
+        }
+
         if (config.has('lruCapacity')) {
             this.lruCapacity = config.get('lruCapacity') as number;
         }