* `rust-analyzer.cargo-watch.command`: `cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )
* `rust-analyzer.cargo-watch.arguments`: cargo-watch check arguments.
(e.g: `--features="shumway,pdf"` will run as `cargo watch -x "check --features="shumway,pdf""` )
+* `rust-analyzer.cargo-watch.ignore`: list of patterns for cargo-watch to ignore (will be passed as `--ignore`)
* `rust-analyzer.trace.server`: enables internal logging
* `rust-analyzer.trace.cargo-watch`: enables cargo-watch logging
* `RUST_SRC_PATH`: environment variable that overwrites the sysroot
"description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )",
"default": "check"
},
+ "rust-analyzer.cargo-watch.ignore": {
+ "type": "array",
+ "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)",
+ "default": []
+ },
"rust-analyzer.showWorkspaceLoadedNotification": {
"type": "boolean",
"description": "Controls whether rust-analyzer displays a notification when a project is loaded.",
args = '"' + args + '"';
}
+ const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce(
+ (flags, pattern) => [...flags, '--ignore', pattern],
+ [] as string[]
+ );
+
// Start the cargo watch with json message
this.cargoProcess = child_process.spawn(
'cargo',
- ['watch', '-x', args],
+ ['watch', '-x', args, ...ignoreFlags],
{
stdio: ['ignore', 'pipe', 'pipe'],
cwd: vscode.workspace.rootPath,
arguments: string;
command: string;
trace: CargoWatchTraceOptions;
+ ignore: string[];
}
export class Config {
enableOnStartup: 'ask',
trace: 'off',
arguments: '',
- command: ''
+ command: '',
+ ignore: []
};
private prevEnhancedTyping: null | boolean = null;
);
}
+ if (config.has('cargo-watch.ignore')) {
+ this.cargoWatchOptions.ignore = config.get<string[]>(
+ 'cargo-watch.ignore',
+ []
+ );
+ }
+
if (config.has('lruCapacity')) {
this.lruCapacity = config.get('lruCapacity') as number;
}