aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands
diff options
context:
space:
mode:
authorbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-06-24 12:03:28 +0100
committerbors[bot] <26634292+bors[bot]@users.noreply.github.com>2019-06-24 12:03:28 +0100
commit364ac9b9468e1930f39e0dddc454b2eb7d68f360 (patch)
tree3e509c7b96be33f8b5d1fcb0ebd601e15aaf057f /editors/code/src/commands
parentf6340022c1ce9bfa716b4b61800cdc8c51260a93 (diff)
parent28e9e8d4cfdf2a334cde6db7d10e7acb8f5fe8b1 (diff)
Merge #1434
1434: Introduce cargo-watch.check-command option for Code extension r=matklad a=alekseysidorov By this option you can replace `check` command in `cargo watch` by the something else like `clippy`. Co-authored-by: Aleksei Sidorov <[email protected]> Co-authored-by: Aleksey Sidorov <[email protected]>
Diffstat (limited to 'editors/code/src/commands')
-rw-r--r--editors/code/src/commands/cargo_watch.ts12
-rw-r--r--editors/code/src/commands/watch_status.ts10
2 files changed, 15 insertions, 7 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 6ba794bb3..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(); 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 = 'check --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 a3b0178f2..6c1f9041b 100644
--- a/editors/code/src/commands/watch_status.ts
+++ b/editors/code/src/commands/watch_status.ts
@@ -7,13 +7,15 @@ export class StatusDisplay implements vscode.Disposable {
7 7
8 private i = 0; 8 private i = 0;
9 private statusBarItem: vscode.StatusBarItem; 9 private statusBarItem: vscode.StatusBarItem;
10 private command: string;
10 private timer?: NodeJS.Timeout; 11 private timer?: NodeJS.Timeout;
11 12
12 constructor() { 13 constructor(command: string) {
13 this.statusBarItem = vscode.window.createStatusBarItem( 14 this.statusBarItem = vscode.window.createStatusBarItem(
14 vscode.StatusBarAlignment.Left, 15 vscode.StatusBarAlignment.Left,
15 10 16 10
16 ); 17 );
18 this.command = command;
17 this.statusBarItem.hide(); 19 this.statusBarItem.hide();
18 } 20 }
19 21
@@ -24,11 +26,13 @@ export class StatusDisplay implements vscode.Disposable {
24 this.timer || 26 this.timer ||
25 setInterval(() => { 27 setInterval(() => {
26 if (this.packageName) { 28 if (this.packageName) {
27 this.statusBarItem!.text = `cargo check [${ 29 this.statusBarItem!.text = `cargo ${this.command} [${
28 this.packageName 30 this.packageName
29 }] ${this.frame()}`; 31 }] ${this.frame()}`;
30 } else { 32 } else {
31 this.statusBarItem!.text = `cargo check ${this.frame()}`; 33 this.statusBarItem!.text = `cargo ${
34 this.command
35 } ${this.frame()}`;
32 } 36 }
33 }, 300); 37 }, 300);
34 38