Clang: Fix providing snippets for another case

We have to indicate snippet addition for the PassThroughToLibClang case.

This completes

    commit d946ff5403
    Clang: Fix adding completion snippets after {

Change-Id: Ib543c415d4fdcc99d8bbf4815930f3d8481bc810
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Marco Bubke <marco.bubke@qt.io>
This commit is contained in:
Nikolai Kosjar
2018-11-26 09:47:14 +01:00
parent f5fb9932a2
commit bc6c65396f
2 changed files with 9 additions and 0 deletions

View File

@@ -157,6 +157,7 @@ void ClangCompletionContextAnalyzer::handleFunctionCall(int afterOperatorPositio
setActionAndClangPosition(CompleteSlot, afterOperatorPosition); setActionAndClangPosition(CompleteSlot, afterOperatorPosition);
} else if (m_interface->position() != afterOperatorPosition) { } else if (m_interface->position() != afterOperatorPosition) {
// No function completion if cursor is not after '(' or ',' // No function completion if cursor is not after '(' or ','
m_addSnippets = true;
m_positionForProposal = afterOperatorPosition; m_positionForProposal = afterOperatorPosition;
setActionAndClangPosition(PassThroughToLibClang, afterOperatorPosition); setActionAndClangPosition(PassThroughToLibClang, afterOperatorPosition);
} else { } else {

View File

@@ -312,6 +312,14 @@ TEST_F(ClangCompletionContextAnalyzer, AfterOpeningParenthesis)
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, 0, 0, positionInText, true)); ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, 0, 0, positionInText, true));
} }
TEST_F(ClangCompletionContextAnalyzer, AfterOpeningBraceAndIdentifierOnNewLine)
{
auto analyzer = runAnalyzer("if (1) {\n"
"cla@");
ASSERT_THAT(analyzer, HasResult(CCA::PassThroughToLibClang, -3, -3, positionInText, true));
}
TEST_F(ClangCompletionContextAnalyzer, ArgumentOneAtSignal) TEST_F(ClangCompletionContextAnalyzer, ArgumentOneAtSignal)
{ {
auto analyzer = runAnalyzer("SIGNAL(@"); auto analyzer = runAnalyzer("SIGNAL(@");