aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-12-17 13:28:37 +0000
committerGitHub <[email protected]>2019-12-17 13:28:37 +0000
commita26840d603e672bace319f45b28dd615de1b0c2d (patch)
treeca3b28e41aa2c335d34ee995aee92406294a1085 /editors/code
parentba6312a2df31235f3d4dce6acd479b8046c1087c (diff)
parent22ae4cb90699d64b8bb455635bad7abb406bb39e (diff)
Merge #2568
2568: Add option to disable all-targets. r=matklad a=pftbest Can be useful in embedded. Co-authored-by: Vadzim Dambrouski <[email protected]>
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package.json5
-rw-r--r--editors/code/src/commands/cargo_watch.ts6
-rw-r--r--editors/code/src/config.ts9
3 files changed, 18 insertions, 2 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 2e89513e4..f7ab2c2f3 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -237,6 +237,11 @@
237 "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)", 237 "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)",
238 "default": [] 238 "default": []
239 }, 239 },
240 "rust-analyzer.cargo-watch.allTargets": {
241 "type": "boolean",
242 "description": "Check all targets and tests (will be passed as `--all-targets`)",
243 "default": true
244 },
240 "rust-analyzer.trace.server": { 245 "rust-analyzer.trace.server": {
241 "type": "string", 246 "type": "string",
242 "scope": "window", 247 "scope": "window",
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 512362eb1..748be535c 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -82,8 +82,10 @@ export class CargoWatchProvider implements vscode.Disposable {
82 } 82 }
83 83
84 let args = 84 let args =
85 Server.config.cargoWatchOptions.command + 85 Server.config.cargoWatchOptions.command + ' --message-format json';
86 ' --all-targets --message-format json'; 86 if (Server.config.cargoWatchOptions.allTargets) {
87 args += ' --all-targets';
88 }
87 if (Server.config.cargoWatchOptions.command.length > 0) { 89 if (Server.config.cargoWatchOptions.command.length > 0) {
88 // Excape the double quote string: 90 // Excape the double quote string:
89 args += ' ' + Server.config.cargoWatchOptions.arguments; 91 args += ' ' + Server.config.cargoWatchOptions.arguments;
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index df15c8172..e131f09df 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -13,6 +13,7 @@ export interface CargoWatchOptions {
13 command: string; 13 command: string;
14 trace: CargoWatchTraceOptions; 14 trace: CargoWatchTraceOptions;
15 ignore: string[]; 15 ignore: string[];
16 allTargets: boolean;
16} 17}
17 18
18export interface CargoFeatures { 19export interface CargoFeatures {
@@ -40,6 +41,7 @@ export class Config {
40 arguments: '', 41 arguments: '',
41 command: '', 42 command: '',
42 ignore: [], 43 ignore: [],
44 allTargets: true,
43 }; 45 };
44 public cargoFeatures: CargoFeatures = { 46 public cargoFeatures: CargoFeatures = {
45 noDefaultFeatures: false, 47 noDefaultFeatures: false,
@@ -132,6 +134,13 @@ export class Config {
132 ); 134 );
133 } 135 }
134 136
137 if (config.has('cargo-watch.allTargets')) {
138 this.cargoWatchOptions.allTargets = config.get<boolean>(
139 'cargo-watch.allTargets',
140 true,
141 );
142 }
143
135 if (config.has('lruCapacity')) { 144 if (config.has('lruCapacity')) {
136 this.lruCapacity = config.get('lruCapacity') as number; 145 this.lruCapacity = config.get('lruCapacity') as number;
137 } 146 }