diff --git a/espanso/src/cli/worker/engine/process/middleware/match_select.rs b/espanso/src/cli/worker/engine/process/middleware/match_select.rs index 0f0b74e..a4850c7 100644 --- a/espanso/src/cli/worker/engine/process/middleware/match_select.rs +++ b/espanso/src/cli/worker/engine/process/middleware/match_select.rs @@ -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, } }) diff --git a/espanso/src/cli/worker/engine/process/middleware/render/extension/choice.rs b/espanso/src/cli/worker/engine/process/middleware/render/extension/choice.rs index d2f245d..8fe4ddf 100644 --- a/espanso/src/cli/worker/engine/process/middleware/render/extension/choice.rs +++ b/espanso/src/cli/worker/engine/process/middleware/render/extension/choice.rs @@ -49,6 +49,7 @@ fn convert_items(choices: &[espanso_render::extension::choice::Choice]) -> Vec 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, }, }) diff --git a/espanso/src/gui/mod.rs b/espanso/src/gui/mod.rs index 86ae5db..2c1e998 100644 --- a/espanso/src/gui/mod.rs +++ b/espanso/src/gui/mod.rs @@ -32,6 +32,7 @@ pub struct SearchItem { pub id: String, pub label: String, pub tag: Option, + pub additional_search_terms: Vec, pub is_builtin: bool, } diff --git a/espanso/src/gui/modulo/search.rs b/espanso/src/gui/modulo/search.rs index 163ef94..a55d525 100644 --- a/espanso/src/gui/modulo/search.rs +++ b/espanso/src/gui/modulo/search.rs @@ -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 { 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()