From 5426e2927e317a5e78179a5bd74b9414c0651b86 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 7 May 2020 17:07:58 +0300 Subject: Add additional debug options --- editors/code/package.json | 10 ++++++++++ editors/code/src/commands/runnables.ts | 12 +++++++++--- editors/code/src/config.ts | 2 ++ 3 files changed, 21 insertions(+), 3 deletions(-) (limited to 'editors') diff --git a/editors/code/package.json b/editors/code/package.json index eeb3d3513..84aea8249 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -418,6 +418,16 @@ "default": { "/rustc/": "${env:USERPROFILE}/.rustup/toolchains//lib/rustlib/src/rust" } + }, + "rust-analyzer.debug.openUpDebugPane": { + "description": "Whether to open up the Debug Pane on debugging start.", + "type": "boolean", + "default": false + }, + "rust-analyzer.debug.engineSettings": { + "type": "object", + "default": {}, + "description": "Optional settings passed to the debug engine." } } }, diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 7bb8727e7..782a7ba89 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts @@ -91,8 +91,6 @@ function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFile const debugOutput = vscode.window.createOutputChannel("Debug"); async function getDebugExecutable(config: ra.Runnable): Promise { - debugOutput.clear(); - const cargo = new Cargo(config.cwd || '.', debugOutput); const executable = await cargo.executableFromArgs(config.args); @@ -130,8 +128,16 @@ export function debugSingle(ctx: Ctx): Cmd { return; } + debugOutput.clear(); + if (ctx.config.debug.openUpDebugPane) { + debugOutput.show(true); + } + const executable = await getDebugExecutable(config); - const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + let debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap); + for (var key in debugOptions.engineSettings) { + debugConfig[key] = (debugOptions.engineSettings as any)[key]; + } debugOutput.appendLine("Launching debug configuration:"); debugOutput.appendLine(JSON.stringify(debugConfig, null, 2)); diff --git a/editors/code/src/config.ts b/editors/code/src/config.ts index 8bceaaf72..533be1913 100644 --- a/editors/code/src/config.ts +++ b/editors/code/src/config.ts @@ -113,6 +113,8 @@ export class Config { return { engine: this.get("debug.engine"), + engineSettings: this.get("debug.engineSettings"), + openUpDebugPane: this.get("debug.openUpDebugPane"), sourceFileMap: sourceFileMap, }; } -- cgit v1.2.3