about summary refs log tree commit diff
path: root/editors/code/src/debug.ts
diff options
context:
space:
mode:
authorRungsikorn Rungsikavarnich <rungsikorn.rungsikavarnich@woven-planet.global>2023-03-30 15:22:20 +0900
committerRungsikorn Rungsikavarnich <rungsikorn.rungsikavarnich@woven-planet.global>2023-03-30 15:39:49 +0900
commitfb9a1dd87ed3c44bb261958fbe2111f19e9185c9 (patch)
tree8ee80f92cd6f1ee9399923c3182b848d79a527e1 /editors/code/src/debug.ts
parent17e31b7d3b1dd6f42a5a4c99c2e07d5d035345ac (diff)
downloadrust-fb9a1dd87ed3c44bb261958fbe2111f19e9185c9.tar.gz
rust-fb9a1dd87ed3c44bb261958fbe2111f19e9185c9.zip
Missing runnable env on debug target
Fix bug in Rust Analyzer where runnable debugging did not pass
environment variable from configuration to child process of Cargo
on binary build stage
Diffstat (limited to 'editors/code/src/debug.ts')
-rw-r--r--editors/code/src/debug.ts9
1 files changed, 6 insertions, 3 deletions
diff --git a/editors/code/src/debug.ts b/editors/code/src/debug.ts
index 268b70b4fbb..cffee1de6af 100644
--- a/editors/code/src/debug.ts
+++ b/editors/code/src/debug.ts
@@ -118,8 +118,8 @@ async function getDebugConfiguration(
         return path.normalize(p).replace(wsFolder, "${workspaceFolder" + workspaceQualifier + "}");
     }
 
-    const executable = await getDebugExecutable(runnable);
     const env = prepareEnv(runnable, ctx.config.runnableEnv);
+    const executable = await getDebugExecutable(runnable, env);
     let sourceFileMap = debugOptions.sourceFileMap;
     if (sourceFileMap === "auto") {
         // let's try to use the default toolchain
@@ -156,8 +156,11 @@ async function getDebugConfiguration(
     return debugConfig;
 }
 
-async function getDebugExecutable(runnable: ra.Runnable): Promise<string> {
-    const cargo = new Cargo(runnable.args.workspaceRoot || ".", debugOutput);
+async function getDebugExecutable(
+    runnable: ra.Runnable,
+    env: Record<string, string>
+): Promise<string> {
+    const cargo = new Cargo(runnable.args.workspaceRoot || ".", debugOutput, env);
     const executable = await cargo.executableFromArgs(runnable.args.cargoArgs);
 
     // if we are here, there were no compilation errors.