From 28e9e8d4cfdf2a334cde6db7d10e7acb8f5fe8b1 Mon Sep 17 00:00:00 2001 From: Aleksei Sidorov Date: Mon, 24 Jun 2019 13:50:34 +0300 Subject: [PATCH] Fix code after "apply suggestions" --- editors/code/package.json | 4 ++-- editors/code/src/commands/cargo_watch.ts | 12 ++++++++---- editors/code/src/commands/watch_status.ts | 4 +++- editors/code/src/config.ts | 16 ++++++++-------- 4 files changed, 21 insertions(+), 15 deletions(-) diff --git a/editors/code/package.json b/editors/code/package.json index 02a9b7e5ba4..ac2ba82e3ef 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -201,7 +201,7 @@ ], "description": "Whether to run `cargo watch` on startup" }, - "rust-analyzer.cargo-watch.command-arguments": { + "rust-analyzer.cargo-watch.arguments": { "type": "string", "description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )", "default": "" @@ -209,7 +209,7 @@ "rust-analyzer.cargo-watch.command": { "type": "string", "description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )", - "default": "check" + "default": "check" }, "rust-analyzer.trace.server": { "type": "string", diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts index 16aac3758fc..13adf4c10bd 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 { this.diagnosticCollection = vscode.languages.createDiagnosticCollection( 'rustc' ); - this.statusDisplay = new StatusDisplay(Server.config.cargoWatchOptions.checkCommand); + this.statusDisplay = new StatusDisplay( + Server.config.cargoWatchOptions.command + ); this.outputChannel = vscode.window.createOutputChannel( 'Cargo Watch Trace' ); @@ -57,10 +59,12 @@ export class CargoWatchProvider implements vscode.Disposable { return; } - let args = Server.config.cargoWatchOptions.checkCommand + ' --all-targets --message-format json'; - if (Server.config.cargoWatchOptions.checkArguments.length > 0) { + let args = + Server.config.cargoWatchOptions.command + + ' --all-targets --message-format json'; + if (Server.config.cargoWatchOptions.command.length > 0) { // Excape the double quote string: - args += ' ' + Server.config.cargoWatchOptions.checkArguments; + args += ' ' + Server.config.cargoWatchOptions.arguments; } // Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes if (process.platform === 'win32') { diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts index 91bc7195b2e..6c1f9041bad 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 { this.packageName }] ${this.frame()}`; } else { - this.statusBarItem!.text = `cargo ${this.command} ${this.frame()}`; + this.statusBarItem!.text = `cargo ${ + this.command + } ${this.frame()}`; } }, 300); diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index c1dd2c056f5..10e98d75342 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -25,8 +25,8 @@ export class Config { public cargoWatchOptions: CargoWatchOptions = { enableOnStartup: 'ask', trace: 'off', - checkArguments: '', - checkCommand: '' + arguments: '', + command: '' }; private prevEnhancedTyping: null | boolean = null; @@ -107,16 +107,16 @@ export class Config { ); } - if (config.has('cargo-watch.check-arguments')) { - this.cargoWatchOptions.checkArguments = config.get( - 'cargo-watch.check-arguments', + if (config.has('cargo-watch.arguments')) { + this.cargoWatchOptions.arguments = config.get( + 'cargo-watch.arguments', '' ); } - if (config.has('cargo-watch.check-command')) { - this.cargoWatchOptions.checkCommand = config.get( - 'cargo-watch.check-command', + if (config.has('cargo-watch.command')) { + this.cargoWatchOptions.command = config.get( + 'cargo-watch.command', '' ); }