From 7b79d24ad5b251c0806a07aa7769e824f3c37fec Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 2 Jul 2020 19:47:40 +0300 Subject: Add runnable env support. --- editors/code/src/debug.ts | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) (limited to 'editors/code/src/debug.ts') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 61c12dbe0..525d26923 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -5,9 +5,10 @@ import * as ra from './lsp_ext'; import { Cargo } from './toolchain'; import { Ctx } from "./ctx"; +import { prepareEnv } from "./run"; const debugOutput = vscode.window.createOutputChannel("Debug"); -type DebugConfigProvider = (config: ra.Runnable, executable: string, sourceFileMap?: Record) => vscode.DebugConfiguration; +type DebugConfigProvider = (config: ra.Runnable, executable: string, env: Record, sourceFileMap?: Record) => vscode.DebugConfiguration; export async function makeDebugConfig(ctx: Ctx, runnable: ra.Runnable): Promise { const scope = ctx.activeRustEditor?.document.uri; @@ -92,7 +93,8 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise { return executable; } -function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { +function getLldbDebugConfig(runnable: ra.Runnable, executable: string, env: Record, sourceFileMap?: Record): vscode.DebugConfiguration { return { type: "lldb", request: "launch", @@ -130,11 +132,12 @@ function getLldbDebugConfig(runnable: ra.Runnable, executable: string, sourceFil args: runnable.args.executableArgs, cwd: runnable.args.workspaceRoot, sourceMap: sourceFileMap, - sourceLanguages: ["rust"] + sourceLanguages: ["rust"], + env }; } -function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFileMap?: Record): vscode.DebugConfiguration { +function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, env: Record, sourceFileMap?: Record): vscode.DebugConfiguration { return { type: (os.platform() === "win32") ? "cppvsdbg" : "cppdbg", request: "launch", @@ -142,6 +145,7 @@ function getCppvsDebugConfig(runnable: ra.Runnable, executable: string, sourceFi program: executable, args: runnable.args.executableArgs, cwd: runnable.args.workspaceRoot, - sourceFileMap: sourceFileMap, + sourceFileMap, + env, }; } -- cgit v1.2.3 From 271abb7bc43f11c9b9e9c1353b162d9d267b1d21 Mon Sep 17 00:00:00 2001 From: vsrs Date: Thu, 2 Jul 2020 21:33:26 +0300 Subject: Add tests --- editors/code/src/debug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'editors/code/src/debug.ts') diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts index 525d26923..bd92c5b6d 100644 --- a/editors/code/src/debug.ts +++ b/editors/code/src/debug.ts @@ -93,7 +93,7 @@ async function getDebugConfiguration(ctx: Ctx, runnable: ra.Runnable): Promise