2568: Add option to disable all-targets. r=matklad a=pftbest

Can be useful in embedded.

Co-authored-by: Vadzim Dambrouski <vadzim.dambrouski@promwad.com>
This commit is contained in:
bors[bot] 2019-12-17 13:28:37 +00:00 committed by GitHub
commit a26840d603
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 18 additions and 2 deletions

View file

@ -237,6 +237,11 @@
"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",

View file

@ -82,8 +82,10 @@ export class CargoWatchProvider implements vscode.Disposable {
}
let args =
Server.config.cargoWatchOptions.command +
' --all-targets --message-format json';
Server.config.cargoWatchOptions.command + ' --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;

View 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;
}