MCPcopy Create free account
hub / github.com/Serial-Studio/Serial-Studio / completionPrefix

Method completionPrefix

lib/QCodeEditor/src/internal/QCodeEditor.cpp:968–989  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

966}
967
968QString QCodeEditor::completionPrefix() const
969{
970 const auto cursor = textCursor();
971 const auto blockText = cursor.block().text();
972 const int end = cursor.positionInBlock();
973
974 int start = end;
975 while (start > 0)
976 {
977 const QChar ch = blockText[start - 1];
978 if (!ch.isLetterOrNumber() && ch != '_' && ch != '$' && ch != '.')
979 break;
980
981 --start;
982 }
983
984 auto prefix = blockText.mid(start, end - start);
985 while (prefix.startsWith('.'))
986 prefix.remove(0, 1);
987
988 return prefix;
989}

Callers 2

proceedCompleterEndMethod · 0.80
insertCompletionMethod · 0.80

Calls 2

textMethod · 0.45
removeMethod · 0.45

Tested by

no test coverage detected