feat: trigger completion of commands on the input of backlash / char

This commit is contained in:
Srevin Saju
2021-05-01 13:30:24 +03:00
parent ee595ed374
commit 6575d23072
4 changed files with 17 additions and 1 deletions

View File

@@ -149,7 +149,7 @@ QVariantMap ChatDocumentHandler::getAutocompletionInfo()
};
}
if (autoCompletePrefix.startsWith("@") || autoCompletePrefix.startsWith(":")) {
if (autoCompletePrefix.startsWith("@") || autoCompletePrefix.startsWith(":") || autoCompletePrefix.startsWith("/")) {
m_autoCompleteBeginPosition = textBeforeCursor.lastIndexOf(" ") + 1; // 1 == space
if (autoCompletePrefix.startsWith("@")) {
@@ -159,6 +159,14 @@ QVariantMap ChatDocumentHandler::getAutocompletionInfo()
{"type", AutoCompletionType::User},
};
}
if (autoCompletePrefix.startsWith("/")) {
return QVariantMap{
{"keyword", autoCompletePrefix},
{"type", AutoCompletionType::Command},
};
}
return QVariantMap{
{"keyword", autoCompletePrefix},
{"type", AutoCompletionType::Emoji},