Skip to content

Commit bd9cc02

Browse files
committed
Auto merge of #17295 - 0xJonas:fix_passing_env_vars_to_cpptools, r=Veykril
Use correct format for setting environment variables when debugging with cpptools The RA VSCode extension uses an incorrect format for the environment variables in the `launch.json` when debugging with the C/C++ Extension. This extension uses a different format than CodeLLDB or NativeDebug, which means that the environment variables are not actually set for the debuggee. What it currently looks like: ```json "env": { "NAME": "VALUE" } ``` What the C/C++ extension expects: ```json "environment": [ { "name": "NAME", "value": "VALUE" } ] ``` For reference: https://code.visualstudio.com/docs/cpp/launch-json-reference#_environment
2 parents 56d77b9 + eb9894f commit bd9cc02

File tree

1 file changed

+4
-1
lines changed
  • src/tools/rust-analyzer/editors/code/src

1 file changed

+4
-1
lines changed

src/tools/rust-analyzer/editors/code/src/debug.ts

+4-1
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,10 @@ function getCCppDebugConfig(
194194
args: runnable.args.executableArgs,
195195
cwd: runnable.args.cwd || runnable.args.workspaceRoot || ".",
196196
sourceFileMap,
197-
env,
197+
environment: Object.entries(env).map((entry) => ({
198+
name: entry[0],
199+
value: entry[1],
200+
})),
198201
// See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941
199202
osx: {
200203
MIMode: "lldb",

0 commit comments

Comments
 (0)