| 165 | } |
| 166 | |
| 167 | bool ClangCodeCompletionModel::shouldStartCompletion(KTextEditor::View* view, const QString& inserted, |
| 168 | bool userInsertion, const KTextEditor::Cursor& position) |
| 169 | { |
| 170 | const QString noCompletionAfter = QStringLiteral(";{}]) "); |
| 171 | |
| 172 | if (inserted.isEmpty() || consistsOfWhitespace(inserted)) { |
| 173 | return false; |
| 174 | } |
| 175 | const auto lastChar = inserted.at(inserted.size() - 1); |
| 176 | if (noCompletionAfter.contains(lastChar)) { |
| 177 | return false; |
| 178 | } |
| 179 | const auto wordAtPosition = view->document()->wordAt(position); |
| 180 | if (!wordAtPosition.isEmpty() && wordAtPosition.at(0).isDigit()) { |
| 181 | return false; |
| 182 | } |
| 183 | // also show include path completion after dashes |
| 184 | if (userInsertion && lastChar == QLatin1Char('-') && includePathCompletionRequired(view->document()->line(position.line()))) { |
| 185 | return true; |
| 186 | } |
| 187 | if (userInsertion && inserted.endsWith(QLatin1String("::"))) { |
| 188 | return true; |
| 189 | } |
| 190 | |
| 191 | return KDevelop::CodeCompletionModel::shouldStartCompletion(view, inserted, userInsertion, position); |
| 192 | } |
| 193 | |
| 194 | KTextEditor::Range ClangCodeCompletionModel::completionRange(KTextEditor::View* view, const KTextEditor::Cursor& position) |
| 195 | { |
nothing calls this directly
no test coverage detected