ClangCodeModel: Do not let clangd insert header files on completion

... by default.
This feature often doesn't do what you'd want it to, so we make it opt-
in.

Change-Id: I631eae9c154ddcb0e8feeac44c5d5c0265706a67
Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
Christian Kandeler
2021-10-27 11:03:42 +02:00
parent 6bf8e5dfce
commit 2ecbbb126d
4 changed files with 21 additions and 2 deletions

View File

@@ -521,8 +521,10 @@ static BaseClientInterface *clientInterface(Project *project, const Utils::FileP
const CppEditor::ClangdSettings settings(CppEditor::ClangdProjectSettings(project).settings());
if (!settings.indexingEnabled())
indexingOption += "=0";
Utils::CommandLine cmd{settings.clangdFilePath(), {indexingOption, "--limit-results=0",
"--clang-tidy=0"}};
const QString headerInsertionOption = QString("--header-insertion=")
+ (settings.autoIncludeHeaders() ? "iwyu" : "never");
Utils::CommandLine cmd{settings.clangdFilePath(), {indexingOption, headerInsertionOption,
"--limit-results=0", "--clang-tidy=0"}};
if (settings.workerThreadLimit() != 0)
cmd.addArg("-j=" + QString::number(settings.workerThreadLimit()));
if (!jsonDbDir.isEmpty())