Start out Copilot2;

Add hidden_action_types to CommandPaletteFilter.
WindowContext.available_actions now returns global actions as well.

Co-authored-by: Antonio <antonio@zed.dev>
This commit is contained in:
Piotr Osiewicz 2023-12-05 14:53:01 +01:00
parent 001ce47a0c
commit b73ccc8180
8 changed files with 388 additions and 357 deletions

View file

@ -49,7 +49,10 @@ impl CommandPalette {
.filter_map(|action| {
let name = gpui::remove_the_2(action.name());
let namespace = name.split("::").next().unwrap_or("malformed action name");
if filter.is_some_and(|f| f.filtered_namespaces.contains(namespace)) {
if filter.is_some_and(|f| {
f.hidden_namespaces.contains(namespace)
|| f.hidden_action_types.contains(&action.type_id())
}) {
return None;
}
@ -429,7 +432,7 @@ mod tests {
cx.update(|cx| {
cx.set_global(CommandPaletteFilter::default());
cx.update_global::<CommandPaletteFilter, _>(|filter, _| {
filter.filtered_namespaces.insert("editor");
filter.hidden_namespaces.insert("editor");
})
});