This commit is contained in:
parent
b31617a2f3
commit
f07d297ce0
|
@ -32,6 +32,7 @@ pub struct MatchSummary<'a> {
|
|||
pub id: i32,
|
||||
pub label: &'a str,
|
||||
pub tag: Option<&'a str>,
|
||||
pub additional_search_terms: Vec<&'a str>,
|
||||
pub is_builtin: bool,
|
||||
}
|
||||
|
||||
|
@ -65,6 +66,11 @@ impl<'a> MatchSelector for MatchSelectorAdapter<'a> {
|
|||
id: m.id.to_string(),
|
||||
label: clipped_label,
|
||||
tag: m.tag.map(String::from),
|
||||
additional_search_terms: m
|
||||
.additional_search_terms
|
||||
.into_iter()
|
||||
.map(String::from)
|
||||
.collect(),
|
||||
is_builtin: m.is_builtin,
|
||||
}
|
||||
})
|
||||
|
|
|
@ -49,6 +49,7 @@ fn convert_items(choices: &[espanso_render::extension::choice::Choice]) -> Vec<S
|
|||
id: choice.id.to_string(),
|
||||
label: choice.label.to_string(),
|
||||
tag: None,
|
||||
additional_search_terms: vec![],
|
||||
is_builtin: false,
|
||||
})
|
||||
.collect()
|
||||
|
|
|
@ -129,12 +129,14 @@ impl<'a> super::engine::process::middleware::match_select::MatchProvider<'a>
|
|||
id: m.id,
|
||||
label: m.description(),
|
||||
tag: m.cause_description(),
|
||||
additional_search_terms: m.search_terms(),
|
||||
is_builtin: false,
|
||||
},
|
||||
MatchVariant::Builtin(m) => MatchSummary {
|
||||
id: m.id,
|
||||
label: m.label,
|
||||
tag: m.triggers.first().map(String::as_ref),
|
||||
additional_search_terms: vec![],
|
||||
is_builtin: true,
|
||||
},
|
||||
})
|
||||
|
|
|
@ -32,6 +32,7 @@ pub struct SearchItem {
|
|||
pub id: String,
|
||||
pub label: String,
|
||||
pub tag: Option<String>,
|
||||
pub additional_search_terms: Vec<String>,
|
||||
pub is_builtin: bool,
|
||||
}
|
||||
|
||||
|
|
|
@ -73,6 +73,7 @@ struct ModuloSearchItemConfig<'a> {
|
|||
id: &'a str,
|
||||
label: &'a str,
|
||||
trigger: Option<&'a str>,
|
||||
search_terms: Vec<&'a str>,
|
||||
is_builtin: bool,
|
||||
}
|
||||
|
||||
|
@ -84,6 +85,15 @@ fn convert_items(items: &[SearchItem]) -> Vec<ModuloSearchItemConfig> {
|
|||
id: &item.id,
|
||||
label: &item.label,
|
||||
trigger: item.tag.as_deref(),
|
||||
search_terms: if item.additional_search_terms.is_empty() {
|
||||
vec![]
|
||||
} else {
|
||||
item
|
||||
.additional_search_terms
|
||||
.iter()
|
||||
.map(|term| term.as_str())
|
||||
.collect()
|
||||
},
|
||||
is_builtin: item.is_builtin,
|
||||
})
|
||||
.collect()
|
||||
|
|
Loading…
Reference in New Issue
Block a user