aboutsummaryrefslogtreecommitdiff
path: root/editors/code
diff options
context:
space:
mode:
Diffstat (limited to 'editors/code')
-rw-r--r--editors/code/package.json2
-rw-r--r--editors/code/src/cargo.ts17
-rw-r--r--editors/code/src/commands/runnables.ts7
3 files changed, 19 insertions, 7 deletions
diff --git a/editors/code/package.json b/editors/code/package.json
index 4f2df89ef..70a5c6619 100644
--- a/editors/code/package.json
+++ b/editors/code/package.json
@@ -399,7 +399,7 @@
399 "default": "auto", 399 "default": "auto",
400 "description": "Preffered debug engine.", 400 "description": "Preffered debug engine.",
401 "markdownEnumDescriptions": [ 401 "markdownEnumDescriptions": [
402 "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).", 402 "First try to use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb), if it's not installed try to use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools).",
403 "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)", 403 "Use [CodeLLDB](https://marketplace.visualstudio.com/items?itemName=vadimcn.vscode-lldb)",
404 "Use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)" 404 "Use [MS C++ tools](https://marketplace.visualstudio.com/items?itemName=ms-vscode.cpptools)"
405 ] 405 ]
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
diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts
index 9b0780650..e8035c7d2 100644
--- a/editors/code/src/commands/runnables.ts
+++ b/editors/code/src/commands/runnables.ts
@@ -78,10 +78,15 @@ function getLldbDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, s
78 }; 78 };
79} 79}
80 80
81const debugOutput = vscode.window.createOutputChannel("Debug");
82
81async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> { 83async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> {
82 let cargo = new Cargo(config.cwd || '.'); 84 debugOutput.clear();
85
86 let cargo = new Cargo(config.cwd || '.', debugOutput);
83 let executable = await cargo.executableFromArgs(config.args, config.extraArgs); 87 let executable = await cargo.executableFromArgs(config.args, config.extraArgs);
84 88
89 // if we are here, there were no compilation errors.
85 return { 90 return {
86 type: (os.platform() === "win32") ? "cppvsdbg" : 'cppdbg', 91 type: (os.platform() === "win32") ? "cppvsdbg" : 'cppdbg',
87 request: "launch", 92 request: "launch",