debugger: Run build in terminal (#29645)
Currently contains the pre-work of making sessions creatable without a definition, but still need to change the spawn in terminal to use the running session Release Notes: - N/A --------- Co-authored-by: Piotr Osiewicz <24362066+osiewicz@users.noreply.github.com>
This commit is contained in:
parent
c12e6376b8
commit
ff215b4f11
12 changed files with 695 additions and 622 deletions
|
@ -20,7 +20,8 @@ pub use debug_format::{
|
|||
};
|
||||
pub use task_template::{
|
||||
DebugArgsRequest, HideStrategy, RevealStrategy, TaskTemplate, TaskTemplates,
|
||||
substitute_all_template_variables_in_str,
|
||||
substitute_all_template_variables_in_str, substitute_variables_in_map,
|
||||
substitute_variables_in_str,
|
||||
};
|
||||
pub use vscode_debug_format::VsCodeDebugTaskFile;
|
||||
pub use vscode_format::VsCodeTaskFile;
|
||||
|
|
|
@ -293,6 +293,28 @@ fn to_hex_hash(object: impl Serialize) -> anyhow::Result<String> {
|
|||
Ok(hex::encode(hasher.finalize()))
|
||||
}
|
||||
|
||||
pub fn substitute_variables_in_str(template_str: &str, context: &TaskContext) -> Option<String> {
|
||||
let mut variable_names = HashMap::default();
|
||||
let mut substituted_variables = HashSet::default();
|
||||
let task_variables = context
|
||||
.task_variables
|
||||
.0
|
||||
.iter()
|
||||
.map(|(key, value)| {
|
||||
let key_string = key.to_string();
|
||||
if !variable_names.contains_key(&key_string) {
|
||||
variable_names.insert(key_string.clone(), key.clone());
|
||||
}
|
||||
(key_string, value.as_str())
|
||||
})
|
||||
.collect::<HashMap<_, _>>();
|
||||
substitute_all_template_variables_in_str(
|
||||
template_str,
|
||||
&task_variables,
|
||||
&variable_names,
|
||||
&mut substituted_variables,
|
||||
)
|
||||
}
|
||||
pub fn substitute_all_template_variables_in_str<A: AsRef<str>>(
|
||||
template_str: &str,
|
||||
task_variables: &HashMap<String, A>,
|
||||
|
@ -349,6 +371,31 @@ fn substitute_all_template_variables_in_vec(
|
|||
Some(expanded)
|
||||
}
|
||||
|
||||
pub fn substitute_variables_in_map(
|
||||
keys_and_values: &HashMap<String, String>,
|
||||
context: &TaskContext,
|
||||
) -> Option<HashMap<String, String>> {
|
||||
let mut variable_names = HashMap::default();
|
||||
let mut substituted_variables = HashSet::default();
|
||||
let task_variables = context
|
||||
.task_variables
|
||||
.0
|
||||
.iter()
|
||||
.map(|(key, value)| {
|
||||
let key_string = key.to_string();
|
||||
if !variable_names.contains_key(&key_string) {
|
||||
variable_names.insert(key_string.clone(), key.clone());
|
||||
}
|
||||
(key_string, value.as_str())
|
||||
})
|
||||
.collect::<HashMap<_, _>>();
|
||||
substitute_all_template_variables_in_map(
|
||||
keys_and_values,
|
||||
&task_variables,
|
||||
&variable_names,
|
||||
&mut substituted_variables,
|
||||
)
|
||||
}
|
||||
fn substitute_all_template_variables_in_map(
|
||||
keys_and_values: &HashMap<String, String>,
|
||||
task_variables: &HashMap<String, &str>,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue