Delay the automatic completion.

This commit is contained in:
Roberto Raggi
2010-07-19 14:06:00 +02:00
parent ecdee3271c
commit a0faf279d5
4 changed files with 46 additions and 5 deletions

View File

@@ -658,7 +658,7 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
QChar characterUnderCursor = editor->characterAt(pos);
if (!characterUnderCursor.isLetterOrNumber()) {
const int startOfName = findStartOfName(pos);
if (pos - startOfName == 3) {
if (pos - startOfName >= 3) {
const QChar firstCharacter = editor->characterAt(startOfName);
if (firstCharacter.isLetter() || firstCharacter == QLatin1Char('_')) {
// Finally check that we're not inside a comment or string (code copied from startOfOperator)
@@ -1725,6 +1725,11 @@ void CppCodeCompletion::completions(QList<TextEditor::CompletionItem> *completio
}
}
}
if (completions->size() == 1) {
if (key == completions->first().text)
completions->clear();
}
}
QList<TextEditor::CompletionItem> CppCodeCompletion::removeDuplicates(const QList<TextEditor::CompletionItem> &items)