forked from qt-creator/qt-creator
Clang: Fix dot-arrow-correction for zero results
If there are no completion items, do not add snippets since these will otherwise pop-up at undesired positions, e.g. when: 1) Typing float/doubles: 0. 2) Typing file suffix in include directives: #include "stdio. Task-number: QTCREATORBUG-16188 Change-Id: Ie1c29826dc62dc447b2ff57b0c5537eb9d9511ef Reviewed-by: David Schulz <david.schulz@theqtcompany.com>
This commit is contained in:
@@ -932,18 +932,28 @@ void ClangCodeCompletionTest::testCompleteConstructorAndFallbackToGlobalCompleti
|
||||
QVERIFY(!hasSnippet(t.proposal, "class"));
|
||||
}
|
||||
|
||||
// Explicitly Inserting The Dot
|
||||
// ----------------------------
|
||||
// Inserting the dot for is important since it will send the editor
|
||||
// content to the backend and thus generate an unsaved file on the backend
|
||||
// side. The unsaved file enables us to do the dot to arrow correction.
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteWithDotToArrowCorrection()
|
||||
{
|
||||
// Inserting the dot for this test is important since it will send the editor
|
||||
// content to the backend and thus generate an unsaved file on the backend
|
||||
// side. The unsaved file enables us to do the dot to arrow correction.
|
||||
|
||||
ProjectLessCompletionTest t("dotToArrowCorrection.cpp",
|
||||
QStringLiteral("."));
|
||||
QStringLiteral(".")); // See above "Explicitly Inserting The Dot"
|
||||
|
||||
QVERIFY(hasItem(t.proposal, "member"));
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testDontCompleteWithDotToArrowCorrectionForFloats()
|
||||
{
|
||||
ProjectLessCompletionTest t("noDotToArrowCorrectionForFloats.cpp",
|
||||
QStringLiteral(".")); // See above "Explicitly Inserting The Dot"
|
||||
|
||||
QCOMPARE(t.proposal->size(), 0);
|
||||
}
|
||||
|
||||
void ClangCodeCompletionTest::testCompleteProjectDependingCode()
|
||||
{
|
||||
const TestDocument testDocument("completionWithProject.cpp");
|
||||
|
||||
Reference in New Issue
Block a user