From 061c986c85c47e08de9b1e70ce290d176b75b201 Mon Sep 17 00:00:00 2001 From: ifengqi <362254883@qq.com> Date: Wed, 2 Oct 2024 20:56:49 +0800 Subject: [PATCH] Update the inlay hint after receiving the notification. (#3561) --- defaults/run.toml | 3 ++- lapce-app/src/terminal/data.rs | 10 ++++++++-- 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/defaults/run.toml b/defaults/run.toml index 5b225161..35478aba 100644 --- a/defaults/run.toml +++ b/defaults/run.toml @@ -1,3 +1,4 @@ + # The run config is used for both run mode and debug mode [[configs]] @@ -7,7 +8,7 @@ name = "task" # the type of the debugger. If not set, it can't be debugged but can still be run # type = "lldb" -# the program to run +# the program to run, e.g. "${workspace}\\target\\debug\\check.exe" program = "" # the program arguments, e.g. args = ["arg1", "arg2"], optional diff --git a/lapce-app/src/terminal/data.rs b/lapce-app/src/terminal/data.rs index 2471ef8c..9514a9e8 100644 --- a/lapce-app/src/terminal/data.rs +++ b/lapce-app/src/terminal/data.rs @@ -801,8 +801,7 @@ pub fn expand( } else { (run_debug.program.clone(), run_debug.args.clone()) }; - - let program = if program == "${lapce}" { + let mut program = if program == "${lapce}" { std::env::current_exe().map_err(|e| { anyhow!("Failed to get current exe for ${{lapce}} run and debug: {e}") })?.to_str().ok_or_else(|| anyhow!("Failed to convert ${{lapce}} path to str"))?.to_string() @@ -810,6 +809,13 @@ pub fn expand( program }; + if program.contains("${workspace}") { + if let Some(workspace) = workspace.path.as_ref().and_then(|x| x.to_str()) + { + program = program.replace("${workspace}", workspace); + } + } + if let Some(args) = &mut args { for arg in args { // Replace all mentions of ${workspace} with the current workspace path