Skip to main content

CommandPaletteProvider

Trait CommandPaletteProvider 

Source
pub trait CommandPaletteProvider<Cmd> {
    // Required methods
    fn all_matching(&mut self, query: &FuzzyQuery) -> Vec<MatchGroup<Cmd>> ;
    fn cmd_row(&self, ui: &Ui, cmd: &MatchedCmd<Cmd>, selected: bool) -> CmdRow;

    // Provided method
    fn initial_hint_ui(&mut self, _ui: &mut Ui) { ... }
}
Expand description

One source of commands.

The type of the command is up to the user to provide.

For instance: match file names, and return a Cmd::OpenFile(Path).

Required Methods§

Source

fn all_matching(&mut self, query: &FuzzyQuery) -> Vec<MatchGroup<Cmd>>

Find commands that matches this query.

Source

fn cmd_row(&self, ui: &Ui, cmd: &MatchedCmd<Cmd>, selected: bool) -> CmdRow

Build the visual content of a command row.

The palette handles wrapping, layout, the selection background and input; this just supplies the (already highlight-styled) text and any decorations.

Tip: use FuzzyMatch::highlight_matching_text to underline the matched characters.

Provided Methods§

Source

fn initial_hint_ui(&mut self, _ui: &mut Ui)

Show when the query field is empty (the user hasn’t typed anything yet).

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§