lua: Change CompletionRequested handler to use an event table. (#5280)

This commit is contained in:
Mm2PL
2024-03-30 15:23:02 +01:00
committed by GitHub
parent b35f10fa54
commit d4b8feac7d
8 changed files with 62 additions and 15 deletions
+6 -2
View File
@@ -433,8 +433,12 @@ std::pair<bool, QStringList> PluginController::updateCustomCompletions(
qCDebug(chatterinoLua)
<< "Processing custom completions from plugin" << name;
auto &cb = *opt;
auto errOrList =
cb(query, fullTextContent, cursorPosition, isFirstWord);
auto errOrList = cb(lua::api::CompletionEvent{
.query = query,
.full_text_content = fullTextContent,
.cursor_position = cursorPosition,
.is_first_word = isFirstWord,
});
if (std::holds_alternative<int>(errOrList))
{
guard.handled();