#include <command_palette.h>
Public Member Functions | |
void | AddCommand (const std::string &name, const std::string &category, const std::string &description, const std::string &shortcut, std::function< void()> callback) |
void | RecordUsage (const std::string &name) |
std::vector< CommandEntry > | SearchCommands (const std::string &query) |
std::vector< CommandEntry > | GetRecentCommands (int limit=10) |
std::vector< CommandEntry > | GetFrequentCommands (int limit=10) |
void | SaveHistory (const std::string &filepath) |
void | LoadHistory (const std::string &filepath) |
Private Member Functions | |
int | FuzzyScore (const std::string &text, const std::string &query) |
Private Attributes | |
std::unordered_map< std::string, CommandEntry > | commands_ |
Definition at line 22 of file command_palette.h.
void yaze::editor::CommandPalette::AddCommand | ( | const std::string & | name, |
const std::string & | category, | ||
const std::string & | description, | ||
const std::string & | shortcut, | ||
std::function< void()> | callback | ||
) |
Definition at line 10 of file command_palette.cc.
References yaze::editor::CommandEntry::callback, yaze::editor::CommandEntry::category, commands_, yaze::editor::CommandEntry::description, yaze::editor::CommandEntry::name, and yaze::editor::CommandEntry::shortcut.
void yaze::editor::CommandPalette::RecordUsage | ( | const std::string & | name | ) |
Definition at line 22 of file command_palette.cc.
References commands_, and yaze::editor::CommandEntry::usage_count.
std::vector< CommandEntry > yaze::editor::CommandPalette::SearchCommands | ( | const std::string & | query | ) |
Definition at line 68 of file command_palette.cc.
References commands_, and FuzzyScore().
std::vector< CommandEntry > yaze::editor::CommandPalette::GetRecentCommands | ( | int | limit = 10 | ) |
Definition at line 107 of file command_palette.cc.
References commands_.
std::vector< CommandEntry > yaze::editor::CommandPalette::GetFrequentCommands | ( | int | limit = 10 | ) |
Definition at line 128 of file command_palette.cc.
References commands_.
void yaze::editor::CommandPalette::SaveHistory | ( | const std::string & | filepath | ) |
Definition at line 149 of file command_palette.cc.
void yaze::editor::CommandPalette::LoadHistory | ( | const std::string & | filepath | ) |
Definition at line 153 of file command_palette.cc.
|
private |
Definition at line 32 of file command_palette.cc.
Referenced by SearchCommands().
|
private |
Definition at line 40 of file command_palette.h.
Referenced by AddCommand(), GetFrequentCommands(), GetRecentCommands(), RecordUsage(), and SearchCommands().