aboutsummaryrefslogtreecommitdiff
path: root/editors
diff options
context:
space:
mode:
Diffstat (limited to 'editors')
-rw-r--r--editors/code/package.json4
-rw-r--r--editors/code/src/commands/cargo_watch.ts12
-rw-r--r--editors/code/src/commands/watch_status.ts4
-rw-r--r--editors/code/src/config.ts16
4 files changed, 21 insertions, 15 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 02a9b7e5b..ac2ba82e3 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -201,7 +201,7 @@
201 ], 201 ],
202 "description": "Whether to run `cargo watch` on startup" 202 "description": "Whether to run `cargo watch` on startup"
203 }, 203 },
204 "rust-analyzer.cargo-watch.command-arguments": { 204 "rust-analyzer.cargo-watch.arguments": {
205 "type": "string", 205 "type": "string",
206 "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", 206 "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )",
207 "default": "" 207 "default": ""
@@ -209,7 +209,7 @@
209 "rust-analyzer.cargo-watch.command": { 209 "rust-analyzer.cargo-watch.command": {
210 "type": "string", 210 "type": "string",
211 "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", 211 "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )",
212 "default": "check" 212 "default": "check"
213 }, 213 },
214 "rust-analyzer.trace.server": { 214 "rust-analyzer.trace.server": {
215 "type": "string", 215 "type": "string",
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 16aac3758..13adf4c10 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -43,7 +43,9 @@ export class CargoWatchProvider implements vscode.Disposable {
43 this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 43 this.diagnosticCollection = vscode.languages.createDiagnosticCollection(
44 'rustc' 44 'rustc'
45 ); 45 );
46 this.statusDisplay = new StatusDisplay(Server.config.cargoWatchOptions.checkCommand); 46 this.statusDisplay = new StatusDisplay(
47 Server.config.cargoWatchOptions.command
48 );
47 this.outputChannel = vscode.window.createOutputChannel( 49 this.outputChannel = vscode.window.createOutputChannel(
48 'Cargo Watch Trace' 50 'Cargo Watch Trace'
49 ); 51 );
@@ -57,10 +59,12 @@ export class CargoWatchProvider implements vscode.Disposable {
57 return; 59 return;
58 } 60 }
59 61
60 let args = Server.config.cargoWatchOptions.checkCommand + ' --all-targets --message-format json'; 62 let args =
61 if (Server.config.cargoWatchOptions.checkArguments.length > 0) { 63 Server.config.cargoWatchOptions.command +
64 ' --all-targets --message-format json';
65 if (Server.config.cargoWatchOptions.command.length > 0) {
62 // Excape the double quote string: 66 // Excape the double quote string:
63 args += ' ' + Server.config.cargoWatchOptions.checkArguments; 67 args += ' ' + Server.config.cargoWatchOptions.arguments;
64 } 68 }
65 // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes 69 // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes
66 if (process.platform === 'win32') { 70 if (process.platform === 'win32') {
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts
index 91bc7195b..6c1f9041b 100644
--- a/editors/code/src/commands/watch_status.ts
+++ b/editors/code/src/commands/watch_status.ts
@@ -30,7 +30,9 @@ export class StatusDisplay implements vscode.Disposable {
30 this.packageName 30 this.packageName
31 }] ${this.frame()}`; 31 }] ${this.frame()}`;
32 } else { 32 } else {
33 this.statusBarItem!.text = `cargo ${this.command} ${this.frame()}`; 33 this.statusBarItem!.text = `cargo ${
34 this.command
35 } ${this.frame()}`;
34 } 36 }
35 }, 300); 37 }, 300);
36 38
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index c1dd2c056..10e98d753 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -25,8 +25,8 @@ export class Config {
25 public cargoWatchOptions: CargoWatchOptions = { 25 public cargoWatchOptions: CargoWatchOptions = {
26 enableOnStartup: 'ask', 26 enableOnStartup: 'ask',
27 trace: 'off', 27 trace: 'off',
28 checkArguments: '', 28 arguments: '',
29 checkCommand: '' 29 command: ''
30 }; 30 };
31 31
32 private prevEnhancedTyping: null | boolean = null; 32 private prevEnhancedTyping: null | boolean = null;
@@ -107,16 +107,16 @@ export class Config {
107 ); 107 );
108 } 108 }
109 109
110 if (config.has('cargo-watch.check-arguments')) { 110 if (config.has('cargo-watch.arguments')) {
111 this.cargoWatchOptions.checkArguments = config.get<string>( 111 this.cargoWatchOptions.arguments = config.get<string>(
112 'cargo-watch.check-arguments', 112 'cargo-watch.arguments',
113 '' 113 ''
114 ); 114 );
115 } 115 }
116 116
117 if (config.has('cargo-watch.check-command')) { 117 if (config.has('cargo-watch.command')) {
118 this.cargoWatchOptions.checkCommand = config.get<string>( 118 this.cargoWatchOptions.command = config.get<string>(
119 'cargo-watch.check-command', 119 'cargo-watch.command',
120 '' 120 ''
121 ); 121 );
122 } 122 }