command_palette_hooks.rs

 1use std::any::TypeId;
 2
 3use collections::HashSet;
 4use gpui::{Action, AppContext, Global};
 5
 6#[derive(Default)]
 7pub struct CommandPaletteFilter {
 8    pub hidden_namespaces: HashSet<&'static str>,
 9    pub hidden_action_types: HashSet<TypeId>,
10}
11
12impl Global for CommandPaletteFilter {}
13
14pub struct CommandPaletteInterceptor(
15    pub Box<dyn Fn(&str, &AppContext) -> Option<CommandInterceptResult>>,
16);
17
18impl Global for CommandPaletteInterceptor {}
19
20pub struct CommandInterceptResult {
21    pub action: Box<dyn Action>,
22    pub string: String,
23    pub positions: Vec<usize>,
24}