aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src')
-rw-r--r--editors/code/src/commands/cargo_watch.ts12
-rw-r--r--editors/code/src/commands/watch_status.ts10
-rw-r--r--editors/code/src/config.ts21
3 files changed, 31 insertions, 12 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
diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts
index 3024546d2..10e98d753 100644
--- a/editors/code/src/config.ts
+++ b/editors/code/src/config.ts
@@ -1,5 +1,6 @@
1import * as vscode from 'vscode'; 1import * as vscode from 'vscode';
2 2
3import { strict } from 'assert';
3import { Server } from './server'; 4import { Server } from './server';
4 5
5const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG; 6const RA_LSP_DEBUG = process.env.__RA_LSP_SERVER_DEBUG;
@@ -9,7 +10,8 @@ export type CargoWatchTraceOptions = 'off' | 'error' | 'verbose';
9 10
10export interface CargoWatchOptions { 11export interface CargoWatchOptions {
11 enableOnStartup: CargoWatchStartupOptions; 12 enableOnStartup: CargoWatchStartupOptions;
12 checkArguments: string; 13 arguments: string;
14 command: 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 arguments: '',
29 command: ''
27 }; 30 };
28 31
29 private prevEnhancedTyping: null | boolean = null; 32 private prevEnhancedTyping: null | boolean = null;
@@ -104,12 +107,20 @@ export class Config {
104 ); 107 );
105 } 108 }
106 109
107 if (config.has('cargo-watch.check-arguments')) { 110 if (config.has('cargo-watch.arguments')) {
108 this.cargoWatchOptions.checkArguments = config.get<string>( 111 this.cargoWatchOptions.arguments = config.get<string>(
109 'cargo-watch.check-arguments', 112 'cargo-watch.arguments',
110 '' 113 ''
111 ); 114 );
112 } 115 }
116
117 if (config.has('cargo-watch.command')) {
118 this.cargoWatchOptions.command = config.get<string>(
119 'cargo-watch.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 }