Fixed command palette and added /web command

This commit is contained in:
WerWolv
2021-02-08 19:56:04 +01:00
parent 1b98afe37d
commit 179e222919
8 changed files with 87 additions and 42 deletions

View File

@@ -18,7 +18,8 @@ namespace hex::plugin::builtin {
try {
result = evaluator.evaluate(input);
} catch (std::runtime_error &e) {}
} catch (std::exception &e) {}
if (result.has_value())
return hex::format("#%s = %Lf", input.data(), result.value());
@@ -26,6 +27,16 @@ namespace hex::plugin::builtin {
return hex::format("#%s = ???", input.data());
});
hex::ContentRegistry::CommandPaletteCommands::add(
hex::ContentRegistry::CommandPaletteCommands::Type::KeywordCommand,
"/web", "Website lookup",
[](auto input) {
return hex::format("Navigate to '%s'", input.data());
},
[](auto input) {
hex::openWebpage(input);
});
}
}