forked from qt-creator/qt-creator
Clang: Fix adding completion snippets after {
...e.g. as in "void f() {".
The criteria whether to change snippets got invalidated with
commit 8d0391a4f9
Clang: Treat brace initialization as constructor completion
as the completion operator might be T_LBRACE now instead of T_EOF_SYMBOL
for normal completions.
This fixes the plugin test ClangCodeCompletionTest::testCompleteGlobals.
Add also unit tests.
Change-Id: I85cf522b9b307359c5c3e25198dd228cbb68ded0
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
This commit is contained in:
@@ -169,6 +169,7 @@ void ClangCompletionContextAnalyzer::handleFunctionCall(int afterOperatorPositio
|
||||
m_positionForProposal,
|
||||
functionNameStart);
|
||||
} else { // e.g. "(" without any function name in front
|
||||
m_addSnippets = true;
|
||||
m_positionForProposal = afterOperatorPosition;
|
||||
setActionAndClangPosition(PassThroughToLibClang, afterOperatorPosition);
|
||||
}
|
||||
@@ -179,6 +180,8 @@ void ClangCompletionContextAnalyzer::handleFunctionCall(int afterOperatorPositio
|
||||
bool ClangCompletionContextAnalyzer::handleNonFunctionCall(int position)
|
||||
{
|
||||
if (isTokenForPassThrough(m_completionOperator)) {
|
||||
if (m_completionOperator == T_EOF_SYMBOL)
|
||||
m_addSnippets = true;
|
||||
setActionAndClangPosition(PassThroughToLibClang, position);
|
||||
return true;
|
||||
} else if (m_completionOperator == T_DOXY_COMMENT) {
|
||||
|
||||
Reference in New Issue
Block a user