aboutsummaryrefslogtreecommitdiff
path: root/editors/code/src/cargo.ts
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code/src/cargo.ts')
-rw-r--r--editors/code/src/cargo.ts17
1 files changed, 12 insertions, 5 deletions
diff --git a/editors/code/src/cargo.ts b/editors/code/src/cargo.ts
index 5999187f4..857b84d59 100644
--- a/editors/code/src/cargo.ts
+++ b/editors/code/src/cargo.ts
@@ -1,5 +1,6 @@
1import * as cp from 'child_process'; 1import * as cp from 'child_process';
2import * as readline from 'readline'; 2import * as readline from 'readline';
3import { OutputChannel } from 'vscode';
3 4
4interface CompilationArtifact { 5interface CompilationArtifact {
5 fileName: string; 6 fileName: string;
@@ -10,10 +11,13 @@ interface CompilationArtifact {
10 11
11export class Cargo { 12export class Cargo {
12 rootFolder: string; 13 rootFolder: string;
13 env?: { [key: string]: string }; 14 env?: Record<string, string>;
15 output: OutputChannel;
14 16
15 public constructor(cargoTomlFolder: string) { 17 public constructor(cargoTomlFolder: string, output: OutputChannel, env: Record<string, string> | undefined = undefined) {
16 this.rootFolder = cargoTomlFolder; 18 this.rootFolder = cargoTomlFolder;
19 this.output = output;
20 this.env = env;
17 } 21 }
18 22
19 public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> { 23 public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> {
@@ -34,14 +38,17 @@ export class Cargo {
34 }) 38 })
35 } 39 }
36 } 40 }
41 else if( message.reason == 'compiler-message') {
42 this.output.append(message.message.rendered);
43 }
37 }, 44 },
38 _stderr => { 45 stderr => {
39 // TODO: to output 46 this.output.append(stderr);
40 } 47 }
41 ); 48 );
42 } 49 }
43 catch (err) { 50 catch (err) {
44 // TODO: to output 51 this.output.show(true);
45 throw new Error(`Cargo invocation has failed: ${err}`); 52 throw new Error(`Cargo invocation has failed: ${err}`);
46 } 53 }
47 54