aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/commands/cargo_watch.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/commands/cargo_watch.ts')
-rw-r--r--editors/code/src/commands/cargo_watch.ts26
1 files changed, 15 insertions, 11 deletions
diff --git a/editors/code/src/commands/cargo_watch.ts b/editors/code/src/commands/cargo_watch.ts
index c6ce6ba06..037f1e302 100644
--- a/editors/code/src/commands/cargo_watch.ts
+++ b/editors/code/src/commands/cargo_watch.ts
@@ -2,7 +2,7 @@ import * as child_process from 'child_process';
2import * as path from 'path'; 2import * as path from 'path';
3import * as timers from 'timers'; 3import * as timers from 'timers';
4import * as vscode from 'vscode'; 4import * as vscode from 'vscode';
5import {StatusDisplay} from './watch_status'; 5import { StatusDisplay } from './watch_status';
6 6
7export class CargoWatchProvider { 7export class CargoWatchProvider {
8 private diagnosticCollection?: vscode.DiagnosticCollection; 8 private diagnosticCollection?: vscode.DiagnosticCollection;
@@ -12,19 +12,22 @@ export class CargoWatchProvider {
12 12
13 public activate(subscriptions: vscode.Disposable[]) { 13 public activate(subscriptions: vscode.Disposable[]) {
14 subscriptions.push(this); 14 subscriptions.push(this);
15 this.diagnosticCollection = vscode.languages.createDiagnosticCollection('rustc'); 15 this.diagnosticCollection = vscode.languages.createDiagnosticCollection(
16 'rustc'
17 );
16 18
17 this.statusDisplay = new StatusDisplay(subscriptions); 19 this.statusDisplay = new StatusDisplay(subscriptions);
18 20
19 // Start the cargo watch with json message 21 // Start the cargo watch with json message
20 this.cargoProcess = child_process.spawn('cargo', 22 this.cargoProcess = child_process.spawn(
21 ['watch', '-x', '\"check --message-format json\"'], 23 'cargo',
24 ['watch', '-x', '"check --message-format json"'],
22 { 25 {
23 // stdio: ['ignore', 'pipe', 'ignore'], 26 // stdio: ['ignore', 'pipe', 'ignore'],
24 shell: true, 27 shell: true,
25 cwd: vscode.workspace.rootPath, 28 cwd: vscode.workspace.rootPath
26 }); 29 }
27 30 );
28 31
29 this.cargoProcess.stdout.on('data', (s: string) => { 32 this.cargoProcess.stdout.on('data', (s: string) => {
30 this.processOutput(s); 33 this.processOutput(s);
@@ -109,7 +112,9 @@ export class CargoWatchProvider {
109 112
110 const fileUrl = vscode.Uri.file(fileName!); 113 const fileUrl = vscode.Uri.file(fileName!);
111 114
112 const diagnostics: vscode.Diagnostic[] = [...(this.diagnosticCollection!.get(fileUrl) || [])]; 115 const diagnostics: vscode.Diagnostic[] = [
116 ...(this.diagnosticCollection!.get(fileUrl) || [])
117 ];
113 diagnostics.push(diagnostic); 118 diagnostics.push(diagnostic);
114 119
115 this.diagnosticCollection!.set(fileUrl, diagnostics); 120 this.diagnosticCollection!.set(fileUrl, diagnostics);
@@ -129,5 +134,4 @@ export class CargoWatchProvider {
129 eolIndex = this.outBuffer.indexOf('\n'); 134 eolIndex = this.outBuffer.indexOf('\n');
130 } 135 }
131 } 136 }
132
133} 137}