From 2315c6b764ca75b8bf1e778ebea386e57787a0f2 Mon Sep 17 00:00:00 2001 From: Jonas Rinke Date: Sat, 25 May 2024 16:53:01 +0200 Subject: [PATCH 1/4] Use correct format for setting environment variables when debugging with cpptools --- src/tools/rust-analyzer/editors/code/src/debug.ts | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 855e8b082ae88..3e4446e5668f0 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -194,7 +194,9 @@ function getCCppDebugConfig( args: runnable.args.executableArgs, cwd: runnable.args.cwd || runnable.args.workspaceRoot || ".", sourceFileMap, - env, + environment: Object.entries(env).map(entry => { + return { "name": entry[0], "value": entry[1] } + }), // See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941 osx: { MIMode: "lldb", From 78fe45e273b38e3770bb738a524c227996248cae Mon Sep 17 00:00:00 2001 From: Jonas Rinke Date: Sat, 25 May 2024 17:04:48 +0200 Subject: [PATCH 2/4] Semicolon --- src/tools/rust-analyzer/editors/code/src/debug.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 3e4446e5668f0..91b07aed01719 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -195,7 +195,7 @@ function getCCppDebugConfig( cwd: runnable.args.cwd || runnable.args.workspaceRoot || ".", sourceFileMap, environment: Object.entries(env).map(entry => { - return { "name": entry[0], "value": entry[1] } + return { "name": entry[0], "value": entry[1] }; }), // See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941 osx: { From 09677b03ddbe2f1357a03d0f96c991e930df9176 Mon Sep 17 00:00:00 2001 From: Jonas Rinke Date: Sat, 25 May 2024 17:08:17 +0200 Subject: [PATCH 3/4] Formatting --- src/tools/rust-analyzer/editors/code/src/debug.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 91b07aed01719..3de8cb9c29202 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -194,8 +194,8 @@ function getCCppDebugConfig( args: runnable.args.executableArgs, cwd: runnable.args.cwd || runnable.args.workspaceRoot || ".", sourceFileMap, - environment: Object.entries(env).map(entry => { - return { "name": entry[0], "value": entry[1] }; + environment: Object.entries(env).map((entry) => { + return { name: entry[0], value: entry[1] }; }), // See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941 osx: { From eb9894f3c9ea2ec18b36de46db417659fbe3aa9e Mon Sep 17 00:00:00 2001 From: Jonas Rinke Date: Sat, 25 May 2024 22:42:39 +0200 Subject: [PATCH 4/4] Removed return --- src/tools/rust-analyzer/editors/code/src/debug.ts | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/src/tools/rust-analyzer/editors/code/src/debug.ts b/src/tools/rust-analyzer/editors/code/src/debug.ts index 3de8cb9c29202..4b96e4d5c8ef0 100644 --- a/src/tools/rust-analyzer/editors/code/src/debug.ts +++ b/src/tools/rust-analyzer/editors/code/src/debug.ts @@ -194,9 +194,10 @@ function getCCppDebugConfig( args: runnable.args.executableArgs, cwd: runnable.args.cwd || runnable.args.workspaceRoot || ".", sourceFileMap, - environment: Object.entries(env).map((entry) => { - return { name: entry[0], value: entry[1] }; - }), + environment: Object.entries(env).map((entry) => ({ + name: entry[0], + value: entry[1], + })), // See https://github.com/rust-lang/rust-analyzer/issues/16901#issuecomment-2024486941 osx: { MIMode: "lldb",