diff options
| author | vsrs <vit@conrlab.com> | 2020-04-30 15:25:04 +0300 |
|---|---|---|
| committer | vsrs <vit@conrlab.com> | 2020-04-30 15:25:04 +0300 |
| commit | eb6f9c23e19eae9015bd859941c5e8cbf4622cba (patch) | |
| tree | 2351f7107655517008c4adc85b16b36d76e3a1ae /editors/code/src | |
| parent | 73a1947d19b4d3c29aa462e856e3d410d6e1e5dd (diff) | |
| download | rust-eb6f9c23e19eae9015bd859941c5e8cbf4622cba.tar.gz rust-eb6f9c23e19eae9015bd859941c5e8cbf4622cba.zip | |
pass Cargo errors to the Debug output channel
Diffstat (limited to 'editors/code/src')
| -rw-r--r-- | editors/code/src/cargo.ts | 17 | ||||
| -rw-r--r-- | editors/code/src/commands/runnables.ts | 7 |
2 files changed, 18 insertions, 6 deletions
diff --git a/editors/code/src/cargo.ts b/editors/code/src/cargo.ts index 5999187f4b8..857b84d59a2 100644 --- a/editors/code/src/cargo.ts +++ b/editors/code/src/cargo.ts @@ -1,5 +1,6 @@ import * as cp from 'child_process'; import * as readline from 'readline'; +import { OutputChannel } from 'vscode'; interface CompilationArtifact { fileName: string; @@ -10,10 +11,13 @@ interface CompilationArtifact { export class Cargo { rootFolder: string; - env?: { [key: string]: string }; + env?: Record<string, string>; + output: OutputChannel; - public constructor(cargoTomlFolder: string) { + public constructor(cargoTomlFolder: string, output: OutputChannel, env: Record<string, string> | undefined = undefined) { this.rootFolder = cargoTomlFolder; + this.output = output; + this.env = env; } public async artifactsFromArgs(cargoArgs: string[]): Promise<CompilationArtifact[]> { @@ -34,14 +38,17 @@ export class Cargo { }) } } + else if( message.reason == 'compiler-message') { + this.output.append(message.message.rendered); + } }, - _stderr => { - // TODO: to output + stderr => { + this.output.append(stderr); } ); } catch (err) { - // TODO: to output + this.output.show(true); throw new Error(`Cargo invocation has failed: ${err}`); } diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 9b07806508f..e8035c7d229 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 }; } +const debugOutput = vscode.window.createOutputChannel("Debug"); + async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record<string, string>): Promise<vscode.DebugConfiguration> { - let cargo = new Cargo(config.cwd || '.'); + debugOutput.clear(); + + let cargo = new Cargo(config.cwd || '.', debugOutput); let executable = await cargo.executableFromArgs(config.args, config.extraArgs); + // if we are here, there were no compilation errors. return { type: (os.platform() === "win32") ? "cppvsdbg" : 'cppdbg', request: "launch", |
