From 0f362fc7d56a91f75cffc876ac3e49d5ef4703fe Mon Sep 17 00:00:00 2001 From: Guyutongxue Date: Thu, 9 May 2024 16:50:11 +0800 Subject: [PATCH 1/2] fix #41 --- src-tauri/src/tasks/dotvscode.rs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src-tauri/src/tasks/dotvscode.rs b/src-tauri/src/tasks/dotvscode.rs index 823842b..dad60b5 100644 --- a/src-tauri/src/tasks/dotvscode.rs +++ b/src-tauri/src/tasks/dotvscode.rs @@ -241,7 +241,7 @@ pub fn launch_json(args: &TaskArgs) -> Result<()> { ("console", serde_json::to_value("externalTerminal")?) }; - let json = json!({ + let mut json = json!({ "version": "0.2.0", "configurations": [ { @@ -262,10 +262,19 @@ pub fn launch_json(args: &TaskArgs) -> Result<()> { "MIMode": debugger_name, // Only used in cppdbg (GDB mode) "miDebuggerPath": debugger_path, // .. "preLaunchTask": if args.ascii_check { "ascii check" } else { "single file build" }, - "internalConsosleOptions": "neverOpen" + "internalConsoleOptions": "neverOpen" } ] }); + if debug_type == "cppdbg" { + json["configurations"][0]["setupCommands"] = json!([ + { + "description": "Enable pretty-printing for gdb", + "text": "-enable-pretty-printing", + "ignoreFailures": true + } + ]); + } debug!("launch.json: {}", json); From 4d9bcf9a23cb7e949b218ce724e3d3dc4e574a34 Mon Sep 17 00:00:00 2001 From: Guyutongxue Date: Thu, 9 May 2024 17:58:40 +0800 Subject: [PATCH 2/2] fix env --- src-tauri/src/tasks/dotvscode.rs | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/src-tauri/src/tasks/dotvscode.rs b/src-tauri/src/tasks/dotvscode.rs index dad60b5..1a60b18 100644 --- a/src-tauri/src/tasks/dotvscode.rs +++ b/src-tauri/src/tasks/dotvscode.rs @@ -47,7 +47,11 @@ fn single_file_build_task(args: &TaskArgs) -> Result { ]; if args.setup.is_msvc() { c_args.push("/EHsc".to_string()); - if !args.args.iter().any(|a| a.starts_with("/execution-charset")) { + if !args + .args + .iter() + .any(|a| a.starts_with("/execution-charset")) + { c_args.push("/execution-charset:utf-8".to_string()); } c_args.push("/source-charset:utf-8".to_string()); @@ -252,12 +256,12 @@ pub fn launch_json(args: &TaskArgs) -> Result<()> { "args": [], "stopAtEntry": false, "cwd": "${fileDirname}", - "environment": [], - "env": { - "PATH": format!("{}{}${{env:PATH}}", - bin_path.to_string(), - PATH_SEPARATOR) - }, + "environment": [ + { + "name": "PATH", + "value": format!("{}{}${{env:PATH}}", bin_path.to_string(), PATH_SEPARATOR) + } + ], console_settings.0: console_settings.1, "MIMode": debugger_name, // Only used in cppdbg (GDB mode) "miDebuggerPath": debugger_path, // ..