Commit 9bdb97e2 authored by Thorbjørn Lindeijer's avatar Thorbjørn Lindeijer
Browse files

Trigger only on exactly 3 characters for C++ completion

Allowing any length more than 2 is too slow at the moment. We'd first
need to find a way to avoid recalculating the complete list of items
for every character while the key isn't matching anything.
parent e101d8ec
...@@ -656,9 +656,9 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor) ...@@ -656,9 +656,9 @@ bool CppCodeCompletion::triggersCompletion(TextEditor::ITextEditable *editor)
return true; return true;
} else if (completionSettings().m_completionTrigger == TextEditor::AutomaticCompletion) { } else if (completionSettings().m_completionTrigger == TextEditor::AutomaticCompletion) {
// Trigger completion after at least three characters of a name have been typed // Trigger completion after three characters of a name have been typed
const int startOfName = findStartOfName(pos); const int startOfName = findStartOfName(pos);
if (pos - startOfName > 2) { if (pos - startOfName == 3) {
const QChar firstCharacter = editor->characterAt(startOfName); const QChar firstCharacter = editor->characterAt(startOfName);
if (firstCharacter.isLetter() || firstCharacter == QLatin1Char('_')) if (firstCharacter.isLetter() || firstCharacter == QLatin1Char('_'))
return true; return true;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment