From 042917e6e3bc3cb05e08e487ee8a7d0d4ae3af6b Mon Sep 17 00:00:00 2001 From: vsrs Date: Wed, 29 Apr 2020 13:10:42 +0300 Subject: Configuration settings and source maps support --- editors/code/package.json | 19 +++++++++++++++++++ editors/code/src/cargo.ts | 1 - editors/code/src/commands/runnables.ts | 33 +++++++++++++++++++++++++-------- editors/code/src/config.ts | 9 ++++++++- 4 files changed, 52 insertions(+), 10 deletions(-) diff --git a/editors/code/package.json b/editors/code/package.json index b8aaa07d8..aa8065171 100644 --- a/editors/code/package.json +++ b/editors/code/package.json @@ -388,6 +388,25 @@ "description": "Enable Proc macro support, cargo.loadOutDirsFromCheck must be enabled.", "type": "boolean", "default": false + }, + "rust-analyzer.debug.engine": { + "type": [ + "null", + "string" + ], + "enum": [ + "ms-vscode.cpptools", + "vadimcn.vscode-lldb" + ], + "default": null, + "description": "Preffered debug engine." + }, + "rust-analyzer.debug.sourceFileMap" : { + "type":"object", + "description": "Optional source file mappings passed to the debug engine.", + "default": { + "": "" + } } } }, diff --git a/editors/code/src/cargo.ts b/editors/code/src/cargo.ts index d119b6225..5999187f4 100644 --- a/editors/code/src/cargo.ts +++ b/editors/code/src/cargo.ts @@ -1,4 +1,3 @@ -import { window } from 'vscode'; import * as cp from 'child_process'; import * as readline from 'readline'; diff --git a/editors/code/src/commands/runnables.ts b/editors/code/src/commands/runnables.ts index 26db18156..befb8b366 100644 --- a/editors/code/src/commands/runnables.ts +++ b/editors/code/src/commands/runnables.ts @@ -63,7 +63,7 @@ export function runSingle(ctx: Ctx): Cmd { }; } -function getLldbDebugConfig(config: ra.Runnable) : vscode.DebugConfiguration { +function getLldbDebugConfig(config: ra.Runnable, sourceFileMap: Record): vscode.DebugConfiguration { return { type: "lldb", request: "launch", @@ -72,11 +72,12 @@ function getLldbDebugConfig(config: ra.Runnable) : vscode.DebugConfiguration { args: config.args, }, args: config.extraArgs, - cwd: config.cwd + cwd: config.cwd, + sourceMap: sourceFileMap }; } -async function getCppvsDebugConfig(config: ra.Runnable) : Promise { +async function getCppvsDebugConfig(config: ra.Runnable, sourceFileMap: Record): Promise { let cargo = new Cargo(config.cwd || '.'); let executable = await cargo.executableFromArgs(config.args, config.extraArgs); @@ -87,6 +88,7 @@ async function getCppvsDebugConfig(config: ra.Runnable) : Promise("updates.askBeforeDownload"); } get traceExtension() { return this.get("trace.extension"); } - get inlayHints() { return { typeHints: this.get("inlayHints.typeHints"), @@ -107,4 +106,12 @@ export class Config { command: this.get("checkOnSave.command"), }; } + + get debug() { + return { + engine: this.get("debug.engine"), + sourceFileMap: this.get>("debug.sourceFileMap"), + }; + } + } -- cgit v1.2.3