aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
authorAleksei Sidorov <[email protected]>2019-06-24 11:02:20 +0100
committerAleksei Sidorov <[email protected]>2019-06-24 11:02:20 +0100
commit4722e6d491a29bdb077fc01aa8c5bdc734282c69 (patch)
tree681b4fd62ce9b2166180713236254a8a25f2b60f /editors/code/src
parent7d79be32801036c39507fe96f87ed316e3934662 (diff)
Introduce cargo-watch.check-command
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands/cargo_watch.ts6
-rw-r--r--editors/code/src/commands/watch_status.ts8
-rw-r--r--editors/code/src/config.ts13
3 files changed, 21 insertions, 6 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index 6ba794bb3..db92e03f4 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -43,7 +43,7 @@ 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(Server.config.cargoWatchOptions.checkCommand);
47 this.outputChannel = vscode.window.createOutputChannel( 47 this.outputChannel = vscode.window.createOutputChannel(
48 'Cargo Watch Trace' 48 'Cargo Watch Trace'
49 ); 49 );
@@ -57,7 +57,9 @@ export class CargoWatchProvider implements vscode.Disposable {
57 return; 57 return;
58 } 58 }
59 59
60 let args = 'check --all-targets --message-format json'; 60 let command = Server.config.cargoWatchOptions.checkCommand;
61
62 let args = command + ' --all-targets --message-format json';
61 if (Server.config.cargoWatchOptions.checkArguments.length > 0) { 63 if (Server.config.cargoWatchOptions.checkArguments.length > 0) {
62 // Excape the double quote string: 64 // Excape the double quote string:
63 args += ' ' + Server.config.cargoWatchOptions.checkArguments; 65 args += ' ' + Server.config.cargoWatchOptions.checkArguments;
diff --git a/editors/code/src/commands/watch_status.ts b/editors/code/src/commands/watch_status.ts
index a3b0178f2..91bc7195b 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,11 @@ 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 ${this.command} ${this.frame()}`;
32 } 34 }
33 }, 300); 35 }, 300);
34 36
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 3024546d2..85366fc34 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -1,6 +1,7 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2 2
3import { Server } from './server'; 3import { Server } from './server';
4import { strict } from 'assert';
4 5
5const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; 6const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
6 7
@@ -10,6 +11,7 @@ export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose';
10export interface CargoWatchOptions { 11export interface CargoWatchOptions {
11 enableOnStartup: CargoWatchStartupOptions; 12 enableOnStartup: CargoWatchStartupOptions;
12 checkArguments: string; 13 checkArguments: string;
14 checkCommand: string;
13 trace: CargoWatchTraceOptions; 15 trace: CargoWatchTraceOptions;
14} 16}
15 17
@@ -23,7 +25,8 @@ export class Config {
23 public cargoWatchOptions: CargoWatchOptions = { 25 public cargoWatchOptions: CargoWatchOptions = {
24 enableOnStartup: 'ask', 26 enableOnStartup: 'ask',
25 trace: 'off', 27 trace: 'off',
26 checkArguments: '' 28 checkArguments: '',
29 checkCommand: ''
27 }; 30 };
28 31
29 private prevEnhancedTyping: null | boolean = null; 32 private prevEnhancedTyping: null | boolean = null;
@@ -110,6 +113,14 @@ export class Config {
110 '' 113 ''
111 ); 114 );
112 } 115 }
116
117 if (config.has('cargo-watch.check-command')) {
118 this.cargoWatchOptions.checkCommand = config.get<string>(
119 'cargo-watch.check-command',
120 ''
121 );
122 }
123
113 if (config.has('lruCapacity')) { 124 if (config.has('lruCapacity')) {
114 this.lruCapacity = config.get('lruCapacity') as number; 125 this.lruCapacity = config.get('lruCapacity') as number;
115 } 126 }