Skip to content

Commit 5426e29

Browse files
committed
Add additional debug options
1 parent c4ca6e2 commit 5426e29

File tree

3 files changed

+21
-3
lines changed

3 files changed

+21
-3
lines changed

editors/code/package.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -418,6 +418,16 @@
418418
"default": {
419419
"/rustc/<id>": "${env:USERPROFILE}/.rustup/toolchains/<toolchain-id>/lib/rustlib/src/rust"
420420
}
421+
},
422+
"rust-analyzer.debug.openUpDebugPane": {
423+
"description": "Whether to open up the Debug Pane on debugging start.",
424+
"type": "boolean",
425+
"default": false
426+
},
427+
"rust-analyzer.debug.engineSettings": {
428+
"type": "object",
429+
"default": {},
430+
"description": "Optional settings passed to the debug engine."
421431
}
422432
}
423433
},

editors/code/src/commands/runnables.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,6 @@ function getCppvsDebugConfig(config: ra.Runnable, executable: string, sourceFile
9191
const debugOutput = vscode.window.createOutputChannel("Debug");
9292

9393
async function getDebugExecutable(config: ra.Runnable): Promise<string> {
94-
debugOutput.clear();
95-
9694
const cargo = new Cargo(config.cwd || '.', debugOutput);
9795
const executable = await cargo.executableFromArgs(config.args);
9896

@@ -130,8 +128,16 @@ export function debugSingle(ctx: Ctx): Cmd {
130128
return;
131129
}
132130

131+
debugOutput.clear();
132+
if (ctx.config.debug.openUpDebugPane) {
133+
debugOutput.show(true);
134+
}
135+
133136
const executable = await getDebugExecutable(config);
134-
const debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap);
137+
let debugConfig = knownEngines[debugEngine.id](config, executable, debugOptions.sourceFileMap);
138+
for (var key in debugOptions.engineSettings) {
139+
debugConfig[key] = (debugOptions.engineSettings as any)[key];
140+
}
135141

136142
debugOutput.appendLine("Launching debug configuration:");
137143
debugOutput.appendLine(JSON.stringify(debugConfig, null, 2));

editors/code/src/config.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -113,6 +113,8 @@ export class Config {
113113

114114
return {
115115
engine: this.get<string>("debug.engine"),
116+
engineSettings: this.get<object>("debug.engineSettings"),
117+
openUpDebugPane: this.get<boolean>("debug.openUpDebugPane"),
116118
sourceFileMap: sourceFileMap,
117119
};
118120
}

0 commit comments

Comments
 (0)