aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--docs/user/README.md1
-rw-r--r--editors/code/package.json5
-rw-r--r--editors/code/src/commands/cargo_watch.ts7
-rw-r--r--editors/code/src/config.ts11
4 files changed, 22 insertions, 2 deletions
diff --git a/docs/user/README.md b/docs/user/README.md
index 036b51d58..5b7502132 100644
--- a/docs/user/README.md
+++ b/docs/user/README.md
@@ -79,6 +79,7 @@ See [microsoft/vscode#72308](https://github.com/microsoft/vscode/issues/72308) f
79* `rust-analyzer.cargo-watch.command`: `cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` ) 79* `rust-analyzer.cargo-watch.command`: `cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )
80* `rust-analyzer.cargo-watch.arguments`: cargo-watch check arguments. 80* `rust-analyzer.cargo-watch.arguments`: cargo-watch check arguments.
81 (e.g: `--features="shumway,pdf"` will run as `cargo watch -x "check --features="shumway,pdf""` ) 81 (e.g: `--features="shumway,pdf"` will run as `cargo watch -x "check --features="shumway,pdf""` )
82* `rust-analyzer.cargo-watch.ignore`: list of patterns for cargo-watch to ignore (will be passed as `--ignore`)
82* `rust-analyzer.trace.server`: enables internal logging 83* `rust-analyzer.trace.server`: enables internal logging
83* `rust-analyzer.trace.cargo-watch`: enables cargo-watch logging 84* `rust-analyzer.trace.cargo-watch`: enables cargo-watch logging
84* `RUST_SRC_PATH`: environment variable that overwrites the sysroot 85* `RUST_SRC_PATH`: environment variable that overwrites the sysroot
diff --git a/editors/code/package.json b/editors/code/package.json
index 6649f5b73..5ae050110 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -224,6 +224,11 @@
224 "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", 224 "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )",
225 "default": "check" 225 "default": "check"
226 }, 226 },
227 "rust-analyzer.cargo-watch.ignore": {
228 "type": "array",
229 "description": "A list of patterns for cargo-watch to ignore (will be passed as `--ignore`)",
230 "default": []
231 },
227 "rust-analyzer.showWorkspaceLoadedNotification": { 232 "rust-analyzer.showWorkspaceLoadedNotification": {
228 "type": "boolean", 233 "type": "boolean",
229 "description": "Controls whether rust-analyzer displays a notification when a project is loaded.", 234 "description": "Controls whether rust-analyzer displays a notification when a project is loaded.",
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 00b24dbce..59d4ba97a 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -93,10 +93,15 @@ export class CargoWatchProvider implements vscode.Disposable {
93 args = '"' + args + '"'; 93 args = '"' + args + '"';
94 } 94 }
95 95
96 const ignoreFlags = Server.config.cargoWatchOptions.ignore.reduce(
97 (flags, pattern) => [...flags, '--ignore', pattern],
98 [] as string[]
99 );
100
96 // Start the cargo watch with json message 101 // Start the cargo watch with json message
97 this.cargoProcess = child_process.spawn( 102 this.cargoProcess = child_process.spawn(
98 'cargo', 103 'cargo',
99 ['watch', '-x', args], 104 ['watch', '-x', args, ...ignoreFlags],
100 { 105 {
101 stdio: ['ignore', 'pipe', 'pipe'], 106 stdio: ['ignore', 'pipe', 'pipe'],
102 cwd: vscode.workspace.rootPath, 107 cwd: vscode.workspace.rootPath,
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index a4581485c..49bdf7d72 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -12,6 +12,7 @@ export interface CargoWatchOptions {
12 arguments: string; 12 arguments: string;
13 command: string; 13 command: string;
14 trace: CargoWatchTraceOptions; 14 trace: CargoWatchTraceOptions;
15 ignore: string[];
15} 16}
16 17
17export class Config { 18export class Config {
@@ -29,7 +30,8 @@ export class Config {
29 enableOnStartup: 'ask', 30 enableOnStartup: 'ask',
30 trace: 'off', 31 trace: 'off',
31 arguments: '', 32 arguments: '',
32 command: '' 33 command: '',
34 ignore: []
33 }; 35 };
34 36
35 private prevEnhancedTyping: null | boolean = null; 37 private prevEnhancedTyping: null | boolean = null;
@@ -124,6 +126,13 @@ export class Config {
124 ); 126 );
125 } 127 }
126 128
129 if (config.has('cargo-watch.ignore')) {
130 this.cargoWatchOptions.ignore = config.get<string[]>(
131 'cargo-watch.ignore',
132 []
133 );
134 }
135
127 if (config.has('lruCapacity')) { 136 if (config.has('lruCapacity')) {
128 this.lruCapacity = config.get('lruCapacity') as number; 137 this.lruCapacity = config.get('lruCapacity') as number;
129 } 138 }