mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-25 00:03:43 +00:00
Fix code after "apply suggestions"
This commit is contained in:
parent
c40ee089f2
commit
28e9e8d4cf
@ -201,7 +201,7 @@
|
|||||||
],
|
],
|
||||||
"description": "Whether to run `cargo watch` on startup"
|
"description": "Whether to run `cargo watch` on startup"
|
||||||
},
|
},
|
||||||
"rust-analyzer.cargo-watch.command-arguments": {
|
"rust-analyzer.cargo-watch.arguments": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )",
|
"description": "`cargo-watch` arguments. (e.g: `--features=\"shumway,pdf\"` will run as `cargo watch -x \"check --features=\"shumway,pdf\"\"` )",
|
||||||
"default": ""
|
"default": ""
|
||||||
@ -209,7 +209,7 @@
|
|||||||
"rust-analyzer.cargo-watch.command": {
|
"rust-analyzer.cargo-watch.command": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
"description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )",
|
"description": "`cargo-watch` command. (e.g: `clippy` will run as `cargo watch -x clippy` )",
|
||||||
"default": "check"
|
"default": "check"
|
||||||
},
|
},
|
||||||
"rust-analyzer.trace.server": {
|
"rust-analyzer.trace.server": {
|
||||||
"type": "string",
|
"type": "string",
|
||||||
|
@ -43,7 +43,9 @@ export class CargoWatchProvider implements vscode.Disposable {
|
|||||||
this.diagnosticCollection = vscode.languages.createDiagnosticCollection(
|
this.diagnosticCollection = vscode.languages.createDiagnosticCollection(
|
||||||
'rustc'
|
'rustc'
|
||||||
);
|
);
|
||||||
this.statusDisplay = new StatusDisplay(Server.config.cargoWatchOptions.checkCommand);
|
this.statusDisplay = new StatusDisplay(
|
||||||
|
Server.config.cargoWatchOptions.command
|
||||||
|
);
|
||||||
this.outputChannel = vscode.window.createOutputChannel(
|
this.outputChannel = vscode.window.createOutputChannel(
|
||||||
'Cargo Watch Trace'
|
'Cargo Watch Trace'
|
||||||
);
|
);
|
||||||
@ -57,10 +59,12 @@ export class CargoWatchProvider implements vscode.Disposable {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
let args = Server.config.cargoWatchOptions.checkCommand + ' --all-targets --message-format json';
|
let args =
|
||||||
if (Server.config.cargoWatchOptions.checkArguments.length > 0) {
|
Server.config.cargoWatchOptions.command +
|
||||||
|
' --all-targets --message-format json';
|
||||||
|
if (Server.config.cargoWatchOptions.command.length > 0) {
|
||||||
// Excape the double quote string:
|
// 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
|
// Windows handles arguments differently than the unix-likes, so we need to wrap the args in double quotes
|
||||||
if (process.platform === 'win32') {
|
if (process.platform === 'win32') {
|
||||||
|
@ -30,7 +30,9 @@ export class StatusDisplay implements vscode.Disposable {
|
|||||||
this.packageName
|
this.packageName
|
||||||
}] ${this.frame()}`;
|
}] ${this.frame()}`;
|
||||||
} else {
|
} else {
|
||||||
this.statusBarItem!.text = `cargo ${this.command} ${this.frame()}`;
|
this.statusBarItem!.text = `cargo ${
|
||||||
|
this.command
|
||||||
|
} ${this.frame()}`;
|
||||||
}
|
}
|
||||||
}, 300);
|
}, 300);
|
||||||
|
|
||||||
|
@ -25,8 +25,8 @@ export class Config {
|
|||||||
public cargoWatchOptions: CargoWatchOptions = {
|
public cargoWatchOptions: CargoWatchOptions = {
|
||||||
enableOnStartup: 'ask',
|
enableOnStartup: 'ask',
|
||||||
trace: 'off',
|
trace: 'off',
|
||||||
checkArguments: '',
|
arguments: '',
|
||||||
checkCommand: ''
|
command: ''
|
||||||
};
|
};
|
||||||
|
|
||||||
private prevEnhancedTyping: null | boolean = null;
|
private prevEnhancedTyping: null | boolean = null;
|
||||||
@ -107,16 +107,16 @@ export class Config {
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.has('cargo-watch.check-arguments')) {
|
if (config.has('cargo-watch.arguments')) {
|
||||||
this.cargoWatchOptions.checkArguments = config.get<string>(
|
this.cargoWatchOptions.arguments = config.get<string>(
|
||||||
'cargo-watch.check-arguments',
|
'cargo-watch.arguments',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (config.has('cargo-watch.check-command')) {
|
if (config.has('cargo-watch.command')) {
|
||||||
this.cargoWatchOptions.checkCommand = config.get<string>(
|
this.cargoWatchOptions.command = config.get<string>(
|
||||||
'cargo-watch.check-command',
|
'cargo-watch.command',
|
||||||
''
|
''
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user