feat: Added command line palette option to open/focus views

This commit is contained in:
WerWolv
2025-08-08 22:36:46 +02:00
parent df1e97af0a
commit ad87f005fe
3 changed files with 39 additions and 18 deletions

View File

@@ -405,7 +405,7 @@ namespace hex::plugin::builtin {
return result;
},
[](auto input) {
return fmt::format("Provider: {}", input.data());
return fmt::format("Data Source: {}", input.data());
});
ContentRegistry::CommandPaletteCommands::add(
@@ -414,6 +414,27 @@ namespace hex::plugin::builtin {
"hex.builtin.command.convert.desc",
handleConversionCommand);
ContentRegistry::CommandPaletteCommands::addHandler(
ContentRegistry::CommandPaletteCommands::Type::SymbolCommand,
"+",
[](const auto &input) {
std::vector<ContentRegistry::CommandPaletteCommands::impl::QueryResult> result;
for (const auto &[unlocalizedName, view] : ContentRegistry::Views::impl::getEntries()) {
const auto name = Lang(unlocalizedName);
if (!hex::containsIgnoreCase(name, input))
continue;
result.emplace_back(fmt::format("Focus {} View", name), [&view](const auto &) {
view->bringToFront();
});
}
return result;
},
[](auto input) {
return fmt::format("Focus {} View", input.data());
});
}
}