| 966 | } |
| 967 | |
| 968 | QString 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 | } |
no test coverage detected