From b23bb73bee76f669ded276cf9cef5191964a8c59 Mon Sep 17 00:00:00 2001 From: Ivan Donchevskii Date: Fri, 31 Aug 2018 14:25:37 +0200 Subject: [PATCH] CppTools: Do not auto-trigger completion after '{' and '(' in the new line There's no token before the first symbol in the line. With no information it's better to avoid triggering automatic completion after the first token. Change-Id: I9d3aca3bf72485c6eca6e03d9b8691abf0492bcc Reviewed-by: Eike Ziller Reviewed-by: Marco Bubke --- src/plugins/cpptools/cppcompletionassistprocessor.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/plugins/cpptools/cppcompletionassistprocessor.cpp b/src/plugins/cpptools/cppcompletionassistprocessor.cpp index 07ba1acc488..527fd586ab7 100644 --- a/src/plugins/cpptools/cppcompletionassistprocessor.cpp +++ b/src/plugins/cpptools/cppcompletionassistprocessor.cpp @@ -161,9 +161,12 @@ void CppCompletionAssistProcessor::startOfOperator(QTextDocument *textDocument, *kind = T_EOF_SYMBOL; start = positionInDocument; } + } else { + *kind = T_EOF_SYMBOL; + start = positionInDocument; } } else if (*kind == T_LBRACE) { - if (tokenIdx > 0 && !twoIndentifiersBeforeLBrace(tokens, tokenIdx)) { + if (tokenIdx <= 0 || !twoIndentifiersBeforeLBrace(tokens, tokenIdx)) { *kind = T_EOF_SYMBOL; start = positionInDocument; }