forked from qt-creator/qt-creator
LanguageClient: Support limit parameter for completion request
... and make use of it in the ClangCodeModel tests. Change-Id: Ib2186273aec1db9b354892c2e1c4ebd82e3c1c96 Reviewed-by: <github-actions-qt-creator@cristianadam.eu> Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org> Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -167,13 +167,7 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
|
||||
indexingOption += "=0";
|
||||
const QString headerInsertionOption = QString("--header-insertion=")
|
||||
+ (settings.autoIncludeHeaders() ? "iwyu" : "never");
|
||||
#ifdef WITH_TESTS
|
||||
// For the #include < test, which needs to get a local header file, but the list
|
||||
// is being flooded with system include headers. 4280 on Windows!
|
||||
const QString limitResults = QString("--limit-results=0");
|
||||
#else
|
||||
const QString limitResults = QString("--limit-results=%1").arg(settings.completionResults());
|
||||
#endif
|
||||
Utils::CommandLine cmd{settings.clangdFilePath(),
|
||||
{indexingOption,
|
||||
headerInsertionOption,
|
||||
|
||||
@@ -1550,6 +1550,9 @@ void ClangdTestCompletion::testCompletePreprocessorKeywords()
|
||||
|
||||
void ClangdTestCompletion::testCompleteIncludeDirective()
|
||||
{
|
||||
// Our local include is way down in the result list.
|
||||
client()->setCompletionResultsLimit(0);
|
||||
|
||||
ProposalModelPtr proposal;
|
||||
getProposal("includeDirectiveCompletion.cpp", proposal);
|
||||
|
||||
@@ -1558,6 +1561,7 @@ void ClangdTestCompletion::testCompleteIncludeDirective()
|
||||
QVERIFY(hasItem(proposal, " otherFile.h>"));
|
||||
QVERIFY(hasItem(proposal, " mylib/"));
|
||||
QVERIFY(!hasSnippet(proposal, "class "));
|
||||
client()->setCompletionResultsLimit(-1);
|
||||
}
|
||||
|
||||
void ClangdTestCompletion::testCompleteGlobals()
|
||||
|
||||
Reference in New Issue
Block a user