Add additional debug options

This commit is contained in:
vsrs 2020-05-07 17:07:58 +03:00
parent c4ca6e29c2
commit 5426e2927e
3 changed files with 21 additions and 3 deletions

View file

@ -418,6 +418,16 @@
"default": {
"/rustc/<id>": "${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/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."
}
}
},

View file

@ -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<string> {
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));

View file

@ -113,6 +113,8 @@ export class Config {
return {
engine: this.get<string>("debug.engine"),
engineSettings: this.get<object>("debug.engineSettings"),
openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"),
sourceFileMap: sourceFileMap,
};
}